Commit cad2294e authored by titzer's avatar titzer Committed by Commit bot

[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}
parent b111ad21
......@@ -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"));
}
......
// 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()); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment