diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-03 21:23:24 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-03 21:23:24 -0800 |
commit | e9b3051ed21cb6c406a95acbcb2a2d1f88396676 (patch) | |
tree | 606ec610a57723f882a63a22682efa47bfebf772 /src/wasm-s-parser.h | |
parent | a0de6e95733602f7f246bb537af79e87c4a6070a (diff) | |
download | binaryen-e9b3051ed21cb6c406a95acbcb2a2d1f88396676.tar.gz binaryen-e9b3051ed21cb6c406a95acbcb2a2d1f88396676.tar.bz2 binaryen-e9b3051ed21cb6c406a95acbcb2a2d1f88396676.zip |
fix load and store
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 390776a55..fdf44a5a2 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -22,9 +22,7 @@ IString MODULE("module"), MEMORY("memory"), EXPORT("export"), TABLE("table"), - LOCAL("local"), - ALIGN("align"), - OFFSET("offset"); + LOCAL("local"); // // An element in an S-Expression: a list or a string @@ -457,12 +455,15 @@ private: size_t i = 1; ret->offset = 0; ret->align = -1; - while (s[i]->isList()) { - Element& curr = *s[i]; - if (curr[0]->str() == ALIGN) { - ret->align = atoi(curr[1]->c_str()); - } else if (curr[0]->str() == OFFSET) { - ret->offset = atoi(curr[1]->c_str()); + while (!s[i]->isList()) { + const char *str = s[i]->c_str(); + const char *eq = strchr(str, '='); + assert(eq); + eq++; + if (str[0] == 'a') { + ret->align = atoi(eq); + } else if (str[0] == 'o') { + ret->offset = atoi(eq); } else abort(); i++; } @@ -485,12 +486,15 @@ private: size_t i = 1; ret->offset = 0; ret->align = -1; - while (s[i]->isList()) { - Element& curr = *s[i]; - if (curr[0]->str() == ALIGN) { - ret->align = atoi(curr[1]->c_str()); - } else if (curr[0]->str() == OFFSET) { - ret->offset = atoi(curr[1]->c_str()); + while (!s[i]->isList()) { + const char *str = s[i]->c_str(); + const char *eq = strchr(str, '='); + assert(eq); + eq++; + if (str[0] == 'a') { + ret->align = atoi(eq); + } else if (str[0] == 'o') { + ret->offset = atoi(eq); } else abort(); i++; } |