Skip to content

Wire getReferences to use the new compiler#473

Merged
mhegazy merged 52 commits into
masterfrom
getReferences
Aug 29, 2014
Merged

Wire getReferences to use the new compiler#473
mhegazy merged 52 commits into
masterfrom
getReferences

Conversation

@mhegazy
Copy link
Copy Markdown
Contributor

@mhegazy mhegazy commented Aug 18, 2014

A few notes:

  • The new implementation include values with a contextual type we are searching for e.g.
interface IFoo {
    member: number;
}

var x : IFoo;

x = {member: 1}; 
x = {member: 2}; // search for member should get you IFoo.member, member:1, and mebmer:2
  • The new implementation should handle string and number named declaration properly, which we did not handle before. e.g.
var x = { "foo" : 0 };
x["foo"] = 1;
x.foo = 2;  // should see all instances of "foo"
  • Another difference is now we have one symbol for all merged symbols, to overcome this, we identify a "meaning" for each location; the "meaning" is a syntactic classification of the location as namespace, value or type access. we now include references that intersect with the original search location. some special handling is needed for constructs that straddle multiple spaces like classes and enums.
  • getScope is meant as an optimization to limit the search scope if possible (e.g. local variables and parameters), i will add this later

Comment thread src/harness/fourslash.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts.forEach(fileNames, Harness.IO.log) ?
Shorter NOT more readable I think but I saw you guys do this on more places if I recall correctly.

mhegazy and others added 26 commits August 22, 2014 22:07
Conflicts:
	src/services/services.ts
Get occurrences for switch/case/default/break keywords.
Conflicts:
	tests/baselines/reference/aliasUsageInGenericFunction.types
	tests/baselines/reference/aliasUsageInObjectLiteral.types
	tests/baselines/reference/aliasUsageInOrExpression.types
	tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types
mhegazy added a commit that referenced this pull request Aug 29, 2014
Wire getReferences to use the new compiler
@mhegazy mhegazy merged commit 655039c into master Aug 29, 2014
@DanielRosenwasser DanielRosenwasser deleted the getReferences branch October 23, 2014 20:54
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants