summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-02-02 13:34:08 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-02-02 13:34:08 -0800
commit793cb20b7b8e94c607ad83b18892cc339862f96f (patch)
tree89a3c4509a068ef900254ce3d36449fc9f68586f /src
parent0cd317a9f870ea701a54badee9f34329f3430744 (diff)
downloadbinaryen-793cb20b7b8e94c607ad83b18892cc339862f96f.tar.gz
binaryen-793cb20b7b8e94c607ad83b18892cc339862f96f.tar.bz2
binaryen-793cb20b7b8e94c607ad83b18892cc339862f96f.zip
don't accept -+ #163
Diffstat (limited to 'src')
-rw-r--r--src/parsing.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/parsing.h b/src/parsing.h
index 817355e92..1ea0ec254 100644
--- a/src/parsing.h
+++ b/src/parsing.h
@@ -60,7 +60,11 @@ Expression* parseConst(cashew::IString s, WasmType type, MixedArena& allocator)
}
bool negative = str[0] == '-';
const char *positive = negative ? str + 1 : str;
- if (positive[0] == '+') positive++;
+ if (!negative) {
+ if (positive[0] == '+') {
+ positive++;
+ }
+ }
if (positive[0] == 'n' && positive[1] == 'a' && positive[2] == 'n') {
const char * modifier = positive[3] == ':' ? positive + 4 : nullptr;
assert(modifier ? positive[4] == '0' && positive[5] == 'x' : 1);