From a3d940ff8020ad8adb525b4ab018fcd86d08c54a Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 7 Nov 2024 15:53:01 -0800 Subject: Rename indexType -> addressType. NFC (#7060) See https://github.com/WebAssembly/memory64/pull/92 --- src/parser/parsers.h | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'src/parser/parsers.h') diff --git a/src/parser/parsers.h b/src/parser/parsers.h index 02c2e9e47..b6699aab6 100644 --- a/src/parser/parsers.h +++ b/src/parser/parsers.h @@ -47,10 +47,10 @@ template Result limits32(Ctx&); template Result limits64(Ctx&); template Result memtype(Ctx&); template -Result memtypeContinued(Ctx&, Type indexType); +Result memtypeContinued(Ctx&, Type addressType); template Result tabletype(Ctx&); template -Result tabletypeContinued(Ctx&, Type indexType); +Result tabletypeContinued(Ctx&, Type addressType); template Result globaltype(Ctx&); template Result tupleArity(Ctx&); @@ -780,45 +780,46 @@ template Result limits64(Ctx& ctx) { // note: the index type 'i32' or 'i64' is already parsed to simplify parsing of // memory abbreviations. template Result memtype(Ctx& ctx) { - Type indexType = Type::i32; + Type addressType = Type::i32; if (ctx.in.takeKeyword("i64"sv)) { - indexType = Type::i64; + addressType = Type::i64; } else { ctx.in.takeKeyword("i32"sv); } - return memtypeContinued(ctx, indexType); + return memtypeContinued(ctx, addressType); } template -Result memtypeContinued(Ctx& ctx, Type indexType) { - assert(indexType == Type::i32 || indexType == Type::i64); - auto limits = indexType == Type::i32 ? limits32(ctx) : limits64(ctx); +Result memtypeContinued(Ctx& ctx, Type addressType) { + assert(addressType == Type::i32 || addressType == Type::i64); + auto limits = addressType == Type::i32 ? limits32(ctx) : limits64(ctx); CHECK_ERR(limits); bool shared = false; if (ctx.in.takeKeyword("shared"sv)) { shared = true; } - return ctx.makeMemType(indexType, *limits, shared); + return ctx.makeMemType(addressType, *limits, shared); } // tabletype ::= (limits32 | 'i32' limits32 | 'i64' limit64) reftype template Result tabletype(Ctx& ctx) { - Type indexType = Type::i32; + Type addressType = Type::i32; if (ctx.in.takeKeyword("i64"sv)) { - indexType = Type::i64; + addressType = Type::i64; } else { ctx.in.takeKeyword("i32"sv); } - return tabletypeContinued(ctx, indexType); + return tabletypeContinued(ctx, addressType); } template -Result tabletypeContinued(Ctx& ctx, Type indexType) { - auto limits = indexType == Type::i32 ? limits32(ctx) : limits64(ctx); +Result tabletypeContinued(Ctx& ctx, + Type addressType) { + auto limits = addressType == Type::i32 ? limits32(ctx) : limits64(ctx); CHECK_ERR(limits); auto type = reftype(ctx); CHECK_ERR(type); - return ctx.makeTableType(indexType, *limits, *type); + return ctx.makeTableType(addressType, *limits, *type); } // globaltype ::= t:valtype => const t @@ -3036,9 +3037,9 @@ template MaybeResult<> table(Ctx& ctx) { auto import = inlineImport(ctx.in); CHECK_ERR(import); - auto indexType = Type::i32; + auto addressType = Type::i32; if (ctx.in.takeKeyword("i64"sv)) { - indexType = Type::i64; + addressType = Type::i64; } else { ctx.in.takeKeyword("i32"sv); } @@ -3077,10 +3078,10 @@ template MaybeResult<> table(Ctx& ctx) { if (!ctx.in.takeRParen()) { return ctx.in.err("expected end of inline elems"); } - ttype = ctx.makeTableType(indexType, ctx.getLimitsFromElems(list), *type); + ttype = ctx.makeTableType(addressType, ctx.getLimitsFromElems(list), *type); elems = std::move(list); } else { - auto tabtype = tabletypeContinued(ctx, indexType); + auto tabtype = tabletypeContinued(ctx, addressType); CHECK_ERR(tabtype); ttype = *tabtype; } @@ -3119,9 +3120,9 @@ template MaybeResult<> memory(Ctx& ctx) { auto import = inlineImport(ctx.in); CHECK_ERR(import); - auto indexType = Type::i32; + auto addressType = Type::i32; if (ctx.in.takeKeyword("i64"sv)) { - indexType = Type::i64; + addressType = Type::i64; } else { ctx.in.takeKeyword("i32"sv); } @@ -3137,10 +3138,11 @@ template MaybeResult<> memory(Ctx& ctx) { if (!ctx.in.takeRParen()) { return ctx.in.err("expected end of inline data"); } - mtype = ctx.makeMemType(indexType, ctx.getLimitsFromData(*datastr), false); + mtype = + ctx.makeMemType(addressType, ctx.getLimitsFromData(*datastr), false); data = *datastr; } else { - auto type = memtypeContinued(ctx, indexType); + auto type = memtypeContinued(ctx, addressType); CHECK_ERR(type); mtype = *type; } -- cgit v1.2.3