Skip to content

Commit 77177c7

Browse files
Franco Victoriomattiaerre
authored andcommitted
Add support for AssemblyIf (#90)
1 parent df8721d commit 77177c7

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

src/printer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,13 @@ function genericPrint(path, options, print) {
515515
':=',
516516
path.call(print, 'expression')
517517
]);
518+
case 'AssemblyIf':
519+
return concat([
520+
'if ',
521+
path.call(print, 'condition'),
522+
' ',
523+
path.call(print, 'body')
524+
]);
518525
case 'FunctionTypeName': {
519526
const returns = returnTypes => {
520527
if (returnTypes.length > 0) {

tests/Assembly/Assembly.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
contract Assembly {
2+
function ifAssembly() {
3+
assembly {
4+
if
5+
returndatasize {
6+
success := 0
7+
}
8+
}
9+
}
10+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Assembly.sol 1`] = `
4+
contract Assembly {
5+
function ifAssembly() {
6+
assembly {
7+
if
8+
returndatasize {
9+
success := 0
10+
}
11+
}
12+
}
13+
}
14+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
contract Assembly {
16+
function ifAssembly() {
17+
assembly {
18+
if returndatasize {
19+
success := 0
20+
}
21+
}
22+
}
23+
}
24+
25+
`;

tests/Assembly/jsfmt.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
run_spec(__dirname);

0 commit comments

Comments
 (0)