-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move] Add named addresses to Move IR syntax (#18317)
## Description Little PR that adds support for using named addresses in Move IR source syntax. ## Test plan Added a test to make sure that we handle them correctly, and existing tests.
- Loading branch information
Showing
10 changed files
with
181 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...crates/move/crates/move-ir-compiler-transactional-tests/tests/parsing/named_addresses.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
processed 3 tasks | ||
|
||
task 2 'print-bytecode'. lines 16-36: | ||
// Move bytecode v6 | ||
module 1.M { | ||
use 0000000000000000000000000000000000000000000000000000000000000001::T; | ||
|
||
|
||
|
||
|
||
|
||
|
||
f(): address { | ||
B0: | ||
0: Call T::f() | ||
1: LdConst[0](address: 0x00..) | ||
2: Ret | ||
|
||
} | ||
h(): address { | ||
B0: | ||
0: LdConst[0](address: 0x00..) | ||
1: Call T::g(address): address | ||
2: Ret | ||
|
||
} | ||
l(): address { | ||
L0: loc0: address | ||
B0: | ||
0: LdConst[0](address: 0x00..) | ||
1: StLoc[0](loc0: address) | ||
2: MoveLoc[0](loc0: address) | ||
3: Call T::g(address): address | ||
4: Ret | ||
|
||
} | ||
|
||
Constants [ | ||
0 => address: 0x0000000000000000000000000000000000000000000000000000000000000001 | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
...rates/move/crates/move-ir-compiler-transactional-tests/tests/parsing/named_addresses.mvir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//# init --addresses A=0x1 | ||
|
||
//# publish | ||
module A.T { | ||
f() { | ||
label l0: | ||
return; | ||
} | ||
|
||
g(a: address): address { | ||
label l0: | ||
return move(a); | ||
} | ||
} | ||
|
||
//# print-bytecode | ||
module A.M { | ||
import A.T; | ||
f(): address { | ||
label l0: | ||
T.f(); | ||
return @A; | ||
} | ||
|
||
h(): address { | ||
label l0: | ||
return T.g(@A); | ||
} | ||
|
||
l(): address { | ||
let t: address; | ||
label l0: | ||
t = @A; | ||
return T.g(move(t)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters