summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 2f86fcef2..0e9967128 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -336,7 +336,7 @@ public:
#define abort_on(str) { std::cerr << "aborting on " << str << '\n'; onError(); }
Expression* parseExpression(Element& s) {
- //if (debug) std::cerr << "parse expression " << s << '\n';
+ //std::cerr << "parse expression " << s << '\n';
IString id = s[0]->str();
const char *str = id.str;
const char *dot = strchr(str, '.');
@@ -483,6 +483,10 @@ public:
if (str[1] == 'e') return makeGetLocal(s);
abort_on(str);
}
+ case 'h': {
+ if (str[1] == 'a') return makeHost(s, HostOp::HasFeature);
+ abort_on(str);
+ }
case 'i': {
if (str[1] == 'f') return makeIf(s);
abort_on(str);
@@ -548,6 +552,17 @@ private:
return ret;
}
+ Expression* makeHost(Element& s, HostOp op) {
+ auto ret = allocator.alloc<Host>();
+ ret->op = op;
+ if (op == HostOp::HasFeature) {
+ ret->nameOperand = s[1]->str();
+ } else {
+ parseCallOperands(s, 1, ret);
+ }
+ return ret;
+ }
+
Expression* makeSetLocal(Element& s) {
auto ret = allocator.alloc<SetLocal>();
ret->name = s[1]->str();