summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-07-06 13:10:21 -0700
committerGitHub <noreply@github.com>2016-07-06 13:10:21 -0700
commit9455a8749e1bb2c4788c37495b9cd319f046f6ff (patch)
treeda02eadeae89d40f82a1e203b11e581138682129 /src
parent05d7bd3028793de007043eacc6e73b1c0cedb7ba (diff)
parentfa050b2f9c1e4b68c5067487515d1f67ae9bf9cf (diff)
downloadbinaryen-9455a8749e1bb2c4788c37495b9cd319f046f6ff.tar.gz
binaryen-9455a8749e1bb2c4788c37495b9cd319f046f6ff.tar.bz2
binaryen-9455a8749e1bb2c4788c37495b9cd319f046f6ff.zip
Merge pull request #621 from WebAssembly/spec-update
Spec test update
Diffstat (limited to 'src')
-rw-r--r--src/parsing.h4
-rw-r--r--src/tools/binaryen-shell.cpp5
-rw-r--r--src/wasm-binary.h1
-rw-r--r--src/wasm-s-parser.h8
4 files changed, 15 insertions, 3 deletions
diff --git a/src/parsing.h b/src/parsing.h
index f5df77bad..fb9e3547c 100644
--- a/src/parsing.h
+++ b/src/parsing.h
@@ -127,7 +127,7 @@ inline Expression* parseConst(cashew::IString s, WasmType type, MixedArena& allo
ret->value = Literal(negative ? -temp : temp);
} else {
std::istringstream istr(str);
- int32_t temp;
+ uint32_t temp;
istr >> temp;
ret->value = Literal(temp);
}
@@ -143,7 +143,7 @@ inline Expression* parseConst(cashew::IString s, WasmType type, MixedArena& allo
ret->value = Literal(negative ? -temp : temp);
} else {
std::istringstream istr(str);
- int64_t temp;
+ uint64_t temp;
istr >> temp;
ret->value = Literal(temp);
}
diff --git a/src/tools/binaryen-shell.cpp b/src/tools/binaryen-shell.cpp
index 8e6622de3..79c01c5bf 100644
--- a/src/tools/binaryen-shell.cpp
+++ b/src/tools/binaryen-shell.cpp
@@ -105,7 +105,10 @@ static void run_asserts(size_t* i, bool* checked, Module* wasm,
Colors::green(std::cerr);
std::cerr << " CHECKING: ";
Colors::normal(std::cerr);
- std::cerr << curr << '\n';
+ std::cerr << curr;
+ Colors::green(std::cerr);
+ std::cerr << " [line: " << curr.line << "]\n";
+ Colors::normal(std::cerr);
if (id == ASSERT_INVALID) {
// a module invalidity test
Module wasm;
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index a76bf7fa5..e77f3992e 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -469,6 +469,7 @@ class WasmBinaryWriter : public Visitor<WasmBinaryWriter, void> {
if (func->type.isNull()) {
func->type = ensureFunctionType(getSig(func.get()), wasm)->name;
}
+ // TODO: depending on upstream flux https://github.com/WebAssembly/spec/pull/301 might want this: assert(!func->type.isNull());
}
}
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index a48ee1a5f..c6b3809f1 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -498,6 +498,14 @@ private:
body = allocator.alloc<Nop>();
}
if (currFunction->result != result) throw ParseException("bad func declaration", s.line, s.col);
+ /* TODO: spec in flux, https://github.com/WebAssembly/spec/pull/301
+ if (type.isNull()) {
+ // if no function type provided, generate a private one for this function
+ auto* functionType = sigToFunctionType(getSig(currFunction.get()));
+ wasm.addFunctionType(functionType);
+ type = functionType->name;
+ }
+ */
currFunction->body = body;
currFunction->type = type;
wasm.addFunction(currFunction.release());