summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2016-10-26 10:11:27 -0700
committerGitHub <noreply@github.com>2016-10-26 10:11:27 -0700
commitc5ab566cc3343d3b9e07eab4855b0dbfb2c81afe (patch)
tree60a911ebac590d63473b27b44169bcfdc1cfc48b /src/wasm/wasm-s-parser.cpp
parentded69c16a2b3f27dd9b12b184d7045596d2a21d0 (diff)
downloadbinaryen-c5ab566cc3343d3b9e07eab4855b0dbfb2c81afe.tar.gz
binaryen-c5ab566cc3343d3b9e07eab4855b0dbfb2c81afe.tar.bz2
binaryen-c5ab566cc3343d3b9e07eab4855b0dbfb2c81afe.zip
Binary 0xd changes (#803)
* Renumber opcodes for 0xd * Unified type encoding * Add reserved flags fields to host instructions and call_indirect * Rename flags->reserved * Fix line numbers in wast parser Also don't throw if the memory is defined in the same Element as the export of memory (the validity is checked later anyway). * Skip spec binary.wast The spec testsuite is still on 0xc, so 0xd doesn't match. In order to update to 0xd we need to implement some additional functionality for the import test, namely (register)
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index cbcdd5d3a..5898cc252 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -94,7 +94,7 @@ void Element::dump() {
SExpressionParser::SExpressionParser(char* input) : input(input) {
root = nullptr;
- line = 0;
+ line = 1;
lineStart = input;
while (!root) { // keep parsing until we pass an initial comment
root = parse();
@@ -138,7 +138,7 @@ void SExpressionParser::skipWhitespace() {
if (input[0] == ';' && input[1] == ';') {
while (input[0] && input[0] != '\n') input++;
line++;
- lineStart = input;
+ lineStart = ++input;
} else if (input[0] == '(' && input[1] == ';') {
// Skip nested block comments.
input += 2;
@@ -1438,7 +1438,6 @@ void SExpressionWasmBuilder::parseExport(Element& s) {
if (inner[0]->str() == FUNC) {
ex->kind = ExternalKind::Function;
} else if (inner[0]->str() == MEMORY) {
- if (!wasm.memory.exists) throw ParseException("memory exported but no memory");
ex->kind = ExternalKind::Memory;
} else if (inner[0]->str() == TABLE) {
ex->kind = ExternalKind::Table;