ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

TdwsUnit's not automatically added to script-units #422

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Not sure if this is a bug or works-as-intended. But if it's intended then there 
is some additional functionality required (or maybe i am missing something). 

I define my global functions/classes/etc in a TDWSUnit. Setting the script 
property to a TDelphiWebScript automatically adds those functions/classes/etc 
to the main script (i assume depending on coExplicitUnitUses and 
TDWSUnit.ImplicitUse settings). 

However, if any units are added to the script during compilation through the 
OnNeedUnit event then those units don't automatically inherit any TDWSUnit of 
the main script. To get it to work the units need to be explicit added with a 
"uses xxx;" line where xxx is the name of the TDWSUnit.UnitName.

It would be nice if the coExplicitUnitUses option actually extends to those 
script defined units.

if not, then at least the onNeedUnit needs some enhancement, so that i can 
define my own TSourceUnit object there that has my global TDWSUnit already 
added. This isn't currently possible, as the TSourceUnit.create() needs access 
to private properties of the main script and hence can't be created inside my 
own code.

Original issue reported on code.google.com by Fighting...@gmail.com on 20 Jun 2013 at 7:26