I'm overriding TRTTIEnvironment and am implementing function FindUnknownName(). I'd like to return a Symbol that is already exposed to the program by ExposeInstanceToUnit(). In some of my scripts the property of a global object is in the script but without the object. Eg. Global object "User" has property UserName. "UserName" is in the script NOT "User.UserName".
The code in FindUnknownName is
sym := compiler.CurrentProg.Table.FindSymbol("User", cvMagic);
result := TPropertySymbol(TClassSymbol(sym.Typ).Members.FindSymbol(name, cvMagic)).ReadSym;
Problem here is that it returns the class Symbol for the property and since it is not a class property it will AV.
Any help getting the property symbol for the instance of User greatly appreciated.