MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / parse_valtype

Method parse_valtype

src/lib/parse/ParseContext.cpp:143–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141// ── Valtype / FuncType / type sub-parsers ─────────────────────────────────────
142
143ValueType ParseContext::parse_valtype() {
144 Token t = tok_.expect(TokenType::Keyword, "valtype");
145 if (t.text == "i32") return ValueType(ValueType::i32);
146 else if (t.text == "i64") return ValueType(ValueType::i64);
147 else if (t.text == "f32") return ValueType(ValueType::f32);
148 else if (t.text == "f64") return ValueType(ValueType::f64);
149 else if (t.text == "funcref") return ValueType(ValueType::funcref);
150 else if (t.text == "externref") return ValueType(ValueType::externref);
151 throw Exception::Parse("unknown valtype '" + t.text + "'", {t.line, t.column});
152}
153
154std::pair<FuncType, std::map<std::string, index_t>> ParseContext::parse_functype() {
155 tok_.expect(TokenType::LParen);

Callers

nothing calls this directly

Calls 3

ValueTypeEnum · 0.85
ParseClass · 0.85
expectMethod · 0.80

Tested by

no test coverage detected