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

Method parse_typesection

src/lib/parse/ParseContext.cpp:127–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125// ── Type section ──────────────────────────────────────────────────────────────
126
127void ParseContext::parse_typesection() {
128 tok_.expect(TokenType::LParen);
129 tok_.expect_keyword("type");
130 // optional Id
131 if (tok_.peek().type == TokenType::Id) {
132 std::string id = tok_.consume().text;
133 if (type_map_.contains(id))
134 throw Exception::Parse("duplicated type id '" + id + "'", tok_.location());
135 type_map_[id] = types_.size();
136 }
137 types_.emplace_back(parse_functype());
138 tok_.expect(TokenType::RParen);
139}
140
141// ── Valtype / FuncType / type sub-parsers ─────────────────────────────────────
142

Callers

nothing calls this directly

Calls 6

ParseClass · 0.85
expectMethod · 0.80
expect_keywordMethod · 0.80
peekMethod · 0.80
consumeMethod · 0.45
locationMethod · 0.45

Tested by

no test coverage detected