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

Add error for scratch slot load before store #47

Merged
merged 1 commit into from
Mar 26, 2021

Conversation

jasonpaulos
Copy link
Member

This PR makes the compiler throw an error if a scratch slot is loaded before anything has been stored in it. This should make it safer to use ScratchVar and MaybeValue.

In order to make this type of error indicate where in the program an improperly used slot is, I had to change a few things. I modified TealComponent and its subclasses to contain references to the Expr that created them, and I used the traceback module to create formatted tracebacks every time an Expr is created. These two changes allowed me to embed useful location information in the error that gets thrown.

Closes #35.

@jasonpaulos jasonpaulos merged commit 147d2b6 into master Mar 26, 2021
@jasonpaulos jasonpaulos deleted the jason/scratch-slot-error branch March 26, 2021 21:06
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.

Add compiler check for scratch space expressions
1 participant