[wasm] Local decl parsing tweak.

R=ahaas@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1860103002

Cr-Commit-Position: refs/heads/master@{#35286}
This commit is contained in:
titzer 2016-04-06 01:57:32 -07:00 committed by Commit bot
parent 9a65c0ef03
commit e00a0c621c
2 changed files with 2 additions and 3 deletions

View File

@ -416,7 +416,6 @@ class SR_WasmDecoder : public WasmDecoder {
DecodeLocalDecls();
if (failed()) return false;
decls.decls_encoded_size = pc_offset();
decls.total_local_count = 0;
decls.local_types.reserve(local_type_vec_.size());
for (size_t pos = 0; pos < local_type_vec_.size();) {
uint32_t count = 0;
@ -425,9 +424,9 @@ class SR_WasmDecoder : public WasmDecoder {
pos++;
count++;
}
decls.total_local_count += count;
decls.local_types.push_back(std::pair<LocalType, uint32_t>(type, count));
}
decls.total_local_count = static_cast<uint32_t>(local_type_vec_.size());
return true;
}

View File

@ -2246,7 +2246,7 @@ TEST_F(LocalDeclDecoderTest, OneLocal) {
LocalTypeMap map = Expand(decls);
EXPECT_EQ(1, map.size());
EXPECT_EQ(type, map.at(0));
EXPECT_EQ(type, map[0]);
}
}