1356 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
40ae42221e Better JSDoc generic errors and faster isInJSDoc 2017-07-14 11:07:20 -07:00
Nathan Shively-Sanders
6e861fd3e6 Remove JSDocConstructor/ThisType and just use named parameters 2017-07-14 09:36:12 -07:00
Nathan Shively-Sanders
bc69c7e6d1 Parse JSDoc types using the normal TS parser
This means that JSDoc types can include the full range of Typescript
types now. It also means that Typescript annotations can include JSDoc
types. This is disallowed with a new error, however. But Typescript can
still give the correct types to JSDoc that shows up in .ts files by
mistake. This can easily happen, for example with types like

```ts
var x: number? = null;
var y: ?string = null;
var z: function(string,string): string = (s,t) => s + t;

// less likely to show up, but still understood.
var ka: ? = 1;
```

In the future, I will add a quick fix to convert these into the correct
types.

Fixes #16550
2017-07-13 11:27:50 -07:00
Nathan Shively-Sanders
1b1f257dbf Rename SignatureFlags enum and improve its usage
As requested in the PR comments
2017-07-11 14:49:47 -07:00
Nathan Shively-Sanders
8856ddfd15 Make enum private and fix fillSignature predicate 2017-07-11 10:45:25 -07:00
Nathan Shively-Sanders
b6ad43d4a5 Better error for wrong return (: vs =>) in types
It's very ambiguous in expression position, so impossible to give a
better message from the parser. For example:

let f = (x: number) => number => x + 1;
                    ~~
                    Should be ':'

But the parser doesn't know that 'number' isn't an expression now.
2017-07-11 10:08:42 -07:00
Nathan Shively-Sanders
fcc9823ac7 Switch fillSignature boolean params to single enum 2017-07-11 09:51:18 -07:00
Anders Hejlsberg
b866cd4969 Merge pull request #16952 from Microsoft/optimizeForEachChild
Optimize forEachChild function
2017-07-07 16:18:00 -10:00
Wesley Wigham
4e6b2f3c93 Created a branded type for identifier-escaped strings (#16915)
* Created a branded type for escaped strings

Then flowed it throughout the compiler, finding and fixing a handful of
bugs relating to underscore-prefixed identifiers in the process.
Includes a test for two cases noticed - diagnostics from conflicting
symbols from export *'s, and enum with underscore prefixed member emit.

* Correctly double underscores WRT mapped types

* Add fourslash tests for other fixed issues

* use function call over cast

* Update forEachEntry type accuracy

* Just use escaped names for ActiveLabel

* Remove casts from getPropertyNameForPropertyNameNode

* This pattern has occurred a few times, could use a helper function.

* Remove duplicated helper

* Remove unneeded check, use helper

* Identifiers list is no longer escaped strings

* Extract repeated string-getting code into helper

* Rename type and associated functions

* Make getName() return UnderscoreEscapedString, add getUnescapedName()

* Add list of internal symbol names to escaped string type to cut back on casting

* Remove outdated comments

* Reassign interned values to nodes, just in case

* Swap to string enum

* Add deprecated aliases to escapeIdentifier and unescapeIdentifier

* Add temp var

* Remove unsafe casts

* Rename escaped string type as per @sandersn's suggestion, fix string enum usages

* Reorganize double underscore tests

* Remove jfreeman from TODO

* Remove unneeded parenthesis
2017-07-06 14:45:50 -07:00
Anders Hejlsberg
24a6a087f5 Add early bail out for token nodes 2017-06-23 08:31:48 -10:00
Anders Hejlsberg
fd1e5ab6ed Simplify forEachChild 2017-06-22 08:55:18 -10:00
Yui
47c1563649 Merge pull request #16544 from Microsoft/master-fixIncrementalParsingWithDynamicImport
[Master] wip - fix incremental parsing with dynamic import
2017-06-19 16:44:47 -07:00
Sheetal Nandi
09f0b3471a Merge branch 'master' into ownJsonParsing 2017-06-15 09:59:37 -07:00
Daniel Rosenwasser
5b12a04965 Merge pull request #16213 from charlespierce/await_yield_literals
Update special cases for await / yield expression parsing
2017-06-15 00:39:57 -07:00
Yui T
1636fbc966 Wip-fix incremental parsing 2017-06-14 17:13:35 -07:00
TravCav
9611e58670 combined logic in parseParameterOrPropertyTag (#16481) 2017-06-13 16:30:36 -07:00
Nathan Shively-Sanders
6d3e15f0ee Add JSDoc to EOF token to catch missed @typedefs 2017-06-13 10:32:25 -07:00
Andy
fbcddb61e2 Don't bind JSDoc namespace in a TS file (#16416) 2017-06-12 14:35:35 -07:00
Andy
09321b3834 Convert Extension to a string enum (#16425) 2017-06-09 19:32:44 -07:00
Daniel Rosenwasser
025fa87b8c Merge pull request #16382 from Microsoft/ContainsMaster
[Master] Rename & internalize PossiblyContainsDynamicImport
2017-06-08 23:57:01 -07:00
Andy
0d36d0e39f Support completions for qualified names in JSDoc (#16380)
* Support completions for qualified names in JSDoc

* Fix typo
2017-06-08 17:21:36 -07:00
Daniel Rosenwasser
86e54ac787 Correct pluralization of 'Contain' to 'Contains', made the nodeflag internal. 2017-06-08 16:00:38 -07:00
Kanchalai Tanglertsampan
58aa0f3f76 Copy PossiblyContainDynamicImport from old source file to new one 2017-06-08 14:30:56 -07:00
Andy
abb9681248 Support completions for JSDoc @param tag names (#16299)
* Support completions for JSDoc @param tag names

* Undo change to finishNode

* Don't include trailing whitespace in @param range; instead, specialize getJsDocTagAtPosition
2017-06-07 12:28:52 -07:00
Ron Buckton
8cb5333791 Verify JS function is constructor 2017-06-06 13:33:19 -07:00
Sheetal Nandi
48189c883f Merge branch 'master' into ownJsonParsing 2017-06-06 11:03:21 -07:00
Yui T
fe4fec5220 Fix breaking tests 2017-06-05 17:23:33 -07:00
Yui T
b9017795a0 Revert "Revert "[Master] wip-dynamic import" (#16264)"
This reverts commit ccc60c8b3b75476c4b11abb6ab4d2e6f06214f8f.
2017-06-05 17:16:29 -07:00
Sheetal Nandi
c4ad151a46 Merge branch 'master' into ownJsonParsing 2017-06-05 17:01:09 -07:00
Mohamed Hegazy
ccc60c8b3b Revert "[Master] wip-dynamic import" (#16264) 2017-06-05 10:49:20 -07:00
Sheetal Nandi
d680720f6d Merge branch 'master' into ownJsonParsing 2017-06-05 10:28:23 -07:00
Yui T
2f476bf22f Merge branch 'master' into master-dynamicImport 2017-06-02 09:10:20 -07:00
Yui T
e6d7327c3f Address PR: error message, fix capitalization, only allow functionLikeDeclaration and ImportCall for create Promise, use fall through comment 2017-06-01 23:21:59 -07:00
Charles Pierce
556e268bd0 #15943 #15981 Update special cases for await / yield parsing 2017-06-01 20:37:52 -07:00
Sheetal Nandi
8f4f6c565e Merge branch 'master' into ownJsonParsing 2017-06-01 10:43:41 -07:00
Nathan Shively-Sanders
928da675ac Merge pull request #16156 from Microsoft/report-jsdoc-syntax-errors
Report JSDoc syntax errors
2017-05-31 16:21:32 -07:00
Nathan Shively-Sanders
2dd6627022 Report jsdoc syntax errors when checkJs is on 2017-05-30 13:32:46 -07:00
Sheetal Nandi
8d771ca044 Merge branch 'master' into ownJsonParsing 2017-05-30 13:03:23 -07:00
Kanchalai Tanglertsampan
27078f995e Merge branch 'master' into master-fix16092 2017-05-30 08:25:53 -07:00
Yui
f938caf8c8 Merge pull request #16134 from Microsoft/master-fix15250
[Master] Fix 15250 - treat "object" and "Object" the same in JSDoc type def
2017-05-30 08:07:39 -07:00
Yui T
10eae61aca Handle "object" as "Object" in JSDoc type expression 2017-05-29 21:47:39 -07:00
Yui T
4838eff2d7 "function" without followed by "(" should be considered as Global function type 2017-05-29 20:37:01 -07:00
Yui T
fe838bab2d Parse ts-style property tag 2017-05-27 19:10:53 -07:00
Yui T
9c102461d9 Rename parameterName to name 2017-05-26 19:08:08 -07:00
Yui T
d68038ad28 Support bracket for optional property 2017-05-25 22:34:48 -07:00
Sheetal Nandi
f1ea38d127 Merge branch 'master' into ownJsonParsing 2017-05-24 12:46:29 -07:00
Kanchalai Tanglertsampan
faab927c8d Merge branch 'master' into master-dynamicImport
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/emitter.ts
#	src/compiler/parser.ts
#	src/compiler/transformers/module/module.ts
#	src/compiler/transformers/module/system.ts
2017-05-24 11:26:06 -07:00
Mohamed Hegazy
5ef6192c20 Allow export default interface. Related to issue 3792. (#16040)
* Allow export default interface. Related to issue 3792.

* Update exportDefaultAbstractClass test

* Allow default export to be a non-value for lookup purposes

* Add local usage to exportDefaultInterface test
2017-05-23 13:40:03 -07:00
Klaus Meinhardt
f8aae89157 Update more return types to include undefined (#15903)
* Update more return types

* Update types of forEachChild callbacks

* fix line endings
2017-05-23 09:54:02 -07:00
Andy Hanson
dc40f5d6b9 Merge branch 'master' into jsdoc 2017-05-17 07:17:32 -07:00