-
Notifications
You must be signed in to change notification settings - Fork 116
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: Issue #970: interpreter called only when contract present #1047
base: main
Are you sure you want to change the base?
Changes from 6 commits
bf955e7
b297ab2
50af1d5
c5d8678
e9f02f5
34b82b6
90bcde3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -960,7 +960,7 @@ export class Interpreter { | |
if (foundContractConst.value !== undefined) { | ||
return foundContractConst.value; | ||
} else { | ||
throwErrorConstEval( | ||
throwNonFatalErrorConstEval( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I don't understand this change, and I suspect a future reader wouldn't either. When do we throw non-fatal errors in general? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When we want to stop the constant evaluation, but continue compiling the rest of the contract. Like, when not being able to compute something at compile-time with ability to fallback to run-time implementation for that something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, but the current pipeline kinda relies on throwing and catching errors and not on errors as values |
||
`cannot evaluate declared contract/trait constant ${idTextErr(ast.field)} as it does not have a body`, | ||
ast.field.loc, | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Smooth" (in math sense) behavior would be to dump the code anyway, yet unoptimized. "Dump the optimized code" is just another separate optional compilation step that happens to be in the list after "optimize" step.