walt-compiler
Advanced tools
Comparing version 0.8.2 to 0.8.3
{ | ||
"name": "walt-compiler", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"description": "Alternative syntax for WebAssembly text format", | ||
@@ -19,2 +19,3 @@ "main": "dist/walt.js", | ||
"precommit": "lint-staged", | ||
"preversion": "npm run build && npm run build-prod", | ||
"nyc": "nyc" | ||
@@ -21,0 +22,0 @@ }, |
@@ -7,2 +7,16 @@ // @flow | ||
const alignCodes = { | ||
load8_s: 0, | ||
load8_u: 0, | ||
store8: 0, | ||
load16_s: 1, | ||
load16_u: 1, | ||
store16: 1, | ||
store32: 2, | ||
load32_s: 2, | ||
load32_u: 2, | ||
store: 2, | ||
load: 2, | ||
}; | ||
const generateNative: GeneratorType = (node, parent) => { | ||
@@ -12,20 +26,7 @@ const block = node.params.map(mapSyntax(parent)).reduce(mergeBlock, []); | ||
const operation = node.value.split(".").pop(); | ||
if (operation === "clz") { | ||
if (alignCodes[operation] == null) { | ||
block.push({ kind: textMap[node.value], params: [] }); | ||
} else { | ||
const alignment = (() => { | ||
switch (operation) { | ||
case "load8_s": | ||
case "load8_u": | ||
case "store8": | ||
return 0; | ||
case "load16_s": | ||
case "load16_u": | ||
case "store16": | ||
return 1; | ||
// "store32" as well | ||
default: | ||
return 2; | ||
} | ||
})(); | ||
const alignment = alignCodes[operation]; | ||
@@ -32,0 +33,0 @@ const params = [alignment, 0]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
15350237
14158