Commit Graph
1648 Commits
Author SHA1 Message Date
Aziz Khambati 24759b81e6 Fix comments after sread expression, spread assignment (#28482) 2018-11-14 14:20:07 -08:00
Wesley Wigham 7d4e0e6297 Fix duplicated amd module comments in declaration bundle (#28451) 2018-11-09 17:18:34 -08:00
Ron Buckton 151dc074a8 Merge branch 'master' into sourceMapGenerator 2018-11-09 11:50:51 -08:00
Caleb Sander 28e9ec497c Address review comments 2018-11-05 11:36:32 -08:00
Nathan Shively-Sanders fe2a33fcbc Merge existing JSDoc comments (#27978)
* Correct indentation, using correct (I hope) indentation code

Note that part of the code, in formatting.ts, is cloned but should be
extracted to a function instead.

* Remove some possibly-superfluous code

But I see 4 failures with whitespace, so perhaps not.

* Restrict indentation change to avoid breaking baselines

The indentation code is very complex so I'm just going to avoid breaking
our single-line tests for now, plus add a simple jsdoc test to show that
multiline jsdoc indentation isn't destroyed in the common case.

* Switched over to construction for @return/@type

Still doesn't merge correctly though

* Add @return tags to emitter

* Merge multiple jsdocs

(not for @param yet)

* Merge multiple jsdoc for parameters too

* Emit more jsdoc tags

Not all of them; I got cold feet since I'll have to write tests for
them. I'll do that tomorrow.

* Many fixes to JSDoc emit

And single tests (at least) for all tags

* Cleanup in textChanges.ts

* Cleanup in formatting.ts

(Plus a little more in textChanges.ts)

* Cleanup in inferFromUsage.ts

* Fix minor omissions

* Separate merged top-level JSDoc comments with \n

instead of space.

* Don't delete intrusive non-jsdoc comments

* Cleanup from PR comments

1. Refactor emit code into smaller functions.
2. Preceding-whitespace utility is slightly easier to use.
3. Better casts and types in inferFromUsage make it easier to read.

* Fix bogus newline

* Use @andy-ms' cleanup annotateJSDocParameters
2018-10-24 16:14:52 -07:00
Sheetal Nandi 2787a2793a Skip writing json file if it is going to overwrite same location
Fixes #24715
2018-10-11 11:12:44 -07:00
Sheetal Nandi 0d91838593 Do not generate jsFile path if its emitOnlyDeclarations is set
Fixes #27009
2018-10-11 10:14:59 -07:00
Ron Buckton 4982803a38 Merge branch 'master' into sourceMapGenerator 2018-10-08 18:01:37 -07:00
Andy e710645bf9 Never escape string literals from textChanges (#26971)
* Never escape string literals from textChanges

* Use `boolean | undefined`
2018-09-17 11:06:39 -07:00
Nathan Shively-Sanders 64d0e0d448 Shorten more internal names to JS or TS (#27080) 2018-09-13 15:05:57 -07:00
Daniel Rosenwasser ea7ff15307 makeFileLevelOptmiisticUniqueName -> makeFileLevelOptimisticUniqueName 2018-09-12 17:51:57 -07:00
Nathan Shively-Sanders 6bd1da20c9 Rename JS-specific concepts (#26795)
* Rename JS concepts

1. Assignment declaration -- an assignment that is treated like a
declaration. Previously called [JS] special (assignment|declaration),
among other things.
2. Expando -- a value that can be used as a target in assignment
declarations. Currently, a class, function or empty object literal.
Functions are allowed in Typescript, too. Previously called a JS
container, JS initializer or expando object.
3. JavaScript -> Javascript. This is annoying to type, and looks like
'Java Script' in a camelCase world.

Everything is a pure rename as far as I know. The only test change is
the API baselines, which reflect the rename from SymbolFlags.JSContainer
to SymbolFlags.Assignment.

* Remove TODO

* Rename Javascript->JS

Note that this introduces a variable name collision in a couple of
places, which I resolved like this:

```ts
const isInJavascript = isInJSFile(node);
```
2018-09-12 10:44:46 -07:00
Klaus Meinhardt 66a401ae64 Fix FunctionType emit when only parameter has no type
Fixes: #27018
2018-09-11 09:39:11 +02:00
Ron Buckton bca3b680f6 Clean up emit pipeline to reduce callback overhead 2018-09-07 16:43:49 -07:00
Ron Buckton b006287cb1 Refactor and clean up sourcemap decoder 2018-09-04 17:50:06 -07:00
Sheetal Nandi e41dbcdccd Support json module emit when module emit is commonjs, amd, es2015 or esnext
Fixes #25755 and #26020
2018-08-31 14:05:14 -07:00
Ron Buckton 173b5dfcfb Refactor sourcemap emitter 2018-08-22 12:42:36 -07:00
Ron Buckton 1de8cd3f62 Emit lib reference directives in declaration output 2018-08-20 16:54:51 -07:00
Sheetal Nandi 924228b45b Merge branch 'master' into errorInFileWithDeepImport 2018-08-01 15:36:52 -07:00
Sheetal Nandi f7bc8e18e8 No need for method to get the exportedModulesFromDeclarationEmit 2018-08-01 12:20:54 -07:00
Andy 93722c8942 findAllReferences/rename: Search in all open projects (#25648)
* findAllReferences/rename: Search in all open projects

* Avoid needing a dummy location when location is unused

* Remove Program#getDeclarationEmitPath

* Only iterate over enabled projects
2018-07-20 16:53:59 -07:00
Sheetal Nandi 0774fdc61d Expose visible to outside import declarations and dynamic imports through emitDts output 2018-07-11 15:30:23 -07:00
Ryan Cavanaugh 1b1ffe952b Use getEmitDeclarations instead of .declarations 2018-07-09 14:51:40 -07:00
Andy c5bd0405c4 JsxTagNameExpression can only be Identifier | ThisExpression, not any PrimaryExpression (#21555)
* JsxTagNameExpression can only be Identifier | ThisExpression, not any PrimaryExpression

* Use a type similar to PropertyAccessEntityNameExpression

* Fix lint errors
2018-06-29 16:50:44 -07:00
Andy 48d31eddc8 Split isConst into isVarConst and isEnumConst (#25312) 2018-06-29 16:47:11 -07:00
Wesley Wigham fc37b7926d Stop not emitting mappings for function and class names (#25210) 2018-06-26 15:05:34 -07:00
Anders Hejlsberg b0d8c6551e Merge branch 'master' into restTuples
# Conflicts:
#	src/compiler/checker.ts
2018-06-22 06:10:50 -10:00
Sheetal Nandi f506b28e95 Mark the declarations visible correctly when emit is disabled but asked to emit declarations for watch mode
Fixes #25068
2018-06-20 12:28:50 -07:00
Anders Hejlsberg f1efd1d043 Parsing and rudimentary checking of tuples with rest elements 2018-06-15 11:43:16 -07:00
Anders Hejlsberg 39099a07e7 Merge branch 'master' into restTuples
# Conflicts:
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2018-06-12 06:36:55 -07:00
Anders Hejlsberg 2e04322a6d Optional elements in tuple types + empty tuple types + other fixes. 2018-06-09 12:19:11 -07:00
Ryan Cavanaugh cf87bd446d Merge branch 'master' into tsbuild 2018-06-05 14:55:51 -07:00
Sheetal Nandi d246c3c2bd Disable source maps and declaration emit for the json module
Fixes #24546
2018-06-01 18:31:58 -07:00
Sheetal Nandi 1696da14f2 Do not emit trailing comma in json module
Fixes #24530
2018-05-31 12:40:08 -07:00
Wesley Wigham eb1973a4fd Fixup sourcemap positions and text writer calculations 2018-05-30 19:29:47 -07:00
Andy e53e56cf82 Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Wesley Wigham 6149b41469 Generate names for type parameter declarations in inferred types (#23902)
* Generate names for type parameter declarations in inferred types

* Fix lint

* Merge functions, make overload private

* Handle some edge cases better (nodes in differing files than current emit)

* Account for transformed nodes
2018-05-10 11:16:27 -07:00
Wesley Wigham 8ab5be9a86 Add hook for adding transforms into the declaration emit pipeline after the main one (#23946)
* Add hook for adding transforms into the declaration emit pipeline after the main one

* Fix lint
2018-05-08 11:20:48 -07:00
Ryan Cavanaugh ffa0ccba2a Project References Core support 2018-05-07 15:12:50 -07:00
Sheetal Nandi 5133c70e7e Merge pull request #22167 from Microsoft/requireJson
Resolve the modue names with "modulename.json" to json files when doing node module resolution
2018-05-04 12:42:10 -07:00
Ron Buckton de10e82e8a Add assertion message 2018-05-03 16:27:15 -07:00
Ron Buckton a7074e2054 Minor changes to reduce stack depth during emit 2018-05-03 16:04:52 -07:00
Sheetal Nandi 15f9ea3d14 Merge branch 'master' into requireJson 2018-05-03 15:35:54 -07:00
Ron Buckton 56648ad0f1 Merge pull request #20763 from Microsoft/vfs
Update harness to use single robust virtual file system for tests.
2018-05-03 10:25:20 -07:00
Ron Buckton ab8c3fa3ac Pre-generate names ahead of time 2018-05-02 13:34:14 -07:00
Sheetal Nandi 579748bc2b Merge branch 'master' into requireJson 2018-04-30 11:44:09 -07:00
Ron Buckton 4863d55d01 Merge branch 'master' into vfs 2018-04-27 14:03:42 -07:00
Andy 9b05bd5cd7 Remove unnecessary check for ElementAccessExpression#argumentExpression being defined (#23685) 2018-04-25 13:30:34 -07:00
Ron Buckton 370107ed7b Merge branch 'master' into vfs 2018-04-19 16:55:35 -07:00
Ron Buckton 1cbe930e06 Merge branch 'master' into vfs 2018-04-17 14:39:20 -07:00