Avail Loader
An AvailLoader is responsible for orchestrating module-level side-effects, such as those caused by adding method, abstract, and forward definitions. Also macros, A_Lexers, A_SemanticRestrictions, A_GrammaticalRestrictions, and method seals.
Author
Todd L Smith
Mark van Gulik
Types
The macro-state of the loader. During compilation from a file, a loader will ratchet between COMPILING while parsing a top-level statement, and EXECUTING_FOR_COMPILE while executing the compiled statement. Similarly, when loading from a file, the loader's phase alternates between LOADING and EXECUTING_FOR_LOAD.
Properties
The LexicalScanner used for creating tokens from source code for this AvailLoader.
A stream on which to serialize each ModuleManifestEntry when the definition actually occurs during compilation. After compilation, the bytes of this stream are written to a record whose index is captured in the A_Module.manifestEntries, and fetched from the repository and decoded and cached when needed.
The NamesIndex into which to record indexing information during actual compilation. After compilation, this is written to a record whose index is captured in the A_Module.namesIndexRecord, and fetched from the repository and decoded and cached when needed.
The currently unresolved forward method declarations.
The current loading Phase.
The A_BundleTree that this AvailLoader is using to parse its module. Start it out as the moduleHeaderBundleRoot for parsing the header, then switch it out to parse the body.
The current AvailRuntime.
The TextInterface for any fibers started by this AvailLoader.
During module compilation, this holds the top-level zero-argument block phrase that wraps the parsed statement, and is in the process of being evaluated.
A mapping from ranges where variable uses occur to ranges where the corresponding declarations occur.
Functions
Add the abstract method signature. A class is considered abstract if there are any abstract methods that haven't been overridden with definitions for it.
This is a forward declaration of a method. Insert an appropriately stubbed definition in the module's method dictionary, and add it to the list of methods needing to be declared later in this module.
The modularity scheme should prevent all inter-modular method conflicts. Precedence is specified as an array of message sets that are not allowed to be messages generating the arguments of this message. For example, <{"_+_"}, {"_+_", "_*_"}> for the "_*_" operator makes * bind tighter than +, and also groups multiple *'s left-to-right.
Add the macro definition. The precedence rules can not change after the first definition is encountered, so set them to 'no restrictions' if they're not set already.
Record a ModuleManifestEntry. Also record suitable information in the namesIndex.
Add the method definition. The precedence rules can change at any time.
Add a semantic restriction to its associated method.
Define and install a new styler based on the given stylerFunction. Install it for the given A_Bundle's method, within the current A_Module.
A variable-use was encountered, so record information about where it is, and where its associated definition is.
Access the usesToDefinitions in the action while holding the lock.
Look up the given A_String in the current module's namespace. Answer the atom associated with the string, creating the true name if necessary. A local true name always hides other true names. If isExplicitSubclassAtom is true and we're creating a new atom, add the SpecialAtom.EXPLICIT_SUBCLASSING_KEY property.
Set up the rootBundleTree and lexicalScanner for compiling the body of the module.
Clear the rootBundleTree and lexicalScanner in preparation for loading (not compiling) the body of the module.
Record a LoadingEffect to ensure it will be replayed when the module which is currently being compiled is later loaded.
Answer the list of special LoadingEffects that execute before the ordinary effects can be deserialized and executed.
Answer the list of ordinary LoadingEffects.
Record a LoadingEffect to ensure it will be replayed when the module which is currently being compiled is later loaded.
Unbind the specified method definition from this loader and runtime.
Unbind the specified macro definition from this loader and runtime.
Set a flag that indicates we are determining if the effects of running a function can be summarized, and if so into what LoadingEffects.
Answer whether the current statement can be summarized into a sequence of LoadingEffects.
Replace the boolean that indicates whether the current statement can be summarized into a sequence of LoadingEffects. It is set to true before executing a top-level statement, and set to false if an activity is performed that cannot be summarized.
Clear the flag that indicates whether we are determining if the effects of running a function can be summarized into LoadingEffects.
Helper method to style a method name. Supersedes styleStringLiteral. If the stringLiteralToken is not a well-formed method name, don't style it.
Helper method to style an ordinary string literal, i.e., one that is not also a method name.
Helper method to style a token's range in a particular named style, using the specified function to merge any style information previously attached to all or parts of the token's range.
Helper method to style a token's range in a particular named style, using the specified function to merge any style information previously attached to all or parts of the token's range.