Commit d3b5cbea authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[torque] Add error message when using Structs as builtin arguments

This CL fixes a crash when Structs are used as builtin arguments.

R=tebbi@chromium.org

Bug: v8:7793
Change-Id: Ib9488cdd924894dd9a9aa9fe35f57d93894565e2
Reviewed-on: https://chromium-review.googlesource.com/c/1447774Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59238}
parent 93fbbfff
......@@ -73,10 +73,21 @@ Builtin* DeclarationVisitor::CreateBuiltin(BuiltinDeclaration* decl,
}
}
for (size_t i = 0; i < signature.types().size(); ++i) {
if (const StructType* type =
StructType::DynamicCast(signature.types()[i])) {
std::stringstream stream;
stream << "builtin '" << decl->name << "' uses the struct '"
<< type->name() << "' as argument '"
<< signature.parameter_names[i] << "'. This is not supported.";
ReportError(stream.str());
}
}
if (const StructType* struct_type =
StructType::DynamicCast(signature.return_type)) {
std::stringstream stream;
stream << "builtins (in this case" << decl->name
stream << "builtins (in this case " << decl->name
<< ") cannot return structs (in this case " << struct_type->name()
<< ")";
ReportError(stream.str());
......
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