You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Faster access when resolving names - instead of having to parse the code again, we can simply reuse what lang.reflect.ClassParser (or the XP Compiler) have already extracted and put there there. Imports are used when resolving types inside apidoc and inside eval keys for annotations.
Functionality
Imports will be stored under a key named "use" (matching the use statement). It contains a map of aliases to qualified names.
Example
namespace org\example;
use util\Date;
use lang\PrimitiveasP;
use org\example\nodes\{Node, VariableasVar};
classT { ... }
XP Compiler may optionally be extended to track imports, speeding up reflective access. Currently, it emits use statements which can then later on be tokenized again.
Scope of Change
This RFC suggests storing imports in
xp::$meta
.Rationale
Faster access when resolving names - instead of having to parse the code again, we can simply reuse what
lang.reflect.ClassParser
(or the XP Compiler) have already extracted and put there there. Imports are used when resolving types inside apidoc and insideeval
keys for annotations.Functionality
Imports will be stored under a key named "use" (matching the
use
statement). It contains a map of aliases to qualified names.Example
This will produce the following:
Security considerations
None
Speed impact
Slightly slower
Dependencies
XP Compiler may optionally be extended to track imports, speeding up reflective access. Currently, it emits
use
statements which can then later on be tokenized again.Related documents
The text was updated successfully, but these errors were encountered: