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

Fix the initialization order in the interpreter #958

Merged
merged 5 commits into from
May 31, 2021

Conversation

turbolent
Copy link
Member

Description

Initialize declarations in the same order as they are initialized in the checker.

In addition, change global variables to be initialized lazily, so that potential forward references, through e.g. functions, work properly.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@turbolent turbolent requested a review from SupunS May 28, 2021 20:20
@turbolent turbolent self-assigned this May 28, 2021
@codecov-commenter
Copy link

codecov-commenter commented May 28, 2021

Codecov Report

Merging #958 (6887659) into master (8e3c230) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head 6887659 differs from pull request most recent head 9547869. Consider uploading reports for the commit 9547869 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #958      +/-   ##
==========================================
+ Coverage   75.36%   75.40%   +0.03%     
==========================================
  Files         268      268              
  Lines       32666    32690      +24     
==========================================
+ Hits        24618    24649      +31     
+ Misses       6915     6910       -5     
+ Partials     1133     1131       -2     
Flag Coverage Δ
unittests 75.40% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
runtime/ast/program.go 72.41% <100.00%> (+0.48%) ⬆️
runtime/ast/programindices.go 100.00% <100.00%> (ø)
runtime/interpreter/interpreter.go 90.45% <100.00%> (+0.22%) ⬆️
runtime/interpreter/interpreter_statement.go 89.13% <100.00%> (+0.49%) ⬆️
runtime/runtime_storage.go 87.87% <0.00%> (+1.01%) ⬆️
runtime/interpreter/variable_activations.go 84.44% <0.00%> (+2.22%) ⬆️
runtime/interpreter/variable.go 100.00% <0.00%> (+20.00%) ⬆️

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 8e3c230...9547869. Read the comment docs.

Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

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

LGTM!

runtime/tests/interpreter/declaration_test.go Outdated Show resolved Hide resolved
Co-authored-by: Supun Setunga <supun.setunga@gmail.com>
@turbolent turbolent merged commit e416c7e into master May 31, 2021
@turbolent turbolent deleted the bastian/fix-interpreter-initialization-order branch May 31, 2021 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants