Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.

Commit 4052d20

Browse files
committed
Relint
1 parent 2264295 commit 4052d20

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

wasm/generateInterface.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function generateManifest (interfaceManifest, opts) {
166166
const json = {}
167167
for (let opcode in interfaceManifest) {
168168
const op = interfaceManifest[opcode]
169-
// generate the import params
169+
// generate the import params
170170
let inputs = op.input.map(input => input === 'i64' ? 'i64' : 'i32').concat(op.output.filter(type => type !== 'i32' && type !== 'i64').map(() => 'i32'))
171171
let params = ''
172172

@@ -186,7 +186,7 @@ function generateManifest (interfaceManifest, opts) {
186186
// generate import
187187
const imports = `(import "ethereum" "${op.name}" (func $${op.name} ${params} ${result}))`
188188
let wasm = ';; generated by ./wasm/generateInterface.js\n'
189-
// generate function
189+
// generate function
190190
wasm += `(func $${opcode} `
191191
if (useAsyncAPI && op.async) {
192192
wasm += '(param $callback i32)'
@@ -198,11 +198,10 @@ function generateManifest (interfaceManifest, opts) {
198198
// generate the call to the interface
199199
let spOffset = 0
200200
let numOfLocals = 0
201-
let lastOffset
202201
let call = `(call $${op.name}`
203202
op.input.forEach((input) => {
204203
// TODO: remove 'pointer' type, replace with 'ipointer' or 'opointer'
205-
if (input === 'i128' || input == 'address' || input == 'pointer') {
204+
if (input === 'i128' || input === 'address' || input === 'pointer') {
206205
if (spOffset) {
207206
call += `(i32.add (get_global $sp) (i32.const ${spOffset * 32}))`
208207
} else {
@@ -256,7 +255,6 @@ function generateManifest (interfaceManifest, opts) {
256255
(i64.load (i32.add (get_global $sp) (i32.const ${spOffset * 32 + 8 * 2})))
257256
(i64.load (i32.add (get_global $sp) (i32.const ${spOffset * 32 + 8 * 3}))))`
258257
} else if (input === 'writeOffset' || input === 'readOffset') {
259-
lastOffset = input
260258
locals += `(local $offset${numOfLocals} i32)`
261259
body += `(set_local $offset${numOfLocals}
262260
(call $check_overflow
@@ -359,7 +357,6 @@ function generateManifest (interfaceManifest, opts) {
359357
(i64.extend_u/i32
360358
(i32.eqz ${call}) ;; flip CALL result from EEI to EVM convention (0 -> 1, 1,2,.. -> 1)
361359
)))`
362-
363360
} else {
364361
call =
365362
`(i64.store

0 commit comments

Comments
 (0)