The deeper equality revealed that a test which appeared to pass in sym_table_stack_tests actually was failing without our knowledge. The test test_variable_initialization_sym_table fails because the returned STS has a boolean value with a value of an ASTNode that contains a Literal("true") instead of just containing a value of StrValue("true"), you can check this yourself by running the test.
Edit sym_table_init inside of symbol_table_statement so that if the value is simple (like just plain true/false or an int or something like that) then collect it inside a StrValue, and only if the value is complex/needs to be evaluated to know the answer should you collect it in a Node like it is currently.
Issue Type
[ ] Feature
[x] Bugfix
[ ] Documentation
[x] Refactoring
[ ] Other:
Requirements
Fix the STS initialization function to make simple values be collected in a StrValue, else collect it in a Node
Fix the test to run
Make new tests that test the complex functionality
Notes
Could probably use the structure of ASTNodes to help find what's "complex" and what isn't, like a BinaryExpression node would be complex and an AsignedValue with Literal("true") would be simple.
Details
The deeper equality revealed that a test which appeared to pass in
sym_table_stack_tests
actually was failing without our knowledge. The testtest_variable_initialization_sym_table
fails because the returned STS has a boolean value with a value of anASTNode
that contains aLiteral("true")
instead of just containing a value ofStrValue("true")
, you can check this yourself by running the test.Edit
sym_table_init
inside ofsymbol_table_statement
so that if the value is simple (like just plain true/false or an int or something like that) then collect it inside a StrValue, and only if the value is complex/needs to be evaluated to know the answer should you collect it in a Node like it is currently.Issue Type
Requirements
Fix the STS initialization function to make simple values be collected in a StrValue, else collect it in a Node Fix the test to run Make new tests that test the complex functionality
Notes
Could probably use the structure of ASTNodes to help find what's "complex" and what isn't, like a BinaryExpression node would be complex and an AsignedValue with Literal("true") would be simple.