Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate document outline with all symbols, not just top level #4624

Merged
merged 7 commits into from
Aug 10, 2018
Merged

Populate document outline with all symbols, not just top level #4624

merged 7 commits into from
Aug 10, 2018

Conversation

MikhailArkhipov
Copy link

var res = analysis.GetAllAvailableMembersFromScope(scope, opts).Concat(GetChildScopesVariables(analysis, scope, opts));
foreach (var m in res) {
yield return m;
}
Copy link
Member

Choose a reason for hiding this comment

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

return res?

foreach (var childScope in scope.Children) {
var res = GetScopeVariables(analysis, childScope, opts);
foreach (var m in res) {
yield return m;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

return scope.Children.SelectMany(c => GetScopeVariables(analysis, c, opts))?

Copy link
Author

Choose a reason for hiding this comment

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

Yep :-)

kvp.Key,
null,
kvp.Value.Definitions.Select(e => e.GetLocationInfo())
));
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this if there have been variables added? Or do we need it if the value has no definitions?

Copy link
Author

Choose a reason for hiding this comment

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

It was existing code that applied to a single scope and now called for each scope recursively.

@@ -133,6 +133,6 @@ class BuiltinNamespace<MemberContainerType> : AnalysisValue where MemberContaine
return false;
}

public override int GetHashCode() => new { hc1 = GetType().GetHashCode(), hc2 = _type.GetHashCode() }.GetHashCode();
public override int GetHashCode() => new { hc1 = GetType()?.GetHashCode() ?? 0, hc2 = _type?.GetHashCode() ?? 0 }.GetHashCode();
Copy link
Member

Choose a reason for hiding this comment

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

Think I just saw a slightly different fix in another PR, but now I look at it, we shouldn't have to call GetHashCode() on the members here. The anonymous type GetHashCode will do it (and handle nulls properly)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, will merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants