-
Notifications
You must be signed in to change notification settings - Fork 43
Define built-ins contexts (for Yul built-in functions) and synthetically build the stack graph for the built-ins #1203
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
Conversation
🦋 Changeset detectedLatest commit: d83bf79 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f5c37a6
to
aa7fd27
Compare
…ing `BuiltInContext` This version is very broken but it represents most of the initial changes to `definitions.rs`
… enable `jump`/`jumpi`
... and remove parsing and processing Solidity generated files with the built-in definitions.
...olidity/testing/snapshots/cst_output/YulVariableAssignmentStatement/identifier_add/input.sol
Show resolved
Hide resolved
crates/solidity/testing/snapshots/cst_output/YulFunctionCallExpression/built_in_and/input.sol
Show resolved
Hide resolved
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.
Left a few qestions.
…ing functions named `_`
crates/solidity/testing/snapshots/bindings_output/yul/solidity_built_in_doesn_t_bind/input.sol
Outdated
Show resolved
Hide resolved
crates/solidity/testing/snapshots/bindings_output/built_ins/yul_built_in_doesn_t_bind/input.sol
Outdated
Show resolved
Hide resolved
...olidity/testing/snapshots/cst_output/YulVariableAssignmentStatement/identifier_and/input.sol
Outdated
Show resolved
Hide resolved
...olidity/testing/snapshots/bindings_output/yul/external_variables/generated/0.5.8-failure.txt
Show resolved
Hide resolved
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.
Did another round, and resolved earlier comments.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @nomicfoundation/slang@0.20.0 ### Minor Changes - [#1203](#1203) [`a5c3b1a`](a5c3b1a) Thanks [@ggiraldez](https://github.com/ggiraldez)! - add separate contexts (ie. binding scopes) for Solidity and Yul built-ins - [#1257](#1257) [`9f5d8f0`](9f5d8f0) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - export `assertUserFileLocation()` and `assertBuiltInLocation()` utilities from the `bindings` module - [#1243](#1243) [`99d182f`](99d182f) Thanks [@ggiraldez](https://github.com/ggiraldez)! - add `definition.references()` API to find all references that resolve to a definition. - [#1205](#1205) [`103b331`](103b331) Thanks [@mjoerussell](https://github.com/mjoerussell)! - Make `Edge::label` a required field instead of being optional. - [#1257](#1257) [`9f5d8f0`](9f5d8f0) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - update user guides with new binding graph and compilation APIs - [#1257](#1257) [`9f5d8f0`](9f5d8f0) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - export `assertNonterminalNode()` and `assertTerminalNode()` utilities from the `cst` module ### Patch Changes - [#1246](#1246) [`aea2dd0`](aea2dd0) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - unreserve `jump` and `jumpi` yul keywords between `0.6.0` and `0.8.0` - [#1203](#1203) [`a5c3b1a`](a5c3b1a) Thanks [@ggiraldez](https://github.com/ggiraldez)! - enable `address payable` from 0.5.0 and remove `transfer` built-in from non-payable `address`es - [#1246](#1246) [`aea2dd0`](aea2dd0) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - make sure assembly flags are only enabled starting from `0.8.13` - [#1246](#1246) [`aea2dd0`](aea2dd0) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - enable yul's `true` and `false` keywords starting from `0.6.2` - [#1246](#1246) [`aea2dd0`](aea2dd0) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - make sure `super` and `this` keywords are unreserved before `0.8.0`. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR introduces several changes to how built-ins are defined and processed. We define different built-in contexts to separate built-in symbols available in Solidity and Yul. Also, the part of the stack graph that contains all definitions of built-ins is now built directly into the stack graph, without generating a Solidity file and the processing it as a system file. This allows much faster initialization of the Bindings Graph and most symbol mangling is no longer needed since we're not required to parse the built-ins file anymore.
In addition, all Yul built-ins are no longer defined in the grammar as special keywords and instead are treated as normal identifiers and bound to built-in definitions using the regular binding rules.
The API
add_system_file
was removed fromBindingGraphBuilder
and the file descriptor renamed fromsystem
tobuilt-ins
. All code previously required to transform built-in identifiers (ie. from$
to%
) to avoid clashing with user code is no longer necessary and hence removed.Fix #1244: the changes for
address payable
are also included in this PR.