-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
177 additions
and
39 deletions.
There are no files selected for viewing
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,17 @@ | ||
package r1 | ||
|
||
import ( | ||
r2 "gno.land/r/demo/nested/r2" | ||
"std" | ||
) | ||
|
||
func Stack() { | ||
println("r1.GetOrigCaller():", std.GetOrigCaller()) | ||
|
||
pr := std.PrevRealm() | ||
println("r1.PrevRealm.Addr():", pr.Addr()) | ||
println("r1.PrevRealm.PkgPath():", pr.PkgPath()) | ||
println() | ||
|
||
r2.Stack() | ||
} |
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,24 @@ | ||
package r2 | ||
|
||
import ( | ||
r3 "gno.land/r/demo/nested/r3" | ||
"std" | ||
) | ||
|
||
func Stack() { | ||
orig := std.GetOrigCaller() // g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm | ||
std.TestSetOrigCaller("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // test1 | ||
|
||
println("r2.GetOrigCaller():", std.GetOrigCaller()) | ||
|
||
pr := std.PrevRealm() | ||
|
||
println("r2.PrevRealm.Addr():", pr.Addr()) | ||
println("r2.PrevRealm.PkgPath():", pr.PkgPath()) | ||
println() | ||
|
||
// recover | ||
std.TestSetOrigCaller(orig) | ||
|
||
r3.Stack() | ||
} |
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,17 @@ | ||
package r3 | ||
|
||
import ( | ||
r4 "gno.land/r/demo/nested/r4" | ||
"std" | ||
) | ||
|
||
func Stack() { | ||
println("r3.GetOrigCaller():", std.GetOrigCaller()) | ||
|
||
pr := std.PrevRealm() | ||
println("r3.PrevRealm.Addr():", pr.Addr()) | ||
println("r3.PrevRealm.PkgPath():", pr.PkgPath()) | ||
println() | ||
|
||
r4.Stack() | ||
} |
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,23 @@ | ||
package r4 | ||
|
||
import ( | ||
r5 "gno.land/r/demo/nested/r5" | ||
"std" | ||
) | ||
|
||
func Stack() { | ||
orig := std.PrevRealm().PkgPath() | ||
std.TestSetPrevAddr("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") | ||
|
||
println("r4.GetOrigCaller():", std.GetOrigCaller()) | ||
|
||
pr := std.PrevRealm() | ||
println("r4.PrevRealm.Addr():", pr.Addr()) | ||
println("r4.PrevRealm.PkgPath():", pr.PkgPath()) | ||
println() | ||
|
||
// recover | ||
std.TestSetPrevRealm("gno.land/r/demo/nested/r4") | ||
|
||
r5.Stack() | ||
} |
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,14 @@ | ||
package r5 | ||
|
||
import ( | ||
"std" | ||
) | ||
|
||
func Stack() { | ||
println("r5.GetOrigCaller():", std.GetOrigCaller()) | ||
|
||
pr := std.PrevRealm() | ||
println("r5.PrevRealm.Addr():", pr.Addr()) | ||
println("r5.PrevRealm.PkgPath():", pr.PkgPath()) | ||
println() | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// PKGPATH: gno.land/r/prevrealm_test | ||
package prevrealm_test | ||
|
||
import ( | ||
"fmt" | ||
"std" | ||
|
||
r1 "gno.land/r/demo/nested/r1" | ||
) | ||
|
||
func main() { | ||
r1.Stack() | ||
} | ||
|
||
// Output: | ||
// r1.GetOrigCaller(): g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm | ||
// r1.PrevRealm.Addr(): g1ngy6g5vkxnj75zjuf640npzvas4suja7gzg65l | ||
// r1.PrevRealm.PkgPath(): gno.land/r/prevrealm_test | ||
// | ||
// r2.GetOrigCaller(): g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 | ||
// r2.PrevRealm.Addr(): g176s5yqvc2rlzjv0uurdvffjsddyec52umtvvyz | ||
// r2.PrevRealm.PkgPath(): gno.land/r/demo/nested/r1 | ||
// | ||
// r3.GetOrigCaller(): g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm | ||
// r3.PrevRealm.Addr(): g1h4kjvsxlp2w8km6sdggc86r7qd4wxgjz4herwp | ||
// r3.PrevRealm.PkgPath(): gno.land/r/demo/nested/r2 | ||
// | ||
// r4.GetOrigCaller(): g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 | ||
// r4.PrevRealm.Addr(): g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 | ||
// r4.PrevRealm.PkgPath(): | ||
// | ||
// r5.GetOrigCaller(): g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 | ||
// r5.PrevRealm.Addr(): g1tnuhr8an4vufw8j800k2jdwsjgfekhkhcrc9wf | ||
// r5.PrevRealm.PkgPath(): gno.land/r/demo/nested/r4 |
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