spcl / spcl/dace

Let `defined_vars.add` emit code and use `defined_vars.get` to verify

Open
#665 0 comments 0 reactions 0 assignees View on GitHub
codegen enhancement
Dominant language
Python
Stars
593
Forks
163
Avg merge
2d 23h
Merged PRs (30d)
60

Description

Currently `defined_vars.add` is called "extra" next to the code actually emitting the definition code. Instead, let `defined_vars.add` (should be renamed/possibly refactored) actually return the string if it can be successfully defined, and rely on `defined_vars.get` every time we want to reference any variable, so we can assert that this variable actually exists, as well as return the correct C-type as we currently do.

Doing this is likely to make a bunch of new bugs emerge, due to situations where we don't properly keep track of defined variables. We can catch undefined variables early, and even unused variables (for inspiration to what could be pruned) this way.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.