Commit graph

707 commits

Author SHA1 Message Date
Daniel Rosenwasser a81bf8cdad Emit non-ASCII characters with unicode escape sequences. 2015-02-27 11:33:39 -08:00
Vladimir Matveev 626b6d4c0c merge with master 2015-02-27 11:28:14 -08:00
CyrusNajmabadi f4158eecf4 Merge pull request #2162 from Microsoft/declarations
Simplify some places in the compiler where we have esoteric declarations.
2015-02-26 23:21:35 -08:00
Vladimir Matveev 7be2e50fb3 merge with master 2015-02-26 21:47:18 -08:00
Cyrus Najmabadi 27e888284d CR feedback. 2015-02-26 17:37:01 -08:00
Vladimir Matveev 4bf0bb6405 added comments 2015-02-26 17:19:47 -08:00
Cyrus Najmabadi 11772e75a7 Simplify how catch clauses are represented in our AST. 2015-02-26 17:19:19 -08:00
Cyrus Najmabadi 71c3bccef4 Produce better wrapping for object literal emit with computed property names. 2015-02-26 15:35:17 -08:00
Vladimir Matveev 4ff22a0886 added SyntaxKind.ModuleDeclaration to list of block scope containers 2015-02-26 11:58:40 -08:00
Vladimir Matveev b183f8dca6 added 'nodeIsSynthesized' function, use createSynthesizedNode in emitter to build synthetic nodes 2015-02-26 11:18:16 -08:00
Ivo Gabe de Wolff 80ff139e4a Merge branch 'master' into taggedTemplates 2015-02-26 08:12:52 +01:00
Vladimir Matveev 33dfe5068a do not emit default initializer for let\const in for-in\for-of statements 2015-02-25 17:44:09 -08:00
Anders Hejlsberg 0e8b6dfdf4 Support for 'export default' with expressions 2015-02-25 16:03:03 -08:00
Cyrus Najmabadi f7214442cd Merge branch 'master' into functionEmit
Conflicts:
	src/compiler/emitter.ts
2015-02-25 14:25:24 -08:00
Cyrus Najmabadi 8bfc35030d CR feedback. 2015-02-25 14:23:51 -08:00
Cyrus Najmabadi b9f43b9563 CR feedback. 2015-02-25 14:16:35 -08:00
Cyrus Najmabadi 29e5983acf Merge branch 'binaryExprAlloc'
Conflicts:
	src/compiler/emitter.ts
2015-02-25 14:04:20 -08:00
Cyrus Najmabadi 09c0c17937 Avoid unnecessary allocations in binary expression emit. 2015-02-25 13:59:16 -08:00
Cyrus Najmabadi 9c867e3280 Avoid allocation during binary expression emit when unnecessary. 2015-02-25 13:44:08 -08:00
Cyrus Najmabadi 8e292a19f7 Avoid allocation during binary expression emit when unnecessary. 2015-02-25 13:40:25 -08:00
Cyrus Najmabadi 5f9b49fa4c Avoid allocation during binary expression emit when unnecessary. 2015-02-25 13:39:57 -08:00
Cyrus Najmabadi ebd63c0fde Remove optimization of eliding the preamble code for functions without statements. 2015-02-25 13:32:45 -08:00
Ivo Gabe de Wolff ac8e395d98 Merge branch 'master' into taggedTemplates 2015-02-25 21:26:38 +01:00
Vladimir Matveev 210e602b75 merge with destructuringDts 2015-02-25 00:01:15 -08:00
Vladimir Matveev f8ae8234c7 merge with master, fix emit for omitted expressions 2015-02-24 23:51:12 -08:00
Vladimir Matveev 8891128426 moved name generation logic to utilities 2015-02-24 23:36:02 -08:00
Vladimir Matveev def6812fac merge with master 2015-02-24 22:01:08 -08:00
Vladimir Matveev b8d78f91d2 Merge remote-tracking branch 'origin/master' into destructuringDts 2015-02-24 17:19:50 -08:00
Mohamed Hegazy 96e5286003 Merge branch 'master' into es6ImportDts
Conflicts:
	tests/baselines/reference/es6ImportDefaultBinding.errors.txt
	tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt
	tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt
	tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt
	tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt
	tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt
2015-02-24 15:53:38 -08:00
Ivo Gabe de Wolff 904b5204c8 operator -> operatorToken.kind 2015-02-24 07:13:38 +01:00
Ivo Gabe de Wolff 964ed7f0fd Rename callback to literalEmitter 2015-02-24 06:29:21 +01:00
Daniel Rosenwasser 0af4b8a2c2 Removed tree rewriting code 2015-02-23 17:50:37 -08:00
Daniel Rosenwasser a391d70baa Stop using rewrites for object literal downlevel emit. 2015-02-23 17:44:48 -08:00
CyrusNajmabadi 09e3cd625a Merge pull request #2104 from Microsoft/arrowFunctionEmit
Emit arrow functions with expression bodies 'as is' when targetting ES6 ...
2015-02-23 16:01:12 -08:00
Cyrus Najmabadi cfe3bb8f8d Merge branch 'master' into sideEffects
Conflicts:
	tests/baselines/reference/recursiveClassReferenceTest.js.map
2015-02-23 14:00:56 -08:00
Cyrus Najmabadi f46cb896a8 Be more conservative on when we'll emit a function in a single line. 2015-02-23 12:31:40 -08:00
Anders Hejlsberg f0f4ca6b06 Merge branch 'master' into es6Import
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/emitter.ts
	tests/baselines/reference/APISample_compile.js
	tests/baselines/reference/APISample_compile.types
	tests/baselines/reference/APISample_linter.js
	tests/baselines/reference/APISample_linter.types
	tests/baselines/reference/APISample_transform.js
	tests/baselines/reference/APISample_transform.types
	tests/baselines/reference/APISample_watcher.js
	tests/baselines/reference/APISample_watcher.types
	tests/baselines/reference/recursiveClassReferenceTest.js.map
	tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt
2015-02-23 11:15:56 -08:00
Cyrus Najmabadi 8d0dc91d64 CR feedback. 2015-02-22 20:51:34 -08:00
Cyrus Najmabadi 53ed427e0d Emit parameter initializers unless we are certain they don't have any side effects. 2015-02-22 18:01:57 -08:00
Ivo Gabe de Wolff c291d12cae Use createAndRecordTempVariable 2015-02-22 10:21:15 +01:00
Ivo Gabe de Wolff 63e1ddb043 Merge branch 'master' into taggedTemplates
Conflicts:
	tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js

tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.j
s

tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionEx
pressionsInSubstitutionExpression.js
	tests/baselines/reference/templateStringInObjectLiteral.js
2015-02-22 10:17:04 +01:00
Ivo Gabe de Wolff 35c815ef15 Respond to code review 2015-02-22 10:07:32 +01:00
Cyrus Najmabadi 91eedcddef Emit arrow functions with expression bodies 'as is' when targetting ES6 or higher. 2015-02-21 17:16:04 -08:00
Cyrus Najmabadi b99d70c212 Preserve newlines between object literal members. 2015-02-21 15:11:37 -08:00
Cyrus Najmabadi a228cb568c Merge branch 'master' into multiLineEmit2
Conflicts:
	tests/baselines/reference/computedPropertyNames11_ES5.js
	tests/baselines/reference/computedPropertyNames1_ES5.js
	tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js
	tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js
	tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js
	tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js
2015-02-21 15:00:23 -08:00
Cyrus Najmabadi d928baf9d4 Merge branch 'master' into multiLineEmit2
Conflicts:
	src/compiler/emitter.ts
	tests/baselines/reference/computedPropertyNames32_ES5.js
	tests/baselines/reference/computedPropertyNames33_ES6.js
	tests/baselines/reference/computedPropertyNames34_ES6.js
	tests/baselines/reference/computedPropertyNames35_ES5.js
	tests/baselines/reference/privateIndexer2.js
2015-02-21 14:37:54 -08:00
Cyrus Najmabadi 0ae0a6fa43 CR feedback. 2015-02-21 14:29:01 -08:00
Cyrus Najmabadi b29fba4602 Preserve newlines and indentation for binary expressions when possible. 2015-02-20 21:53:44 -08:00
Cyrus Najmabadi 8c90fc6bc8 Merge branch 'master' into binaryExpressionEmit
Conflicts:
	src/compiler/checker.ts
2015-02-20 21:28:15 -08:00
Daniel Rosenwasser 553f2f0974 Merge pull request #1950 from Microsoft/thanksLua
ES3/ES5 emit support for computed properties
2015-02-20 19:00:48 -08:00
Cyrus Najmabadi fc229368d1 Include the binary expression's operator in the AST. 2015-02-20 18:56:42 -08:00
Daniel Rosenwasser 4138fed1d7 Fixed case where property should not be emitted. 2015-02-20 18:42:07 -08:00
Daniel Rosenwasser bebdd73e13 Extracted out RHS patching property logic to function. 2015-02-20 18:16:52 -08:00
Daniel Rosenwasser 88c61e89a8 Addressed CR comments. 2015-02-20 18:02:14 -08:00
Cyrus Najmabadi eb5936b06f Merge branch 'master' into baseZero
Conflicts:
	src/harness/harnessLanguageService.ts
2015-02-20 16:56:58 -08:00
Daniel Rosenwasser 93c6ac0916 This is why we need an IO type constructor. 2015-02-20 16:54:07 -08:00
Daniel Rosenwasser ec678f3ebd Merge branch 'master' into thanksLua
Conflicts:
	src/compiler/emitter.ts
	tests/baselines/reference/computedPropertyNames12_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames14_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames15_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames17_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames32_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames35_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames3_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames42_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames5_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames6_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames8_ES5.errors.txt
	tests/baselines/reference/computedPropertyNames9_ES5.errors.txt
	tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt
	tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt
	tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt
2015-02-20 16:44:20 -08:00
Daniel Rosenwasser 78425d6e0f Removed unused text-concatenating emit. 2015-02-20 14:17:26 -08:00
Daniel Rosenwasser 51129a704d Rewrite the tree instead of hacking text together for downlevel object literals with computed properties. 2015-02-20 14:16:09 -08:00
Daniel Rosenwasser 0fd783f3ef Don't emit accessors multiple times. 2015-02-19 17:04:32 -08:00
Daniel Rosenwasser ce85b14589 Made the initial object literal properties indented. 2015-02-19 13:11:59 -08:00
Jason Freeman 5596993351 Merge branch 'master' into forOf
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	tests/baselines/reference/APISample_compile.js
	tests/baselines/reference/APISample_compile.types
	tests/baselines/reference/APISample_linter.js
	tests/baselines/reference/APISample_linter.types
	tests/baselines/reference/APISample_transform.js
	tests/baselines/reference/APISample_transform.types
	tests/baselines/reference/APISample_watcher.js
	tests/baselines/reference/APISample_watcher.types
2015-02-18 14:49:10 -08:00
Daniel Rosenwasser a6c5505881 Created a combined 'createAndRecordTempVariable' function. 2015-02-18 12:10:00 -08:00
Daniel Rosenwasser 826ed0545b Addressed CR feedback. 2015-02-18 12:01:24 -08:00
Vladimir Matveev 1dfd1b470e initial version of parsing 'for-of'
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
2015-02-18 11:30:00 -08:00
Daniel Rosenwasser 5fc2ec701b Merge branch 'master' into thanksLua
Conflicts:
	src/compiler/emitter.ts
	tests/baselines/reference/FunctionPropertyAssignments5_es6.js
	tests/baselines/reference/computedPropertyNames9_ES6.js
	tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js
	tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js
	tests/baselines/reference/parserES5ComputedPropertyName3.js
	tests/baselines/reference/parserES5ComputedPropertyName4.js
2015-02-17 17:43:06 -08:00
Vladimir Matveev b4c82c9401 added tests, accepted baselines 2015-02-17 17:04:31 -08:00
Vladimir Matveev e6cfc10acc added missing files 2015-02-17 16:26:32 -08:00
Sheetal Nandi fc1528f3e5 Dts for export * from "mod" and export { a, b as c,...} [from "mod"] 2015-02-17 09:28:55 -08:00
Sheetal Nandi 5b6a9a8517 Merge branch 'es6Import' into es6ImportDts 2015-02-17 08:29:45 -08:00
Cyrus Najmabadi cdc1b90e42 Fix function name. 2015-02-16 20:10:07 -08:00
Cyrus Najmabadi 124a77cc3a Remove 'ZeroBased' from all APIs, now that all APIs are zero based. 2015-02-16 19:35:45 -08:00
Cyrus Najmabadi edbedc7d5d Make code more clearly state that it is one based. 2015-02-16 17:47:32 -08:00
Cyrus Najmabadi 1098e80f4b Remove one-based helper function. 2015-02-16 17:41:07 -08:00
Cyrus Najmabadi 8ef4df8acb Move the emitter over to using zero based indexing. 2015-02-16 17:34:11 -08:00
Cyrus Najmabadi ab7d36d526 Move the emitter over to use zero based indexing. 2015-02-16 16:28:26 -08:00
Cyrus Najmabadi b3366ec8b4 name more line/char functions more clearly. Use zero based indexing in breakpoints. 2015-02-16 16:18:53 -08:00
Cyrus Najmabadi afb083ae5a Make method more clearly indicate that it is one based. 2015-02-16 15:39:49 -08:00
Cyrus Najmabadi 35b489d7d1 Rename our one-based methods to more clearly indicate that that's what base they use. 2015-02-16 15:20:05 -08:00
Vladimir Matveev 4aff9c357d explicitly initialize let binding in generated code to default value 2015-02-16 13:39:32 -08:00
Ivo Gabe de Wolff eedcb090e4 Merge master into taggedTemplates 2015-02-16 19:26:27 +01:00
Anders Hejlsberg a8152b6e50 Support for 'export *' declarations 2015-02-15 08:25:24 -08:00
Vladimir Matveev ba52d60c7a try only names generated in current scope with testing if name is unique 2015-02-14 14:23:37 -08:00
Vladimir Matveev a0bcd7eabf initial revision of downlevel compilation for let/const bindings 2015-02-14 00:48:46 -08:00
Anders Hejlsberg 6ef6217c16 Allow multiple (renaming) exports for same entity 2015-02-13 10:07:10 -08:00
Ivo Gabe de Wolff f77bedd6f6 Emit parens for tag of tagged template if necessary 2015-02-13 18:34:32 +01:00
Anders Hejlsberg 79be0a7d26 Support for ES6 export declarations (except export default and export *) 2015-02-12 18:05:02 -08:00
Sheetal Nandi 649cd3bce1 Declaration emit fixes for binding pattern in variable statements
Handles #2023
2015-02-12 13:23:49 -08:00
Jason Freeman 486cebd224 Merge branch 'master' of https://github.com/Microsoft/TypeScript into esSymbols 2015-02-12 11:03:35 -08:00
togru d94cbed413 Merge remote-tracking branch 'upstream/master' 2015-02-11 10:12:22 +01:00
togru 091f38b3e0 improved equality checks in AMD module sorting function 2015-02-11 10:10:11 +01:00
Sheetal Nandi 0332feda6a Merge branch 'es6Import' into es6ImportDts 2015-02-10 19:09:00 -08:00
Sheetal Nandi f8351c8865 Set the declarations of export assignment visible on demand through dts emit
Emit those new declarations asynchronously since they are otherwise not visible
2015-02-10 19:02:13 -08:00
Sheetal Nandi 863e73c75e Test case for emitting partial part of import syntax 2015-02-10 17:09:29 -08:00
Sheetal Nandi e0323b4c2f Emit the import declaration in d.ts file only if it is visible 2015-02-10 17:02:11 -08:00
Jason Freeman a94e61bfcd Merge branch 'master' of https://github.com/Microsoft/TypeScript into esSymbols
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
2015-02-10 16:20:32 -08:00
Anders Hejlsberg e8cc2bf5f7 Merge branch 'master' into es6Import 2015-02-10 16:17:50 -08:00
Sheetal Nandi 05fcdf0e30 Declaration for default bindings of the import syntax 2015-02-10 15:39:24 -08:00
Sheetal Nandi f2a28a5975 Declaration emit for NamedImport syntax 2015-02-10 15:16:38 -08:00
Anders Hejlsberg 3523233ae6 Rewrite named imports to reference properties on module instance 2015-02-10 14:59:20 -08:00
Sheetal Nandi 96139ca4d8 Enable declaration emit for import * as ns from "mod" syntax 2015-02-10 14:36:54 -08:00
Sheetal Nandi 6ac1bcca08 Enable declaration emit for import "mod" syntax 2015-02-10 13:43:05 -08:00
Anders Hejlsberg 4b92e42b62 Merge pull request #1931 from Microsoft/spreadCall
Support spread operator in call expressions
2015-02-10 09:24:53 -08:00
togru 8492dfdffd moved AMD module sorting to emitter, updated test case 2015-02-10 10:28:09 +01:00
Anders Hejlsberg e47f64c510 Checking of ES6 import declarations 2015-02-08 17:33:45 -08:00
Anders Hejlsberg 69d47ef854 Formatting fixes 2015-02-08 12:15:44 -08:00
Anders Hejlsberg c8cc19544e AMD emit for ES6 import declarations 2015-02-08 12:13:56 -08:00
Anders Hejlsberg 69bd05946a CommonJS emit for ES6 import declarations 2015-02-08 08:03:15 -08:00
Jason Freeman 35604426c8 Declaration emit for symbol properties 2015-02-06 21:32:54 -08:00
Jason Freeman e508bf7e86 Add symbol keyword 2015-02-06 21:32:02 -08:00
Cyrus Najmabadi f44144a77c Preserve newlines appropriately between elements of an object literal or array literal when emitting. 2015-02-06 20:16:35 -08:00
Cyrus Najmabadi 0fbbbffde6 Emit functions on a singline line if they were originally written on a single line. 2015-02-06 20:03:24 -08:00
Cyrus Najmabadi 11aa4d362b Provide specialized functions for emitting the body of a function depending on if that body is an expression or a block. 2015-02-06 19:53:52 -08:00
Cyrus Najmabadi 36b6f4e1b7 Preserve single line blocks when emitting. 2015-02-06 18:45:09 -08:00
Anders Hejlsberg 7bd14a7895 Merge branch 'master' into es6importcheck
Conflicts:
	src/compiler/checker.ts
2015-02-06 14:36:36 -08:00
Ivo Gabe de Wolff 04dd08da70 Resolve missed merge conflict 2015-02-06 16:45:26 +01:00
Ivo Gabe de Wolff 30c10fb7c4 Merge branch 'master' into taggedTemplates
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/emitter.ts
2015-02-06 16:44:16 +01:00
Anders Hejlsberg 0819ca897c Addressing CR feedback 2015-02-06 07:39:11 -08:00
Cyrus Najmabadi 5c0b38b203 Remove getEnumMemberValue, it is now subsumed into getConstantValue. 2015-02-05 18:26:56 -08:00
Cyrus Najmabadi f9d3b489f2 Put curly on the right line. 2015-02-05 17:11:06 -08:00
Cyrus Najmabadi 66a363f449 Simplify the API for emitting and reporting exit statuses to callers. 2015-02-05 15:50:18 -08:00
Cyrus Najmabadi e7f6693eda Move code for emitting above helper functions. 2015-02-05 14:46:50 -08:00
Cyrus Najmabadi b0061c1420 Emit both javascript and declarations in the presence of errors (*unless* -noEmitOnError is specified). 2015-02-05 14:41:04 -08:00
Daniel Rosenwasser c8691a189c Add newline before closing paren in multiline object literals. 2015-02-05 13:57:27 -08:00
togru 9974526101 updated code style, added tests, fixed regex bug, merged to latest branch 2015-02-05 12:07:00 +01:00
Cyrus Najmabadi 337a99f62a Change the API for getting diagnostics so that all calls go through a Program instance. 2015-02-05 01:47:29 -08:00
Daniel Rosenwasser ddb63d286b Emit computed properties in ES3/ES5 properly. 2015-02-04 18:35:13 -08:00
Cyrus Najmabadi 476c8249ac Remove 'isEmitBlocked' from the program API.
If emitting is blocked, then calling .emit on the program will simply return
immediately with an appropriate reason given in the EmitResult.
2015-02-04 17:48:29 -08:00
Cyrus Najmabadi bb307f8163 Simplify the API for emitting code from the Program instance. 2015-02-04 16:53:14 -08:00
Anders Hejlsberg 2494b2d90f Support spread operator in call expressions 2015-02-04 13:39:24 -08:00
Cyrus Najmabadi 95702a89a7 Fix spelling of 'Filename' to be 'FileName'. 2015-02-03 16:08:46 -08:00
CyrusNajmabadi fab351e0b6 Merge pull request #1913 from Microsoft/internalDTS
Provide an experimental flag that allows us to emit declarations except for nodes marked with '@internal'.
2015-02-03 16:29:04 -05:00
Cyrus Najmabadi 838b9b6998 Provide an experimental flag that allows us to emit declarations except for nodes marked with '@internal'. 2015-02-03 13:15:28 -08:00
Cyrus Najmabadi 0ca03048cf Move the code to actually emit higher up in the function.
Now it it precedes all the other function declarations, and is much easier to debug.
2015-02-03 12:46:01 -08:00
Vladimir Matveev 288e38fa36 merge with master 2015-02-03 11:26:39 -08:00
CyrusNajmabadi 22ed101267 Merge pull request #1899 from Microsoft/earlyErrors2
Emit even in the presence of parse errors.
2015-02-02 20:24:06 -05:00
Mohamed Hegazy 6807bf86a5 Merge pull request #1855 from stanthomas/master
issue #1833 : const enum: supress value comment in emitted javascript
2015-02-02 16:35:11 -08:00
Cyrus Najmabadi e63d795b1a Rename function. 2015-02-02 15:55:50 -08:00
Cyrus Najmabadi 350d768e8d Fix usage of tabs instead of spaces. 2015-02-02 15:50:16 -08:00
Cyrus Najmabadi dd8d3535ff Remove the concept of early errors from the compiler.
Currently only parse errors prevent emitting (And this will be changed in the next
code review as well).
2015-02-02 15:14:19 -08:00
Yui T 416267172d Address code review 2015-01-30 17:48:07 -08:00
Yui T 5d0376fc78 Address codereview 2015-01-30 14:09:10 -08:00
Stan Thomas 95e7015fa0 Supress const enum member value comment from emitted javascript in presence of --removeComments (revised) 2015-01-30 06:09:31 -05:00
Yui T fb2c5020a3 Clean up the checking of position 2015-01-29 16:38:05 -08:00
Yui T fd20695957 Remove flag and compare position 2015-01-29 16:07:55 -08:00
Yui T e4b206c4a2 Merge branch 'master' into emitArrowFunctionES6 2015-01-29 15:37:45 -08:00
Stan Thomas 17763ab040 Supress const enum member value comment from emitted javascript in presence of --removeComments 2015-01-29 17:26:53 -05:00
Yui T 2b200d4727 Address code review 2015-01-28 17:34:38 -08:00
Yui T 8d731d400c Address code review 2015-01-28 16:48:53 -08:00
Cyrus Najmabadi 3c5ff5310f CR feedback
.
2015-01-27 17:16:28 -08:00
Cyrus Najmabadi 71de2de6ed Merge branch 'master' into emitCleanup 2015-01-27 17:10:33 -08:00
Cyrus Najmabadi 34b342ac97 Fix method name. 2015-01-27 17:09:57 -08:00
Sheetal Nandi e0581899fa Rename existing import declaration to ImportEqualsDeclaration 2015-01-27 14:42:20 -08:00
Yui T 15b05e632d Merge branch 'master' into emitArrowFunctionES6 2015-01-27 13:40:19 -08:00
Yui T f219a2de25 Address code review; preserve users non-parenthesis 2015-01-26 19:00:38 -08:00
Ivo Gabe de Wolff 9fc0144163 Merge branch 'master' into taggedTemplates
Conflicts:
	src/compiler/checker.ts
	src/compiler/emitter.ts
2015-01-24 21:33:35 +01:00
Yui T 593a0992f9 Update emitter due to merge with master 2015-01-23 17:28:12 -08:00
Ivo Gabe de Wolff 39027d901a Rename emitParenthesized to emitParenthesizedIf 2015-01-23 15:46:32 +01:00
Ivo Gabe de Wolff cbec9a3a3a Respond to CR 2015-01-23 15:44:21 +01:00
Jason Freeman 4a7aa7e929 Address CR feedback 2015-01-22 19:09:10 -08:00
Cyrus Najmabadi a82289c8b4 Emit comments in a lot more places. 2015-01-22 15:58:00 -08:00
Cyrus Najmabadi d2e96c1779 Simplify enum emit. 2015-01-22 14:45:55 -08:00
Vladimir Matveev ad42afc4af resolve merge conflicts 2015-01-22 11:23:27 -08:00
Jason Freeman b022ccd430 Merge branch 'master' into computedProperties
Conflicts:
	src/compiler/checker.ts
2015-01-21 11:03:24 -08:00
Jason Freeman de5aa6c0d2 Fix source map scope name for computed properties 2015-01-21 11:01:05 -08:00
Yui T 581beb58dc Merge branch 'master' into emitArrowFunctionES6 2015-01-21 10:36:32 -08:00
Sheetal Nandi e8e2356afa Fixes the emit of comment when comment ends on last line
This fixes regression from 5a7500ca5e with addition of eof token
Handles #1714
2015-01-20 21:16:14 -08:00
Jason Freeman eb7798fbb2 Skip computed properties on declaration emit 2015-01-20 18:29:04 -08:00
Ivo Gabe de Wolff 434c908c36 Re-add debug assert & fix indent 2015-01-19 11:45:48 +01:00
Ivo Gabe de Wolff 161545de97 Change tagged template emit to new style 2015-01-19 11:33:43 +01:00
Vladimir Matveev 45ac06a0f2 move line map related function out of SourceFile 2015-01-16 12:02:12 -08:00
Anders Hejlsberg bce15cb368 Fixing negated language version checks 2015-01-16 07:15:31 -08:00
Yui T ba239c5812 Address code review 2015-01-15 17:12:44 -08:00
Anders Hejlsberg 65452aa011 Hardening compiler to accept empty CompilerOptions object 2015-01-15 15:57:08 -08:00
Ivo Gabe de Wolff 349841e2e3 Emit var in front of statement with tagged template 2015-01-09 21:22:42 +01:00
Daniel Rosenwasser 7b11621750 Merge pull request #1571 from Arnavion/1570-template-strings
Don't emit an empty template head literal if there's a template span with a non-empty literal.
2015-01-08 12:17:17 -08:00
Daniel Rosenwasser df4b3d2d37 Merge pull request #1547 from Microsoft/moveEmitHost
Moved EmitHost to utilities.ts so that it can be edited alone, and to fix resulting declaration file
2015-01-07 13:13:49 -08:00
Daniel Rosenwasser f32683d231 Merge pull request #1529 from Microsoft/uninstantiatedModulesBeforeClasses
Allow uninstantiated modules before clodules
2015-01-07 12:40:50 -08:00
Yui T 7d0fc62256 Emit this binding natively in es6 2015-01-07 11:54:12 -08:00
Yui T b0ea40164c Emit Arrow function natively in ES6 2015-01-06 18:18:37 -08:00
Arnavion b442d14e44 Don't emit an empty template head literal if there's a template span with a non-empty literal.
Fixes #1570
2015-01-06 15:28:06 -08:00
Arnavion 33534be268 Give MinusToken the same precedence as PlusToken for template expressions.
Fixes #1577
2015-01-06 02:42:02 -08:00
Ivo Gabe de Wolff a13af6b482 Move code to separate functions 2015-01-05 21:22:12 +01:00
Ivo Gabe de Wolff 8f28c95b04 Emit parens when an argument is a comma operator
Example:
foo`A${ 1 }B${ 2, 3 }C`;
2015-01-05 20:30:38 +01:00
Ivo Gabe de Wolff 69d724f554 Fix tagged templates that consist of a single part
Example:
foo `bar` should compile to foo([“bar”])
2015-01-04 20:58:45 +01:00
Ivo Gabe de Wolff c2d0bf82c4 Emit tagged templates when targeting ES3 or 5 2015-01-04 14:47:18 +01:00
Daniel Rosenwasser d907f99693 Moved EmitHost to types.ts so that utilities can be edited as a standalone file through dependency resolution. 2014-12-22 13:58:14 -08:00
Daniel Rosenwasser fac5201765 Only error on non-ambient instantiated modules preceding clodules. 2014-12-17 17:00:42 -08:00
Cyrus Najmabadi b37b98138d Merge branch 'master' into layering
Conflicts:
	src/compiler/checker.ts
	src/compiler/utilities.ts
2014-12-17 15:35:30 -08:00
Cyrus Najmabadi 6a08c54f42 Merge branch 'master' into sourceFileUpdate
Conflicts:
	src/compiler/checker.ts
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/harness/fourslash.ts
2014-12-17 13:22:04 -08:00
Cyrus Najmabadi 7f893f9b9a Rename method to be clearer. 2014-12-16 18:50:34 -08:00
Anders Hejlsberg fed3b5c0de Adding comment 2014-12-16 15:47:22 -08:00
Cyrus Najmabadi 94d576290e Don't expose EmitHost. it is only used by a non-exposed function. 2014-12-16 15:10:15 -08:00
Cyrus Najmabadi 5a2fb94a95 Clean things up so the services layer can easily emit without having to contort compiler hosts. 2014-12-16 14:42:58 -08:00
Cyrus Najmabadi f5ad79fe7a Remove the dependency that TypeChecker and Emitter have on Program.
Instead, these layers explicitly specify the functionality they need, and don't take in anything extra.
2014-12-16 14:12:17 -08:00
Cyrus Najmabadi b665323d45 Make the emitter no longer depend on the Program.
This breaks layering.  Also, it means the emitter depends on too large a surface area.
Now the emitter declares exactly what it needs, and only gets that.
2014-12-16 13:52:47 -08:00
Cyrus Najmabadi 4aa361d4bf Layer the compiler so that every layer only depends on hte layers below it.
The layering is now:

types
core
scanner
parser
binder
checker
emitter
program
2014-12-16 13:14:14 -08:00
Cyrus Najmabadi 0a8744e841 Add helper method to reduce so many double negatives in the code. 2014-12-16 03:19:13 -08:00
Cyrus Najmabadi c7bb0a5ae6 Don't store variable statement flags on its variable declaration children. 2014-12-16 02:50:38 -08:00
Anders Hejlsberg 667e82fba2 Addressing CR feedback + Run fourslash tests with ES5 emit 2014-12-15 15:16:54 -08:00
Anders Hejlsberg b878a27113 Support -target ES6 emit for destructuring, spread, and rest. 2014-12-14 09:43:14 -08:00
Anders Hejlsberg b416cbc599 Merge branch 'master' into spreadAndRest
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/parser.ts
2014-12-12 14:32:53 -08:00
Cyrus Najmabadi ffdddd53af Merge branch 'master' into funcDeclsInBlocks
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/parser.ts
2014-12-12 14:05:09 -08:00
Cyrus Najmabadi 83f0c91999 Properly emit 'void 0' when emitting destructuring assignments. 2014-12-12 11:28:05 -08:00
Anders Hejlsberg a42df7547e Rest element support in array destructuring declarations 2014-12-11 18:27:08 -08:00
Anders Hejlsberg 6babef417f Rest element support in array literal destructuring assignment 2014-12-11 17:41:24 -08:00
Anders Hejlsberg afa3111955 Check and emit of spread elements in array literals 2014-12-11 16:23:57 -08:00
Cyrus Najmabadi b692ea9b66 Remove TryBlock and FinallyBlock.
They break the rule that syntactically identical constructs use the same syntax kind.  This
prevents node reuse in incremental parsing.
2014-12-11 14:40:25 -08:00
Cyrus Najmabadi fe57f3d2e4 Support modifiers on object literal methods and accessors, and question tokens on object literal methods.
This makes parsing of these constructs the same whether they are in an object literal or a class.

This is important for incrementla parsing for knowing if we can reuse these nodes if we run
into them.
2014-12-10 22:30:40 -08:00
Anders Hejlsberg 7bc35b3ae0 Merge branch 'master' into destructuring
Conflicts:
	src/compiler/binder.ts
	src/compiler/checker.ts
	src/compiler/emitter.ts
	src/compiler/parser.ts
	src/services/services.ts
	tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt
2014-12-09 11:26:43 -08:00
Cyrus Najmabadi cc83925f32 Also split out .PropertyDeclaration and .PropertySignature from .Property. 2014-12-08 16:37:35 -08:00
Cyrus Najmabadi c1b19d761d Remove the 'Method' syntaxkind and introduce MethodSignature and MethodDeclaration instead.
Sharing a single kind here would be bad for incremental scenarios as these two node types
are not interchangeable.

For now, i have updated nearly all code to look for both kinds.  However, it may not make sense
in all locations, and we could likely tighten up many code locations to only have to deal with
one or the other.
2014-12-08 16:16:11 -08:00
Anders Hejlsberg 459dee0e84 Merge branch 'master' into destructuring
Move downlevel vs. ES6 emit branching into individual emit functions
2014-12-08 14:42:38 -08:00
Anders Hejlsberg 05c9966180 Addressing CR feedback:
New SyntaxKind.BindingElement
Introduced new VariableLikeDeclaration and BindingElement types
Cleaned up VariableDeclaration, ParameterDeclaration, PropertyDeclaration types
Node kind of binding element is always SyntaxKind.BindingElement
Changed CheckVariableDeclaration to CheckVariableLikeDeclaration
Reorganized CheckVariableLikeDeclaration
2014-12-06 13:53:06 -08:00
jbondc ab51f3069a Missing reference for getModuleInstanceState() 2014-12-05 07:18:23 -05:00
Anders Hejlsberg b49e2772ea Addressing CR feedback 2014-12-04 17:43:15 -08:00
Anders Hejlsberg 816abb19e4 Merge branch 'master' into destructuring
Conflicts:
	src/compiler/checker.ts
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/emitter.ts
	src/compiler/parser.ts
	src/compiler/types.ts
	src/services/navigationBar.ts
	tests/baselines/reference/assignmentLHSIsValue.errors.txt
	tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt
	tests/baselines/reference/parserErrorRecovery_ParameterList2.errors.txt
2014-12-03 16:43:01 -08:00
Cyrus Najmabadi 22d7aed980 CR feedback. 2014-12-03 15:27:14 -08:00
Cyrus Najmabadi d5ef6226da Emit FunctionPropertyAssignments in their native form when emitting in ES6 mode. 2014-12-03 02:09:15 -08:00
Cyrus Najmabadi 0900005438 Don't rewrite function property assignments in the AST. 2014-12-03 01:46:04 -08:00
Cyrus Najmabadi ed81cad39a Remove the 'FunctionBlock' ast kind.
We don't want different AST forms for identical syntactic constructs ('Block' and 'FunctionBock').
This prevents reuse in incremental scenarios and forces the incremental parser to know when to
change between the two.
2014-12-02 22:52:21 -08:00
Cyrus Najmabadi a8badd921e Update the name of 'PropertyAssignment' to 'LonghandPropertyAssignment'.
'PropertyAssignment' is now the name of the super interface brand we use for all thigns that can
be members of an object literal.
2014-12-02 22:01:52 -08:00
Cyrus Najmabadi 5a7500ca5e Add a dedicated 'EndOfFile' token to a SourceFile.
This is important for incremental parsing, as it is where we can attach parse errors at the end of
the file to.  Also, it helps with things like emitting comments at the end of the file.
2014-12-02 16:09:41 -08:00
Anders Hejlsberg 0731a28978 Support exported destructuring variable declarations
Support .d.ts generation for functions with destructuring parameters
2014-12-02 15:52:29 -08:00
Yui T 1f6192578e Merge branch 'master' into refactorEmitter
Conflicts:
	src/compiler/emitter.ts
	src/compiler/parser.ts
	src/compiler/types.ts
2014-12-02 14:55:30 -08:00
Yui T ff3d64f83c Address codereview 2014-12-02 14:41:54 -08:00
Mohamed Hegazy cf1f6406bb Merge pull request #1332 from Microsoft/getEmitOutputCleanup
Ensure getEmitOutput only check the file requested
2014-12-02 13:21:13 -08:00
Anders Hejlsberg 7994e9013c Emit for destructuring parameter declarations 2014-12-02 12:51:44 -08:00
Anders Hejlsberg 9e639113f8 Emit for destructuring assignments 2014-12-02 11:39:04 -08:00
Cyrus Najmabadi 03a2d0197b Make 'CatchClause' have-a block, instead of be-a block. 2014-12-01 23:21:27 -08:00
Mohamed Hegazy 08165c0b17 Ensure getEmitOutput only check the file requested 2014-12-01 23:15:13 -08:00
Cyrus Najmabadi 44627f859f Simplify parsing code. 2014-12-01 22:50:03 -08:00
Cyrus Najmabadi db89584a86 Put semantically relevant tokens in the tree. 2014-12-01 22:03:41 -08:00
Cyrus Najmabadi f8a4fb0a15 Put semantically relevant tokens in the tree. 2014-12-01 19:19:50 -08:00
Cyrus Najmabadi a29862eea5 Provide greater type safety in the ast system. 2014-12-01 18:49:57 -08:00
Cyrus Najmabadi f8f314868b Merge branch 'master' into lessDirectCallsToError
Conflicts:
	src/compiler/checker.ts
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
2014-12-01 17:42:59 -08:00
Cyrus Najmabadi cc1da37e72 Use a single member to represent a module reference. 2014-12-01 13:24:33 -08:00
Yui T 7ec49fd80e Merge branch 'master' into binaryIntegerLiteral
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/emitter.ts
	tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt
2014-12-01 11:22:37 -08:00
Cyrus Najmabadi ada6cebef3 Don't parse nodes, only to not include them in the tree. This will break incremental parsing scenarios.
Properly store the data for an external module reference in the AST.
2014-12-01 03:00:27 -08:00
Cyrus Najmabadi 7cc65ca73e Simplify the emitter. 2014-11-30 21:22:23 -08:00
Cyrus Najmabadi aed8404b7d Simplify emitter. 2014-11-30 21:18:31 -08:00
Cyrus Najmabadi 16e28156e5 Support arbitrary numbers of implements and extends clauses (with arbitrary numbers of types) for classes and interfaces.
This vastly improves our error tolerance and messages for when the user writes an illegal heritage clause sequence.
2014-11-30 15:38:45 -08:00
Cyrus Najmabadi 5f15355372 Use brands for Class Elements. 2014-11-30 14:28:32 -08:00
Cyrus Najmabadi 0cdc824079 Provide brands for Declarations. 2014-11-30 14:21:34 -08:00
Cyrus Najmabadi 54bd524c90 Provide brands for statements.
Introduce a ModuleElement type to provide more clear typesafety.
2014-11-30 14:06:15 -08:00
Cyrus Najmabadi 5f00c7cdbc Change the names for property access and qualified names to match their types. 2014-11-29 17:25:52 -08:00
Cyrus Najmabadi 8989f1a782 Add greater typesafety in the expression portion of the syntax system.
Note: this change reveals that there is definitely some wonkyness going on
with nodes like FunctionLikeDeclaration.
2014-11-29 16:48:28 -08:00
Cyrus Najmabadi e4b543981c Updating syntax kind names. 2014-11-29 15:58:55 -08:00
Cyrus Najmabadi 1d61ac5d5f Renaming syntax elements. 2014-11-29 15:52:46 -08:00
Cyrus Najmabadi e1011aa2f0 Rename syntax properties to match Roslyn/Fidelity naming. 2014-11-29 15:47:02 -08:00