Skip to content

Fix exception and warning for global variables #2321

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

Merged
merged 2 commits into from
Mar 27, 2019
Merged

Fix exception and warning for global variables #2321

merged 2 commits into from
Mar 27, 2019

Conversation

Conduitry
Copy link
Member

Fixes #2295. An exception and a warning about global variables were not raised when the variable was also referenced in the script. A couple of checks for presence in var_lookup have also been augmented to check whether the variable has global equal to true.

@codecov-io
Copy link

codecov-io commented Mar 26, 2019

Codecov Report

Merging #2321 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2321   +/-   ##
=======================================
  Coverage   91.83%   91.83%           
=======================================
  Files           1        1           
  Lines          49       49           
=======================================
  Hits           45       45           
  Misses          4        4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d637211...ecd7c6e. Read the comment docs.

@Conduitry
Copy link
Member Author

I'm actually not positive that the change in the second commit is something that we really want. If someone refers to a global foo in their <script>, do we really want to warn them about a {foo} reference in their template? They'd presumably already be getting warned about foo from their linter.

The first change I am sure we want to have, because we have no way to bind to a global like that.

@Rich-Harris
Copy link
Member

I think we do want the warning, yeah — there are situations where there'll be no linter (e.g. in the REPL), and in any case linter warnings and compiler warnings happen in different phases so I don't think it'd be annoying

@Rich-Harris Rich-Harris merged commit a59cd36 into master Mar 27, 2019
@Rich-Harris Rich-Harris deleted the gh-2295 branch March 27, 2019 12:21
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.

3 participants