Uses file not found should fire event
Brought to you by:
hhernler,
mackermann
The new support for uses should be slightly extended.
Currently, if in a script I have "uses somescript;"
then it errors with not finding the script. This is
correct.
Here is the code that causes it...
procedure Tdws2Compiler.ReadUses;
[...]
if z < 0 then
FMsgs.AddCompilerStop(FTok.HotPos,
Format(CPE_UnknownUnit,[Names[x]]));
[...]
end;
I propose that it be extended to fire the OnInclude (or
an OnUses) event if it is not found. If the script is
not returned or event not assigned *then* the error
message should be raised.
I would like for my program to dynamically load
additional scripts as needed through the uses construct.
Logged In: YES
user_id=382292
A complete recompile must be done with the added unit
(rebuild of the unit-trees). And if we introcude OnInclude
we should introduce OnUnknownSymbol too.
But I think a better way is to have a more detailed
(accessible) error description when compilation failes. I
saw some code, that provides information about missing field
declarations.
Andreas
Logged In: YES
user_id=193173
The exceptions that get raised for missing field information
is used for ClassCompletion. It has two error types, one for
missing fields or Get/Set methods and one for missing
implementations of the Get/Set methods.
See the new demo under Demos\IDEDemos\ClassCompletion for
how it works.
What would OnUnknownSymbol do? Would that fire when a class
called "TFubar" was referenced but the symbol was
undeclared? Is that the thinking?
I was thinking (at least short-term) that it needs to behave
more like includes. I want to use a script file in multiple
scripts where includes break it because the types are
redeclared.