Menu

#12 Cannot handle function of recursively defined datatype

v1.0_(example)
open
nobody
None
5
2015-05-06
2015-05-06
No

Generates an exception trying to use the recursive datatype:

type TContinue = function(_:TVoid):TContinue of object;

A dirty fix in TCodeParser.GetType solved it but is not a good solution

 if Ident is TClassReferenceType then
  //if it is a class-reference, return the referenced class
  Result := GetType(TClassReferenceType(Ident).BaseClass)
 else
  if Ident is TFunctionType then begin
   //if it is a function-type, return the return type of the function
  if (TFunctionType(Ident).ReturnType is TIdentType)
    and (TIdentType(TFunctionType(Ident).ReturnType).TheType is TFunctionType)
  then Result := TType(Ident) // avoid recursive function types
  else
   Result := GetType(TFunctionType(Ident).ReturnType)
  end else
   Result := TType(Ident);      //return just the type itself

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.