Ryan Cavanaugh
8294259ec2
Remove all reference comments from compiler/
2018-04-11 15:38:26 -07:00
TravCav
42d226ca42
isDefaultExport is always false here.
2018-04-05 10:38:51 -04:00
Wesley Wigham
9b987eb947
Dont bind a local symbol for a default export without a name ( #23152 )
2018-04-04 15:26:10 -07:00
Nathan Shively-Sanders
d3e0929b14
Mark js-assignment functions' symbols as methods ( #23078 )
...
This make display more accurate:
1. The functions now print as methods
2. When the type of the function references the class, the type of the
function itself is now printed correctly instead of as `any`.
2018-04-02 12:17:35 -07:00
Nathan Shively-Sanders
6d9a8250bd
Improve binding and jsdoc of chained special js assignments ( #23038 )
...
* Search for jsdoc on chained assignments
* Fix binding of chained binary expression js-assignments
* Test:chained jsdoc+chained prototype assignment
* Improve naming
2018-04-02 09:47:01 -07:00
Nathan Shively-Sanders
61aad4c7b8
Handle toplevel this-assignment ( #22913 )
...
Do nothing now. Someday we might handle it correctly.
2018-03-27 12:24:37 -07:00
Wesley Wigham
7721cc45c8
Improve assertion violation message ( #22522 )
2018-03-22 11:46:52 -07:00
Nathan Shively-Sanders
4462c159b1
Correctly track thisContainer for this-property-assignments in JS nested containers ( #22779 )
...
* Track thisContainer for this-property-assignments in JS
Previously it would update on every block, not just those that could
bind `this`.
In addition, if the constructor symbol still can't be found, then no
binding happens. This is usually OK because people don't add new
properties in methods too often.
* Update additional baselines
* Add lib:dom to new test
* Address PR comments
* Correct new name for saveThisParentContainer
2018-03-22 09:54:43 -07:00
Nathan Shively-Sanders
de4a69cb72
In source files and blocks, bind function declarations before other statements ( #22766 )
...
* Add test case and temporarily disable inference
(Inference of class members from this-assignments inside a
prototype-assigned function.)
* Update baselines
* In blocks and source files, bind functions first
* Add tests from other bugs
* Remove temporary failsafe
* Update tests to restore intent and clean up errors
* Restore intent even better
* Restore intent even better x2
* Add missed baselines
2018-03-21 14:22:09 -07:00
Anders Hejlsberg
9083f6cf18
Revise binder logic to correctly find 'infer T' containers
2018-03-21 13:23:58 -07:00
Andy
28ff6b6ef3
Store import nodes in SourceFile.imports instead of StringLiteral nodes ( #22495 )
...
* Store import nodes in SourceFile.imports instead of StringLiteral nodes
* Change SourceFile#imports storage back
* Code review
* StringLiteral -> StringLiteralLike
2018-03-16 14:01:00 -07:00
Andy
99d5058568
Add 'isPrototypeAccess' helper ( #22648 )
...
* Add 'isPrototypeAccess' helper
* Fix type error
2018-03-16 13:27:47 -07:00
Andy
b9f60566d0
For f.prototype.m = function() { this.x = 0; } make x a member of f, not of the function expression ( #22643 )
2018-03-16 11:35:51 -07:00
Nathan Shively-Sanders
f8134d0b45
Merge branch 'master' into js-object-literal-assignments-as-declarations
2018-03-08 10:40:55 -08:00
Andy
55bffba5fd
Use getTextOfNode over getTextOfNodeFromSourceText(getSourceFileOfNode(node)) ( #22387 )
2018-03-08 07:52:35 -08:00
Andy
2676786e7f
Add 'isNamedDeclaration' helper to reduce casts ( #22089 )
...
* Add 'isNamedDeclaration' helper to reduce casts
* Add assertion
* Remove assertion
2018-03-08 07:50:25 -08:00
Nathan Shively-Sanders
239f214b1c
Address PR comments
...
1. Add documentation
2. Better organisation of concerns in utility functions
3. Better handling of module.exports and exports in the binder's new
code.
2018-03-07 16:26:29 -08:00
Nathan Shively-Sanders
d86440f94f
Merge branch 'master' into js-object-literal-assignments-as-declarations
2018-03-07 14:51:55 -08:00
Andy
5e593acad9
Avoid cast by providing type predicate to isExternalModuleAugmentation ( #22119 )
...
* Avoid cast by providing type predicate to isExternalModuleAugmentation
* Break into isExternalModuleAugmentation and isModuleAugmentationExternal
2018-03-06 07:27:36 -08:00
Wesley Wigham
10e3b73330
Debug assert on parent rebind, mitigate circularity in symbol access checking ( #22282 )
...
* Assert that symbol parents are never rebound to different parents
* mitigate circularities in symbol accessibility checking
2018-03-01 16:49:42 -08:00
Wesley Wigham
7a31192ecb
Stop binding type predicate types twice ( #22210 )
2018-02-28 15:43:13 -08:00
Nathan Shively-Sanders
c31808922d
Remove assert for undeclared js-nested-exports
...
Previously, this would assert:
```ts
exports.undeclared.n = 1;
```
Because undeclared was never declared in any recognised way. Now it no
longer asserts, but does not bind. That's because the full pattern
starts with the line `exports = require('./x')` and assumes that x.js
declares `undeclared`. I am not sure how to bind this. The new test
contains this pattern in case I figure it out.
2018-02-27 15:04:10 -08:00
Nathan Shively-Sanders
c3143d2e47
Support js nested namespace decls on exports
...
and module.exports.
2018-02-27 10:20:16 -08:00
Nathan Shively-Sanders
aa6b76fb6f
Merge branch 'master' into js-object-literal-assignments-as-declarations
2018-02-23 09:24:32 -08:00
Nathan Shively-Sanders
dd2523650e
Fix nested js-containers+proto assignment in types space
...
1. The actual symbols needed to be marked as containers.
2. Type node resolution needed to understand prototype assignments.
2018-02-23 09:16:01 -08:00
Nathan Shively-Sanders
d55aa22d15
Code cleanup
2018-02-22 11:19:44 -08:00
Nathan Shively-Sanders
41fba6f34b
Incremental prototype+prototype assignment work
...
Had to fix nested incremental prototype detection, so I'll probably
merge this branch back into the PR branch.
2018-02-22 11:04:29 -08:00
Nathan Shively-Sanders
b14cf4ef9a
First draft of prototype assignment
...
* Still misses incremental additions to the prototype.
* Not tested with {} or class initalizers.
* Code needs a cleanup pass.
2018-02-22 09:25:42 -08:00
Andy
8a52eade2e
Make getTextOfIdentifierOrLiteral and getEscapedTextOfIdentifierOrLiteral only accept Identifier | StringLiteralLike | NumericLiteral ( #22002 )
2018-02-21 11:05:43 -08:00
Nathan Shively-Sanders
01f2ee3d1f
Set up structure of prototype assignments
...
No actual binding happens yet though
2018-02-20 16:03:54 -08:00
Nathan Shively-Sanders
116a8a8cff
Support nested prototype declarations
...
And add a test for them
2018-02-20 12:23:00 -08:00
Nathan Shively-Sanders
ad43240ff0
Merge branch 'master' into js-object-literal-assignments-as-declarations
2018-02-20 09:14:36 -08:00
Nathan Shively-Sanders
518f651656
Remove assert hit by chrome devtools+update baselines
...
Just return undefined instead. Gets rid of many errors in chrome
devtools
2018-02-20 08:48:04 -08:00
Andy
b3edc8f9f4
Apply 'no-unnecessary-type-assertion' lint rule ( #22005 )
...
* Apply 'no-unnecessary-type-assertion' lint rule
* Fix type error
* Fix tsconfig.json
* Add --format back
2018-02-16 18:38:00 -08:00
Nathan Shively-Sanders
54a89ac026
Simplify bindPropertyAssignment inner loop
2018-02-15 12:25:55 -08:00
Nathan Shively-Sanders
8f98c77217
Merge branch 'master' into js-object-literal-assignments-as-declarations
2018-02-15 10:28:25 -08:00
Nathan Shively-Sanders
0191b70d62
Further cleanup
2018-02-15 09:54:55 -08:00
Nathan Shively-Sanders
d2b933e0d6
Cleanup in binder: rename and move
2018-02-15 09:36:48 -08:00
Nathan Shively-Sanders
4fdef85608
Naming and duplication cleanup
2018-02-15 09:13:06 -08:00
Andy
8518343dc8
Add isStringLiteralLike helper ( #21953 )
2018-02-14 13:25:04 -08:00
Nathan Shively-Sanders
bad155f072
Clean up bindPropertyAssignment
...
The add-intermediate-container-symbols loop is still quite confusing,
but it's not as bad as before.
2018-02-13 16:50:53 -08:00
Nathan Shively-Sanders
76a9ac4434
Restrict declaration initializers too
2018-02-13 15:52:35 -08:00
Nathan Shively-Sanders
88c67fa777
Refactor binder and update baselines.
...
Also improve assert message in fourslash.
2018-02-13 15:44:15 -08:00
Nathan Shively-Sanders
fc08e20da8
Correctly merge JS decls
...
Turns out merging was incorrect even for non-nested declarations, but
tests didn't catch it before.
2018-02-13 14:17:46 -08:00
Adrian Leonhard
6ab5d97a5d
Changed "Duplicate Identifier" to "enum cannot be merged..." ( #18579 )
...
* Changed "Duplicate Identifier" to "enum can only be merged..."
when either declaration of the identifier is an enum.
Partial (?) fix for #529
Not sure if the new test is necessary, all the cases seem to have been covered by others tests.
* picked a nit
2018-02-12 13:38:08 -08:00
Nathan Shively-Sanders
8ac94f5dec
Support function/class in JS nested decls
...
This required fixing the predicates and the avoiding of contextual
typing loops. This is now done right, in
getContextualTypeOfBinaryExpression.
The predicates still need work.
2018-02-09 10:41:30 -08:00
Nathan Shively-Sanders
a09c2391a4
4-nested object-literal assignment works in JS
2018-02-08 16:07:22 -08:00
Nathan Shively-Sanders
b0aebb4c1e
Recursive object-literal-assignment declarations
2018-02-08 15:43:10 -08:00
Nathan Shively-Sanders
d0b08a24ec
Refactor JS static property assignment binding
...
Less polymorphism, up-to-date generalised names and documentation.
2018-02-08 11:08:41 -08:00
Nathan Shively-Sanders
9e8d59ca14
Support var x = x || {} declarations in JS
2018-02-07 11:26:30 -08:00