- added automatic type deduction capabilities for local variables. If you type 'let variable = value;' the type of 'variable' will be deduced from the given value. This is mostly of interest for type casting pointers, because 'let p = Classtype(objectvar);' does not require writing the class type name twice.

This commit is contained in:
Christoph Oelckers 2016-12-05 13:24:42 +01:00
commit f722967abe
10 changed files with 42 additions and 3 deletions

View file

@ -1449,6 +1449,10 @@ PType *ZCCCompiler::DetermineType(PType *outertype, ZCC_TreeNode *field, FName n
retval = TypeSound;
break;
case ZCC_Let:
retval = TypeAuto;
break;
case ZCC_UserType:
// statelabel et.al. are not tokens - there really is no need to, it works just as well as an identifier. Maybe the same should be done for some other types, too?
switch (btype->UserType->Id)