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

Properly add members to class rather than declaring variables #1421

Closed
wants to merge 12 commits into from

Conversation

@MikhailArkhipov
Copy link
Member

commented Aug 8, 2019

Fixes #1231

Root cause is that class evaluator was declaring members as variables and then collected variables into members. Changes:

  • introduce callback action that can decide if it wants to declare variable or add a class member.
  • class variables type is added so completion can tell what to show depending on context
  • class variables in class scope can be accesses without self while in method scopes and other places require self. Thus they are declared as both variables and members.

MikhailArkhipov added some commits Aug 8, 2019

@MikhailArkhipov MikhailArkhipov changed the title [WIP]: Properly add members to class rather than declaring variables Properly add members to class rather than declaring variables Aug 9, 2019

private static IReadOnlyList<IVariable> CollectVisibleVariables(IScope currentScope) {
var variables = new List<IVariable>();
foreach (var s in currentScope.EnumerateTowardsGlobal) {
variables.AddRange(s.Variables.Where(v => v.Source != VariableSource.ClassMember || s == currentScope));

This comment has been minimized.

Copy link
@jakebailey

jakebailey Aug 9, 2019

Member

Is there a check like this in the analysis? Filters in the completion code tend to hide behaviors of the analysis (like allowing access to something that doesn't exist), but if there's equivalent code there then it's probably not a big deal...

@MikhailArkhipov MikhailArkhipov deleted the MikhailArkhipov:1231 branch Aug 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.