Improve error for invalid use of types as values (addresses #923).

This scripting error can now generate an error message at parse-time
instead of run-time and also includes location information.
This commit is contained in:
Jon Siwek 2012-12-18 14:31:39 -06:00
parent ea6b62f586
commit 2f0c698ed5
4 changed files with 21 additions and 2 deletions

View file

@ -233,7 +233,11 @@ NameExpr::NameExpr(ID* arg_id, bool const_init) : Expr(EXPR_NAME)
{
id = arg_id;
in_const_init = const_init;
SetType(id->Type()->Ref());
if ( id->AsType() )
SetType(new TypeType(id->AsType()));
else
SetType(id->Type()->Ref());
EventHandler* h = event_registry->Lookup(id->Name());
if ( h )