Companion

object Companion

Properties

Link copied to clipboard

Answer all tokens belonging to the receiver or its subexpressions, lexically ordered, without positionless synthetic tokens.

Link copied to clipboard

Answer the A_Atom that this phrase is a send of. If this is a macro invocation, answer the A_Atom that the original expression, prior to macro transformation, was an apparent send of. If the phrase is neither a send nor a macro invocation, answer nil.

Link copied to clipboard

Answer the list phrase that provides arguments to this send phrase. If this is a macro invocation, these are the arguments supplied to the macro's output, which must be a send phrase.

Link copied to clipboard

Answer the tuple of argument declaration phrases of this block phrase.

Link copied to clipboard

Answer this send phrase's message bundle. If this is a macro invocation, answer the message bundle that is the one sent by the resulting send phrase.

Link copied to clipboard

Answer the declaration phrase referenced by this variable use phrase. If this phrase is a macro invocation, answer the declaration referenced by the variable use produced by the macro.

Link copied to clipboard

Answer the set of exception types that are declared by this block phrase.

Link copied to clipboard

Answer the type of the variable, constant, or argument declared by this declaration phrase.

Link copied to clipboard

If this phrase is an assignment, answer the expression that produces the value to assign. If this phrase is an expression-as-statement, answer the expression to treat as a statement. If this phrase is a super-cast, answer the expression that produces the actual value to send. If this phrase is a macro, use the above rules on the output of the macro.

Link copied to clipboard

Answer the number of expressions in this list phrase.

Link copied to clipboard

Answer the tuple of expressions in this list phrase.

Link copied to clipboard

This is an expression acting as an argument, a recursive list phrase of arguments (perhaps permuted), or a super-cast. Answer whether it either is or contains within the recursive list structure a super-cast phrase.

Link copied to clipboard

Answer the phrase producing the value to be assigned during initialization of a variable declaration. If there is no initialization expression, answer nil.

Link copied to clipboard

Answer whether this variable use is the chronologically last time its variable will be used within this block.

Link copied to clipboard

Answer whether this phrase is a macro substitution phrase.

Link copied to clipboard

Extract the last expression of this [listListPhraseDescriptor phrase. The client must ensure there is at least one, and that this is a list phrase.

Link copied to clipboard

Answer the list phrase contained within this permuted list phrase. The order of the elements is the order in which they occurred in the source.

Link copied to clipboard
Link copied to clipboard

The receiver is a macro. Answer the send that was transformed by the macro body.

Link copied to clipboard

Answer a marker phrase's marker value, which can be any AvailObject.

Link copied to clipboard

The tuple of declaration phrases accessed by this block phrase. This value is set during code generation, even if the block phrase is immutable. It should not be made visible to the Avail language.

Link copied to clipboard

The phrase that this macro phrase generated to use as its replacement.

Link copied to clipboard

Answer the permutation from a permutation list phrase. The permutation is a tuple of integers between 1 and the number of elements, where each value occurs exactly once, and the tuple is not in ascending order.

Link copied to clipboard

If this is a list phrase, answer a List of its expressions. If this is a permuted list phrase, answer its expressions after permutation, in the order that the call site expects to receive them (not the order that they appear in the code).

Link copied to clipboard

Return the phrase's expression type, which is the type of object that will be produced by this phrase.

Link copied to clipboard
Link copied to clipboard

Answer either null or the Primitive from a block phrase.

Link copied to clipboard

Answer the sequence of statements inside this sequence-as-expression phrase.

Link copied to clipboard

Answer this block phrase's starting line number in the source.

Link copied to clipboard

Answer the tuple of statement phrases in this sequence phrase.

Link copied to clipboard

Answer this block phrase's tuple of statement phrase.

Link copied to clipboard

Given a list phrase, a permuted list phrase, or a macro substitution phrase, find all macro substitution phrases at or recursively inside it (but only within the nested list structure), answering a duplicate like the original, but with the macro phrases replaced by their output phrases.

Link copied to clipboard

If this is a super cast phrase, then answer the type by which this argument should be looked up. If it is not and does not contain a super cast phrase in its recursive list phrase structure, then answer bottom. Otherwise create a (recursive) tuple type where elements that are supercasts provide their lookup types and the rest provide bottom.

Link copied to clipboard

Answer the token which was used in the construction of a variable use phrase, a declaration phrase, a literal, or a macro that resolves to one of those.

Link copied to clipboard

Answer the tuple of the one-based indices of the tokens that contributed to this phrase. The indices refer to the sent A_Bundle's tuple of parts produced by the MessageSplitter.

Link copied to clipboard

Answer the tuple of tokens that contributed to the phrase.

Link copied to clipboard

Answer the phrase that produced the type of the declaration. Answer nil if there was no such phrase.

Link copied to clipboard

Answer the variable use phrase that is used by this reference or assignment.

Functions

Link copied to clipboard
fun A_Phrase.applyStylesThen(context: CompilationContext, visitedSet: MutableSet<A_Phrase>, then: () -> Unit)

Apply styles for this phrase in the context. Apply the styles for interesting subcomponents first. After these styles have been applied, invoke the then continuation action.

Link copied to clipboard
fun A_Phrase.childrenDo(action: (A_Phrase) -> Unit)

Perform the given action for each child phrase of this phrase.

Link copied to clipboard
fun A_Phrase.childrenMap(transformer: (A_Phrase) -> A_Phrase)

Perform the given transformation for each child phrase of this phrase, writing the result of the transformation back into this phrase. This phrase must be mutable.

Link copied to clipboard

Create a new list phrase with the elements of the given list phrase appended to the ones in the receiver.

Link copied to clipboard

If the receiver is mutable, make its subobjects immutable and return it. Otherwise, make a mutable copy of the receiver and return it.

Link copied to clipboard

Create a new list phrase like the receiver, but with one more phrase added to the end of the list.

Link copied to clipboard

Emit code to push each value produced by the expressions of a list phrase or permuted list phrase.

Link copied to clipboard

Emit code to perform the effect of this phrase, leaving the operand stack the same as before these instructions.

Link copied to clipboard

Emit code to perform this phrase, leaving its result on the stack.

Link copied to clipboard

Test whether the receiver and aPhrase are effectively equivalent, for the purpose of describing ambiguous parses. Note that this is not used to determine whether the two phrases are equal.

Link copied to clipboard

Extract the Nth expression of this list. If this is a permuted list phrase, do not transform the index.

Link copied to clipboard
fun A_Phrase.flattenStatementsInto(accumulatedStatements: MutableList<A_Phrase>)

If this phrase is a sequence, take any statements within it that are also sequences, and flatten them all into one sequence, returning the List of statements. Handle first-of-sequence phrases correctly, allowing the resulting structure to be up to two layers deep.

Link copied to clipboard

Compile this block phrase into a raw function, recording within it that it was compiled within the given module.

Link copied to clipboard

Test whether this phrase has a PhraseKind that is equal to or a subkind of the given PhraseKind.

Link copied to clipboard
fun A_Phrase.statementsDo(continuation: (A_Phrase) -> Unit)

Iterate through each sequence recursively within the receiver, applying the action to each contained statement phrase.

Link copied to clipboard

Validate this phrase without also visiting its subphrases.