Only construct zero value of built-in type if the argument count is zero
This commit is contained in:
parent
7bca803136
commit
97fb066e38
1 changed files with 10 additions and 1 deletions
|
|
@ -511,7 +511,16 @@ namespace pslang::interpreter
|
||||||
if (identifier)
|
if (identifier)
|
||||||
{
|
{
|
||||||
if (auto type = types::builtin_type(identifier->name))
|
if (auto type = types::builtin_type(identifier->name))
|
||||||
return zero_value(context, *type);
|
{
|
||||||
|
if (function_call.arguments.empty())
|
||||||
|
return zero_value(context, *type);
|
||||||
|
|
||||||
|
std::ostringstream os;
|
||||||
|
os << "Cannot create built-in type ";
|
||||||
|
types::print(os, *type);
|
||||||
|
os << ": expected 0 arguments, but got " << function_call.arguments.size();
|
||||||
|
throw std::runtime_error(os.str());
|
||||||
|
}
|
||||||
|
|
||||||
for (auto it = context.scope_stack.rbegin(); it != context.scope_stack.rend(); ++it)
|
for (auto it = context.scope_stack.rbegin(); it != context.scope_stack.rend(); ++it)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue