Skip to content

Commit 3702483

Browse files
authored
Merge pull request #5 from ConsenSys/master
Allow return keyword to used as assembly opcode
2 parents 2137e14 + e44ed21 commit 3702483

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

solidity.pegjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,8 +1617,18 @@ AssemblyAssignment
16171617
}
16181618
}
16191619

1620+
ReturnOpCode
1621+
= 'return' {
1622+
return {
1623+
type: "Identifier",
1624+
name: "return",
1625+
start: location().start.offset,
1626+
end: location().end.offset
1627+
}
1628+
}
1629+
16201630
FunctionalAssemblyInstruction
1621-
= name:Identifier __ '(' __ head:AssemblyItem? __ tail:( ',' __ AssemblyItem )* __ ')' {
1631+
= name:(Identifier / ReturnOpCode) __ '(' __ head:AssemblyItem? __ tail:( ',' __ AssemblyItem )* __ ')' {
16221632
return {
16231633
type: "FunctionalAssemblyInstruction",
16241634
name: name,

test/doc_examples.sol

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,19 @@ contract assemblyLocalBinding {
312312
}
313313
}
314314

315+
contract assemblyReturn {
316+
uint a = 10;
317+
318+
function get() constant returns(uint) {
319+
assembly {
320+
mstore(0x40, sload(0))
321+
byte(0)
322+
address(0)
323+
return(0x40,32)
324+
}
325+
}
326+
}
327+
315328
contract usesConst {
316329
uint const = 0;
317330
}

0 commit comments

Comments
 (0)