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

Resolve global variables #48

Closed
kornilova203 opened this issue Feb 28, 2019 · 1 comment
Closed

Resolve global variables #48

kornilova203 opened this issue Feb 28, 2019 · 1 comment
Milestone

Comments

@kornilova203
Copy link
Owner

kornilova203 commented Feb 28, 2019

Example:
Usage of a on second line should be resolved to the definition global a

global a;
a = 1;

To support actions for global variables such as 'go to declaration' or 'find usages' we need to modify resolve.
There is big article about resolve in IntelliJ IDEs: References and Resolve.

Usually we only need to add mixin for a declaration rule in bnf grammar e.g. mixin for class_declaration

After adding mixin the MatlabResolvingScopeProcessor will check these declarations during resolve process.

But there is a problem with global variables: one statement may declare multiple variables.
So we need to:

  1. wrap each IDENTIFIER from global_variable_declarations rule in new global_variable_declaration rule
  2. add MatlabDeclarationBase mixin to global_variable_declaration (similar to class_declaration)
  3. add MatlabBlockMixin mixin to global_variable_declarations (it will pass resolve processor to each variable declaration)
  4. write resolve tests (see ResolveTest)

Note: you don't need to resolve references from different files. It's a separate issue #24

@kornilova203
Copy link
Owner Author

Fixed by #65

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

No branches or pull requests

1 participant