[wasm] Fix validation error for missing return statement in asm.js module.
R=mstarzinger@chromium.org,bradnelson@chromium.org LOG=Y BUG=chromium:575364 Review URL: https://codereview.chromium.org/1564313003 Cr-Commit-Position: refs/heads/master@{#33175}
This commit is contained in:
parent
b111ad2138
commit
cad2294e42
@ -127,6 +127,9 @@ void AsmTyper::VisitAsmModule(FunctionLiteral* fun) {
|
||||
|
||||
// Validate exports.
|
||||
ReturnStatement* stmt = fun->body()->last()->AsReturnStatement();
|
||||
if (stmt == nullptr) {
|
||||
FAIL(fun->body()->last(), "last statement in module is not a return");
|
||||
}
|
||||
RECURSE(VisitWithExpectation(stmt->expression(), Type::Object(),
|
||||
"expected object export"));
|
||||
}
|
||||
|
11
test/mjsunit/regress/regress-575364.js
Normal file
11
test/mjsunit/regress/regress-575364.js
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm
|
||||
|
||||
function f() {
|
||||
"use asm";
|
||||
|
||||
}
|
||||
assertThrows(function() { WASM.asmCompileRun(f.toString()); });
|
Loading…
Reference in New Issue
Block a user