mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support metadata via IR.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
object "A" {
|
||||
code {
|
||||
pop(datasize("x"))
|
||||
pop(datasize("C"))
|
||||
}
|
||||
|
||||
object "B" {
|
||||
code { pop(dataoffset("other")) }
|
||||
data ".metadata" "M1"
|
||||
data "other" "Hello, World2!"
|
||||
}
|
||||
|
||||
data "C" "ABC"
|
||||
data ".metadata" "M2"
|
||||
data "x" "Hello, World2!"
|
||||
}
|
||||
// ----
|
||||
// Assembly:
|
||||
// /* "source":26:44 */
|
||||
// pop(0x0e)
|
||||
// /* "source":49:67 */
|
||||
// pop(0x03)
|
||||
// stop
|
||||
// data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336 48656c6c6f2c20576f726c643221
|
||||
// data_e1629b9dda060bb30c7908346f6af189c16773fa148d3366701fbaa35d54f3c8 414243
|
||||
//
|
||||
// sub_0: assembly {
|
||||
// /* "source":99:123 */
|
||||
// pop(data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336)
|
||||
// stop
|
||||
// data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336 48656c6c6f2c20576f726c643221
|
||||
//
|
||||
// auxdata: 0x4d31
|
||||
// }
|
||||
//
|
||||
// auxdata: 0x4d32
|
||||
// Bytecode: 600e50600350fe4d32
|
||||
// Opcodes: PUSH1 0xE POP PUSH1 0x3 POP INVALID 0x4D ORIGIN
|
||||
// SourceMappings: 26:18:0:-:0;;49;
|
||||
@@ -0,0 +1,32 @@
|
||||
object "A" {
|
||||
code {
|
||||
pop(dataoffset(".other"))
|
||||
pop(datasize(".other"))
|
||||
pop(datasize("B..other"))
|
||||
// "B.other" does not exist.
|
||||
pop(datasize("B.other"))
|
||||
// ".metadata" is not accessible by definition
|
||||
pop(dataoffset(".metadata"))
|
||||
pop(datasize(".metadata"))
|
||||
pop(dataoffset("B..metadata"))
|
||||
pop(datasize("B..metadata"))
|
||||
}
|
||||
|
||||
object "B" {
|
||||
code {}
|
||||
data ".metadata" "Hello, World!"
|
||||
data ".other" "Hello, World2!"
|
||||
}
|
||||
|
||||
data ".metadata" "Hello, World!"
|
||||
data ".other" "Hello, World2!"
|
||||
}
|
||||
// ----
|
||||
// TypeError 3517: (41-49): Unknown data object ".other".
|
||||
// TypeError 3517: (69-77): Unknown data object ".other".
|
||||
// TypeError 3517: (97-107): Unknown data object "B..other".
|
||||
// TypeError 3517: (160-169): Unknown data object "B.other".
|
||||
// TypeError 3517: (242-253): Unknown data object ".metadata".
|
||||
// TypeError 3517: (273-284): Unknown data object ".metadata".
|
||||
// TypeError 3517: (306-319): Unknown data object "B..metadata".
|
||||
// TypeError 3517: (339-352): Unknown data object "B..metadata".
|
||||
@@ -0,0 +1,13 @@
|
||||
object "A" {
|
||||
code {
|
||||
sstore(dataoffset("0"), dataoffset("1"))
|
||||
sstore(0, datasize(".mightbereservedinthefuture"))
|
||||
}
|
||||
|
||||
data "0" "UVW"
|
||||
data ".metadata" "ABC"
|
||||
data "1" "XYZ"
|
||||
data ".mightbereservedinthefuture" "TRS"
|
||||
}
|
||||
// ----
|
||||
// TypeError 3517: (90-119): Unknown data object ".mightbereservedinthefuture".
|
||||
@@ -0,0 +1,12 @@
|
||||
object "A" {
|
||||
code {
|
||||
sstore(dataoffset(".metadata.x"), 0)
|
||||
}
|
||||
|
||||
object ".metadata" {
|
||||
code {}
|
||||
data "x" "ABC"
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 3517: (41-54): Unknown data object ".metadata.x".
|
||||
Reference in New Issue
Block a user