TypeScript/tests/cases/fourslash/navigationBarFunctionPrototype4.ts
Andrew Branch f89de95955
Allow special element access assignments to create declarations (#33537)
* Start enabling element access special assignment

* Treat element access assignment as special assignment in JS

* Make declarations for bindable element access expressions

* Fix navigationBar crash

* Add multi-level test for JS

* Propagate element access expressions to more code paths

* Fix property access on `this`

* Add quick info test

* Uhhh I guess this is fine

* Fix module["exports"] and property access chained off element access

* Add test for this property assignment

* Add test for and fix prototype property assignment

* Fix teeeest???

* Update APIs

* Fix element access declarations on `this`

* Fix go-to-definition

* Add declaration emit to tests

* Reconcile with late-bound symbol element access assignment

* Fix baselines

* Add JS declaration back to tests

* Fix JS declaration emit of non-late-bound string literal property names

* Revert accidental auto-format

* Use `isAccessExpression`

* Add underscore escaping member to test

* Fix and test navBar changes
2019-09-30 15:08:44 -05:00

81 lines
1.6 KiB
TypeScript

/// <reference path="fourslash.ts"/>
// @Filename: foo.js
////var A;
////A.prototype = { };
////A.prototype = { m() {} };
////A.prototype.a = function() { };
////A.b = function() { };
////
////var B;
////B["prototype"] = { };
////B["prototype"] = { m() {} };
////B["prototype"]["a"] = function() { };
////B["b"] = function() { };
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [{ name: "A", quoted: false }, { name: "B", quoted: true }].map(({ name, quoted }) => (
{
"text": name,
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "m",
"kind": "method"
},
{
"text": quoted ? `"a"` : "a",
"kind": "function"
},
{
"text": quoted ? `"b"` : "b",
"kind": "function"
}
]
}
))
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": ["A", "B"].map(name => (
{
"text": name,
"kind": "class"
}
))
},
...[{ name: "A", quoted: false }, { name: "B", quoted: true }].map(({ name, quoted }) => ({
"text": name,
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "m",
"kind": "method"
},
{
"text": quoted ? `"a"` : "a",
"kind": "function"
},
{
"text": quoted ? `"b"` : "b",
"kind": "function"
}
],
"indent": 1
}))
]);