Expression and statements

From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)

Introduced properties

private var _after_flow_context: nullable FlowContext

nitc :: AExpr :: _after_flow_context

The flow after the full evaluation of the expression/statement
private var _comprehension: nullable AArrayExpr

nitc :: AExpr :: _comprehension

Is non-null if self is a leaf of a comprehension array construction.
private var _implicit_cast_to: nullable MType

nitc :: AExpr :: _implicit_cast_to

If required, the following implicit cast .as(XXX)
private var _is_typed: Bool

nitc :: AExpr :: _is_typed

Is the statement correctly typed?
private var _mtype: nullable MType

nitc :: AExpr :: _mtype

The static type of the expression.
private var _vararg_decl: Int

nitc :: AExpr :: _vararg_decl

It indicates the number of arguments collected as a vararg.
private var _variable_cache: nullable Variable

nitc :: AExpr :: _variable_cache

private fun accept_explain_assert(v: ExplainAssertVisitor)

nitc :: AExpr :: accept_explain_assert

Fill v to explain this node if the parent assert fails
fun add(expr: AExpr)

nitc :: AExpr :: add

Add expr at the end of the block
fun after_flow_context: nullable FlowContext

nitc :: AExpr :: after_flow_context

The flow after the full evaluation of the expression/statement
protected fun after_flow_context=(after_flow_context: nullable FlowContext)

nitc :: AExpr :: after_flow_context=

The flow after the full evaluation of the expression/statement
fun allocate_mtype(v: RapidTypeVisitor)

nitc :: AExpr :: allocate_mtype

Make the mtype of the expression live
fun as_id: nullable String

nitc :: AExpr :: as_id

Get self as a single identifier.
fun as_int: nullable Int

nitc :: AExpr :: as_int

Get self as an Int.
fun as_string: nullable String

nitc :: AExpr :: as_string

Get self as a String.
fun comprehension: nullable AArrayExpr

nitc :: AExpr :: comprehension

Is non-null if self is a leaf of a comprehension array construction.
protected fun comprehension=(comprehension: nullable AArrayExpr)

nitc :: AExpr :: comprehension=

Is non-null if self is a leaf of a comprehension array construction.
fun detach_with_placeholder: AExpr

nitc :: AExpr :: detach_with_placeholder

The detach method completely remove the node in the parent.
fun do_typing(modelbuilder: ModelBuilder, visited_mpropdef: MPropDef)

nitc :: AExpr :: do_typing

Type the expression as if located in visited_mpropdef
private fun expr(v: JavaCompilerVisitor): nullable RuntimeVariable

nitc :: AExpr :: expr

Try to compile self as an expression
private fun expr(v: AbstractCompilerVisitor): nullable RuntimeVariable

nitc :: AExpr :: expr

Try to compile self as an expression
protected fun expr(v: NaiveInterpreter): nullable Instance

nitc :: AExpr :: expr

Evaluate the node as a possible expression.
fun generate_basic_blocks(ssa: SSA, old_block: BasicBlock): BasicBlock

nitc :: AExpr :: generate_basic_blocks

Generate recursively basic block for this expression
fun implicit_cast_to: nullable MType

nitc :: AExpr :: implicit_cast_to

If required, the following implicit cast .as(XXX)
protected fun implicit_cast_to=(implicit_cast_to: nullable MType)

nitc :: AExpr :: implicit_cast_to=

If required, the following implicit cast .as(XXX)
fun is_typed: Bool

nitc :: AExpr :: is_typed

Is the statement correctly typed?
protected fun is_typed=(is_typed: Bool)

nitc :: AExpr :: is_typed=

Is the statement correctly typed?
fun its_variable: nullable Variable

nitc :: AExpr :: its_variable

Return the variable read (if any)
fun make_var_read: AVarExpr

nitc :: AExpr :: make_var_read

Return a new variable read that contains the value of the expression
fun mtype: nullable MType

nitc :: AExpr :: mtype

The static type of the expression.
protected fun mtype=(mtype: nullable MType)

nitc :: AExpr :: mtype=

The static type of the expression.
fun numbering(v: VirtualMachine, position: Int): Int

nitc :: AExpr :: numbering

Give a position to each variable declared in the node.
private fun stmt(v: JavaCompilerVisitor)

nitc :: AExpr :: stmt

Try to compile self as a statement
private fun stmt(v: AbstractCompilerVisitor)

nitc :: AExpr :: stmt

Try to compile self as a statement
protected fun stmt(v: NaiveInterpreter)

nitc :: AExpr :: stmt

Evaluate the node as a statement.
fun vararg_decl: Int

nitc :: AExpr :: vararg_decl

It indicates the number of arguments collected as a vararg.
protected fun vararg_decl=(vararg_decl: Int)

nitc :: AExpr :: vararg_decl=

It indicates the number of arguments collected as a vararg.
private fun variable_cache: nullable Variable

nitc :: AExpr :: variable_cache

private fun variable_cache=(variable_cache: nullable Variable)

nitc :: AExpr :: variable_cache=

private fun warn_parentheses(v: SimpleMiscVisitor)

nitc :: AExpr :: warn_parentheses

Warn in case of superfluous parentheses

Redefined properties

redef type SELF: AExpr

nitc $ AExpr :: SELF

Type of this instance, automatically specialized in every class
redef fun decorate_tag(v: HtmlightVisitor, res: HTMLTag, token: Token): nullable HInfoBox

nitc :: htmlight $ AExpr :: decorate_tag

Add aditionnal information on a child-token and return an additionnal HInfoBox on it
redef fun dump_info(v: ASTDump): String

nitc :: typing $ AExpr :: dump_info

Information to display on a node
redef fun replace_with(other: ANode)

nitc :: transform $ AExpr :: replace_with

Replace itself with an other node in the AST

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _after_flow_context: nullable FlowContext

nitc :: AExpr :: _after_flow_context

The flow after the full evaluation of the expression/statement
private var _comprehension: nullable AArrayExpr

nitc :: AExpr :: _comprehension

Is non-null if self is a leaf of a comprehension array construction.
private var _first_location: nullable Location

nitc :: Prod :: _first_location

Location on the first token after the start of a production
private var _first_token: nullable Token

nitc :: Prod :: _first_token

The first token of the production in the AST
private var _force_block: Bool

nitc :: ANode :: _force_block

Force self to be rendered as a block.
private var _force_inline: Bool

nitc :: ANode :: _force_inline

Force self to be rendered as a line.
private var _implicit_cast_to: nullable MType

nitc :: AExpr :: _implicit_cast_to

If required, the following implicit cast .as(XXX)
private var _is_broken: Bool

nitc :: ANode :: _is_broken

The indication that the node did not pass some semantic verifications.
private var _is_typed: Bool

nitc :: AExpr :: _is_typed

Is the statement correctly typed?
private var _last_token: nullable Token

nitc :: Prod :: _last_token

The last token of the production in the AST
private var _location: Location

nitc :: ANode :: _location

Location is set during AST building. Once built, location can not be null.
private var _mtype: nullable MType

nitc :: AExpr :: _mtype

The static type of the expression.
private var _n_annotations: nullable AAnnotations

nitc :: Prod :: _n_annotations

All the annotations attached directly to the node
private var _parent: nullable ANode

nitc :: ANode :: _parent

Parent of the node in the AST
private var _vararg_decl: Int

nitc :: AExpr :: _vararg_decl

It indicates the number of arguments collected as a vararg.
private var _variable_cache: nullable Variable

nitc :: AExpr :: _variable_cache

private fun accept_explain_assert(v: ExplainAssertVisitor)

nitc :: AExpr :: accept_explain_assert

Fill v to explain this node if the parent assert fails
fun accept_forward_analysis(v: ForwardAnalysis)

nitc :: ANode :: accept_forward_analysis

Apply the forward analysis v to self.
private abstract fun accept_pretty_printer(v: PrettyPrinterVisitor)

nitc :: ANode :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
fun accept_reaching_defs(v: ReachingDefsAnalysis)

nitc :: ANode :: accept_reaching_defs

Apply a ReachingDefsAnalysis to self.
fun add(expr: AExpr)

nitc :: AExpr :: add

Add expr at the end of the block
fun after_flow_context: nullable FlowContext

nitc :: AExpr :: after_flow_context

The flow after the full evaluation of the expression/statement
protected fun after_flow_context=(after_flow_context: nullable FlowContext)

nitc :: AExpr :: after_flow_context=

The flow after the full evaluation of the expression/statement
fun allocate_mtype(v: RapidTypeVisitor)

nitc :: AExpr :: allocate_mtype

Make the mtype of the expression live
fun as_id: nullable String

nitc :: AExpr :: as_id

Get self as a single identifier.
fun as_int: nullable Int

nitc :: AExpr :: as_int

Get self as an Int.
fun as_string: nullable String

nitc :: AExpr :: as_string

Get self as a String.
private fun bad_expr_message(child: AExpr): nullable String

nitc :: ANode :: bad_expr_message

An additional information message to explain the role of a child expression.
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
abstract fun clone: SELF

core :: Cloneable :: clone

Duplicate self
fun collect_annotations_by_name(name: String): Array[AAnnotation]

nitc :: ANode :: collect_annotations_by_name

Do a deep search and return an array of node that are annotated
private fun collect_comments: Array[TComment]

nitc :: Prod :: collect_comments

Collect all TComment contained in the production
private abstract fun collect_length: Int

nitc :: ANode :: collect_length

Collect the length (in Char) of the node.
fun collect_text: String

nitc :: Prod :: collect_text

Join the text of all visited tokens
fun collect_tokens_by_text(text: String): Array[Token]

nitc :: ANode :: collect_tokens_by_text

Do a deep search and return an array of tokens that match a given text
fun common_parent(other: ANode): nullable ANode

nitc :: ANode :: common_parent

The most specific common parent between self and other
fun comprehension: nullable AArrayExpr

nitc :: AExpr :: comprehension

Is non-null if self is a leaf of a comprehension array construction.
protected fun comprehension=(comprehension: nullable AArrayExpr)

nitc :: AExpr :: comprehension=

Is non-null if self is a leaf of a comprehension array construction.
fun debug(message: String)

nitc :: ANode :: debug

Display a message for the colored location of the node
protected fun decorate_tag(v: HtmlightVisitor, res: HTMLTag, token: Token): nullable HInfoBox

nitc :: ANode :: decorate_tag

Add aditionnal information on a child-token and return an additionnal HInfoBox on it
fun depth: Int

nitc :: ANode :: depth

Number of nodes between self and the root of the AST
fun detach

nitc :: ANode :: detach

Detach a node from its parent
fun detach_with_placeholder: AExpr

nitc :: AExpr :: detach_with_placeholder

The detach method completely remove the node in the parent.
private fun do_cloneable(v: CloneVisitor)

nitc :: ANode :: do_cloneable

fun do_typing(modelbuilder: ModelBuilder, visited_mpropdef: MPropDef)

nitc :: AExpr :: do_typing

Type the expression as if located in visited_mpropdef
fun dump_info(v: ASTDump): String

nitc :: ANode :: dump_info

Information to display on a node
fun dump_tree(display_structural: nullable Bool, display_line: nullable Bool)

nitc :: ANode :: dump_tree

Write the subtree on stdout.
private fun expr(v: AbstractCompilerVisitor): nullable RuntimeVariable

nitc :: AExpr :: expr

Try to compile self as an expression
private fun expr(v: JavaCompilerVisitor): nullable RuntimeVariable

nitc :: AExpr :: expr

Try to compile self as an expression
protected fun expr(v: NaiveInterpreter): nullable Instance

nitc :: AExpr :: expr

Evaluate the node as a possible expression.
fun fatal(v: NaiveInterpreter, message: String)

nitc :: ANode :: fatal

Aborts the program with a message
fun first_location: nullable Location

nitc :: Prod :: first_location

Location on the first token after the start of a production
protected fun first_location=(first_location: nullable Location)

nitc :: Prod :: first_location=

Location on the first token after the start of a production
fun first_token: nullable Token

nitc :: Prod :: first_token

The first token of the production in the AST
protected fun first_token=(first_token: nullable Token)

nitc :: Prod :: first_token=

The first token of the production in the AST
private fun force_block: Bool

nitc :: ANode :: force_block

Force self to be rendered as a block.
private fun force_block=(force_block: Bool)

nitc :: ANode :: force_block=

Force self to be rendered as a block.
private fun force_inline: Bool

nitc :: ANode :: force_inline

Force self to be rendered as a line.
private fun force_inline=(force_inline: Bool)

nitc :: ANode :: force_inline=

Force self to be rendered as a line.
fun generate_basic_blocks(ssa: SSA, old_block: BasicBlock): BasicBlock

nitc :: AExpr :: generate_basic_blocks

Generate recursively basic block for this expression
fun get_annotations(name: String): Array[AAnnotation]

nitc :: Prod :: get_annotations

Return all its annotations of a given name in the order of their declaration
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun get_single_annotation(name: String, modelbuilder: ModelBuilder): nullable AAnnotation

nitc :: Prod :: get_single_annotation

Try to get its single annotation with a given name
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun hot_location: Location

nitc :: ANode :: hot_location

The location of the important part of the node (identifier or whatever)
fun implicit_cast_to: nullable MType

nitc :: AExpr :: implicit_cast_to

If required, the following implicit cast .as(XXX)
protected fun implicit_cast_to=(implicit_cast_to: nullable MType)

nitc :: AExpr :: implicit_cast_to=

If required, the following implicit cast .as(XXX)
fun infobox(v: HtmlightVisitor): nullable HInfoBox

nitc :: ANode :: infobox

Return a optional infobox
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_block: Bool

nitc :: Prod :: is_block

Is the production contained in full block of line?
fun is_broken: Bool

nitc :: ANode :: is_broken

The indication that the node did not pass some semantic verifications.
fun is_broken=(is_broken: Bool)

nitc :: ANode :: is_broken=

The indication that the node did not pass some semantic verifications.
private fun is_inlinable: Bool

nitc :: ANode :: is_inlinable

Is self printable in one line?
private fun is_noserialize: Bool

nitc :: ANode :: is_noserialize

Is this node annotated to not be made serializable?
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private fun is_serialize: Bool

nitc :: ANode :: is_serialize

Is this node annotated to be made serializable?
fun is_span: Bool

nitc :: Prod :: is_span

Is the production a part of a single line (without being a block)
fun is_structural: Bool

nitc :: ANode :: is_structural

Is self a token or a pure-structural production like AQId?
fun is_typed: Bool

nitc :: AExpr :: is_typed

Is the statement correctly typed?
protected fun is_typed=(is_typed: Bool)

nitc :: AExpr :: is_typed=

Is the statement correctly typed?
fun its_variable: nullable Variable

nitc :: AExpr :: its_variable

Return the variable read (if any)
fun last_token: nullable Token

nitc :: Prod :: last_token

The last token of the production in the AST
protected fun last_token=(last_token: nullable Token)

nitc :: Prod :: last_token=

The last token of the production in the AST
fun location: Location

nitc :: ANode :: location

Location is set during AST building. Once built, location can not be null.
fun location=(location: Location)

nitc :: ANode :: location=

Location is set during AST building. Once built, location can not be null.
protected fun make_tag(v: HtmlightVisitor): nullable HTMLTag

nitc :: ANode :: make_tag

Optionally creates a tag that encapsulate the AST element on HTML rendering
fun make_var_read: AVarExpr

nitc :: AExpr :: make_var_read

Return a new variable read that contains the value of the expression
fun mtype: nullable MType

nitc :: AExpr :: mtype

The static type of the expression.
protected fun mtype=(mtype: nullable MType)

nitc :: AExpr :: mtype=

The static type of the expression.
private fun must_be_block: Bool

nitc :: ANode :: must_be_block

Does self have to be rendered as a block?
private fun must_be_inline: Bool

nitc :: ANode :: must_be_inline

Does self have be rendered as a line?
fun n_annotations: nullable AAnnotations

nitc :: Prod :: n_annotations

All the annotations attached directly to the node
fun n_annotations=(n_annotations: nullable AAnnotations)

nitc :: Prod :: n_annotations=

All the annotations attached directly to the node
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
fun numbering(v: VirtualMachine, position: Int): Int

nitc :: AExpr :: numbering

Give a position to each variable declared in the node.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun parent: nullable ANode

nitc :: ANode :: parent

Parent of the node in the AST
protected fun parent=(parent: nullable ANode)

nitc :: ANode :: parent=

Parent of the node in the AST
fun parentize_tokens

nitc :: ANode :: parentize_tokens

Visit the AST and computes advanced AST attributes on Tokens and Prod
private abstract fun replace_child(old_child: ANode, new_child: nullable ANode)

nitc :: ANode :: replace_child

Replace a child with an other node in the AST
fun replace_clone

nitc :: ANode :: replace_clone

Create a new clone of self
fun replace_with(node: ANode)

nitc :: ANode :: replace_with

Replace itself with an other node in the AST
fun root: ANode

nitc :: ANode :: root

The topmost ancestor of the element
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
private fun start_token: nullable Token

nitc :: Prod :: start_token

The token where the production really start (skipping ADoc).
protected fun stmt(v: NaiveInterpreter)

nitc :: AExpr :: stmt

Evaluate the node as a statement.
private fun stmt(v: JavaCompilerVisitor)

nitc :: AExpr :: stmt

Try to compile self as a statement
private fun stmt(v: AbstractCompilerVisitor)

nitc :: AExpr :: stmt

Try to compile self as a statement
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun to_xml: HTMLTag

nitc :: Prod :: to_xml

A XML representation of the AST
fun validate

nitc :: ANode :: validate

Recursively validate a AST node.
fun vararg_decl: Int

nitc :: AExpr :: vararg_decl

It indicates the number of arguments collected as a vararg.
protected fun vararg_decl=(vararg_decl: Int)

nitc :: AExpr :: vararg_decl=

It indicates the number of arguments collected as a vararg.
private fun variable_cache: nullable Variable

nitc :: AExpr :: variable_cache

private fun variable_cache=(variable_cache: nullable Variable)

nitc :: AExpr :: variable_cache=

abstract fun visit_all(v: Visitor)

nitc :: ANode :: visit_all

Visit all nodes in order.
private fun warn_parentheses(v: SimpleMiscVisitor)

nitc :: AExpr :: warn_parentheses

Warn in case of superfluous parentheses
private abstract fun was_inline: Bool

nitc :: ANode :: was_inline

Does self was written in one line before transformation?
package_diagram nitc::AExpr AExpr nitc::Prod Prod nitc::AExpr->nitc::Prod nitc::ANode ANode nitc::Prod->nitc::ANode ...nitc::ANode ... ...nitc::ANode->nitc::ANode nitc::AExpr... ... nitc::AExpr...->nitc::AExpr

Ancestors

abstract class ANode

nitc :: ANode

Root of the AST class-hierarchy
interface Cloneable

core :: Cloneable

Something that can be cloned
interface Object

core :: Object

The root of the class hierarchy.

Parents

abstract class Prod

nitc :: Prod

Ancestor of all productions

Children

class AAbortExpr

nitc :: AAbortExpr

An abort statement
class AArrayExpr

nitc :: AArrayExpr

A literal array. eg. [x,y,z]
class AAsCastForm

nitc :: AAsCastForm

A cast, against a type or not null
class AAssertExpr

nitc :: AAssertExpr

An assert statement
abstract class AAssignFormExpr

nitc :: AAssignFormExpr

Whatever is a simple assignment. eg = something
class AAtExpr

nitc :: AAtExpr

A special expression that encapsulate an annotation
abstract class AAttrFormExpr

nitc :: AAttrFormExpr

Whatever is a old-style attribute access
private class ABinOpHelper

nitc :: ABinOpHelper

Used to factorize work on Or, And, Implies and Binop expressions.
class ABlockExpr

nitc :: ABlockExpr

A sequence of AExpr (usually statements)
abstract class ABoolExpr

nitc :: ABoolExpr

Something that is boolean expression
class ACharExpr

nitc :: ACharExpr

A character literal
class ADebugTypeExpr

nitc :: ADebugTypeExpr

A special expression to debug types
abstract class AEscapeExpr

nitc :: AEscapeExpr

A break or a continue
class AFloatExpr

nitc :: AFloatExpr

A float literal
class AIfExpr

nitc :: AIfExpr

A if statement
class AIfexprExpr

nitc :: AIfexprExpr

A if expression (ternary conditional). eg. if true then 1 else 0
class AIntegerExpr

nitc :: AIntegerExpr

An integer literal
private class ALoopHelper

nitc :: ALoopHelper

Used to factorize work on loops.
class AManyExpr

nitc :: AManyExpr

A list of expression separated with commas (arguments for instance)
class AMethidExpr

nitc :: AMethidExpr

A special expression that encapsulates a method identifier
class ANamedargExpr

nitc :: ANamedargExpr

An named notation used to pass an expression by name in a parameter
class ANewExpr

nitc :: ANewExpr

An explicit instantiation. eg new T
class ANullExpr

nitc :: ANullExpr

A null literal constant
class AOnceExpr

nitc :: AOnceExpr

A once expression. eg once x
class AParExpr

nitc :: AParExpr

A simple parenthesis. eg (x)
class APlaceholderExpr

nitc :: APlaceholderExpr

A placeholder for a AExpr node
abstract class ARangeExpr

nitc :: ARangeExpr

A literal range, open or closed
abstract class AReassignFormExpr

nitc :: AReassignFormExpr

Whatever is a combined assignment. eg += something
class ASafeExpr

nitc :: ASafeExpr

A receiver with a ? suffix used in safe call operator.
class ASelfExpr

nitc :: ASelfExpr

A read of self
abstract class ASendExpr

nitc :: ASendExpr

A polymorphic invocation of a method
class ASuperExpr

nitc :: ASuperExpr

A call to super. OR a call of a super-constructor
class ATypeExpr

nitc :: ATypeExpr

A special expression that encapsulates a static type
abstract class AVarFormExpr

nitc :: AVarFormExpr

Whatever is an access to a local variable
class AVarargExpr

nitc :: AVarargExpr

An ellipsis notation used to pass an expression as it, in a vararg parameter
class AVardeclExpr

nitc :: AVardeclExpr

A declaration of a local variable. eg var x: X = y
class AWithExpr

nitc :: AWithExpr

A with statement
class AYieldExpr

nitc :: AYieldExpr

A yield statement. eg yield x
class AugmentedStringFormExpr

nitc :: AugmentedStringFormExpr

Any kind of string form with augmentations from prefixes or suffixes

Descendants

class AAmpExpr

nitc :: AAmpExpr

A & expression
class AAndExpr

nitc :: AAndExpr

A and expression
class AAsCastExpr

nitc :: AAsCastExpr

A type cast. eg x.as(T)
class AAsNotnullExpr

nitc :: AAsNotnullExpr

A as-not-null cast. eg x.as(not null)
class AAttrAssignExpr

nitc :: AAttrAssignExpr

The assignment of an attribute. eg x._a=y
class AAttrExpr

nitc :: AAttrExpr

The read of an attribute. eg x._a
class AAttrReassignExpr

nitc :: AAttrReassignExpr

A complex attribute assignment. eg x._a+=y
abstract class ABinBoolExpr

nitc :: ABinBoolExpr

Something that is binary boolean expression
abstract class ABinopExpr

nitc :: ABinopExpr

A binary operation on a method
class ABraAssignExpr

nitc :: ABraAssignExpr

A setter call of the bracket operator. eg x[y,z]=t
class ABraExpr

nitc :: ABraExpr

A call of the brackets operator. eg x[y,z]
abstract class ABraFormExpr

nitc :: ABraFormExpr

Whatever looks-like a call of the brackets [] operator.
class ABraReassignExpr

nitc :: ABraReassignExpr

A complex setter call of the bracket operator. eg x[y,z]+=t
class ABreakExpr

nitc :: ABreakExpr

A break statement.
class ACallAssignExpr

nitc :: ACallAssignExpr

A setter call with a standard method-name and any number of arguments. eg x.m(y)=z. OR just a simple assignment.
class ACallExpr

nitc :: ACallExpr

A call with a standard method-name and any number of arguments. eg x.m(y). OR just a simple id
abstract class ACallFormExpr

nitc :: ACallFormExpr

Whatever looks-like a call with a standard method and any number of arguments.
class ACallReassignExpr

nitc :: ACallReassignExpr

A complex setter call with a standard method-name and any number of arguments. eg x.m(y)+=z. OR just a simple complex assignment.
class ACallrefExpr

nitc :: ACallrefExpr

A reference to a method with a captured receiver. eg. &x.foo or just &foo is self is captured.
class ACaretExpr

nitc :: ACaretExpr

A ^ expression
class AContinueExpr

nitc :: AContinueExpr

A continue statement
class ACrangeExpr

nitc :: ACrangeExpr

A closed literal range. eg [x..y]
class ADoExpr

nitc :: ADoExpr

A do statement
class AEndStringExpr

nitc :: AEndStringExpr

The end of a superstrng. eg }abc"
class AEqExpr

nitc :: AEqExpr

A == expression
class AEqFormExpr

nitc :: AEqFormExpr

A == or a != expression
class AFalseExpr

nitc :: AFalseExpr

A false boolean literal constant
class AForExpr

nitc :: AForExpr

A for statement
class AGeExpr

nitc :: AGeExpr

A >= expression
class AGgExpr

nitc :: AGgExpr

A >> expression
class AGtExpr

nitc :: AGtExpr

A > expression
class AImplicitSelfExpr

nitc :: AImplicitSelfExpr

When there is no explicit receiver, self is implicit
class AImpliesExpr

nitc :: AImpliesExpr

A implies expression
class AInitExpr

nitc :: AInitExpr

A call to the init constructor.
class AIsaExpr

nitc :: AIsaExpr

A type-ckeck expression. eg x isa T
class AIssetAttrExpr

nitc :: AIssetAttrExpr

A is-set check of old-style attributes. eg isset x._a
class ALeExpr

nitc :: ALeExpr

A <= expression
class ALlExpr

nitc :: ALlExpr

A << expression
class ALoopExpr

nitc :: ALoopExpr

A loop statement
class ALtExpr

nitc :: ALtExpr

A < expression
class AMidStringExpr

nitc :: AMidStringExpr

The middle of a superstring. eg }abc{
class AMinusExpr

nitc :: AMinusExpr

A - expression
class ANeExpr

nitc :: ANeExpr

A != expression
class ANotExpr

nitc :: ANotExpr

A not expression
class AOrElseExpr

nitc :: AOrElseExpr

A or else expression
class AOrExpr

nitc :: AOrExpr

A or expression
class AOrangeExpr

nitc :: AOrangeExpr

An open literal range. eg [x..y[
class APercentExpr

nitc :: APercentExpr

A % expression
class APipeExpr

nitc :: APipeExpr

A | expression
class APlusExpr

nitc :: APlusExpr

A + expression
class AReturnExpr

nitc :: AReturnExpr

A return statement. eg return x
abstract class ASendReassignFormExpr

nitc :: ASendReassignFormExpr

A complex setter call (standard or brackets)
class ASlashExpr

nitc :: ASlashExpr

A / expression
class AStarExpr

nitc :: AStarExpr

A * expression
class AStarshipExpr

nitc :: AStarshipExpr

A <=> expression
class AStarstarExpr

nitc :: AStarstarExpr

A ** expression
class AStartStringExpr

nitc :: AStartStringExpr

The start of a superstring. eg "abc{
class AStringExpr

nitc :: AStringExpr

A simple string. eg. "abc"
abstract class AStringFormExpr

nitc :: AStringFormExpr

A string literal
class ASuperstringExpr

nitc :: ASuperstringExpr

A superstring literal. eg "a{x}b{y}c"
class ATrueExpr

nitc :: ATrueExpr

A true boolean literal constant
class AUminusExpr

nitc :: AUminusExpr

A unary minus expression. eg -x
abstract class AUnaryopExpr

nitc :: AUnaryopExpr

A unary operation on a method
class AUplusExpr

nitc :: AUplusExpr

A unary plus expression. eg +x
class AUtildeExpr

nitc :: AUtildeExpr

A unary ~ expression
class AVarAssignExpr

nitc :: AVarAssignExpr

A local variable simple assignment access
class AVarExpr

nitc :: AVarExpr

A local variable read access.
class AVarReassignExpr

nitc :: AVarReassignExpr

A local variable complex assignment access
class AWhileExpr

nitc :: AWhileExpr

A while statement

Class definitions

nitc $ AExpr
# Expression and statements
# From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
abstract class AExpr
	super Prod
end
src/parser/parser_nodes.nit:1840,1--1844,3

nitc :: parser_work $ AExpr
redef class AExpr

	# Get `self` as a single identifier.
	# Return null if not a single identifier.
	fun as_id: nullable String
	do
		if self isa AMethidExpr then
			return self.collect_text
		end
		if not self isa ACallExpr then return null
		if not self.n_expr isa AImplicitSelfExpr then return null
		if not self.n_args.n_exprs.is_empty then return null
		return self.n_qid.n_id.text
	end
end
src/parser/parser_work.nit:302,1--316,3

nitc :: simple_misc_analysis $ AExpr
redef class AExpr
	# Warn in case of superfluous parentheses
	private fun warn_parentheses(v: SimpleMiscVisitor) do end
end
src/frontend/simple_misc_analysis.nit:105,1--108,3

nitc :: literal $ AExpr
redef class AExpr
	# Get `self` as a `String`.
	# Return null if not a string.
	fun as_string: nullable String
	do
		if not self isa AStringFormExpr then return null
		return self.value
	end

	# Get `self` as an `Int`.
	# Return null if not an integer.
	fun as_int: nullable Int
	do
		if not self isa AIntegerExpr then return null
		return self.value.as(not null).to_i
	end
end
src/literal.nit:59,1--75,3

nitc :: flow $ AExpr
redef class AExpr
	# The flow after the full evaluation of the expression/statement
	var after_flow_context: nullable FlowContext
end
src/semantize/flow.nit:279,1--282,3

nitc :: typing $ AExpr
redef class AExpr
	# The static type of the expression.
	# null if self is a statement or in case of error
	var mtype: nullable MType = null

	# Is the statement correctly typed?
	# Used to distinguish errors and statements when `mtype == null`
	var is_typed: Bool = false

	# If required, the following implicit cast `.as(XXX)`
	# Such a cast may by required after evaluating the expression when
	# a unsafe operation is detected (silently accepted by the Nit language).
	# The attribute is computed by `check_subtype`
	var implicit_cast_to: nullable MType = null

	# Return the variable read (if any)
	# Used to perform adaptive typing
	fun its_variable: nullable Variable do return null

	private fun accept_typing(v: TypeVisitor)
	do
		v.error(self, "no implemented accept_typing for {self.class_name}")
	end

	# Is non-null if `self` is a leaf of a comprehension array construction.
	# In this case, the enclosing literal array node is designated.
	# The result of the evaluation of `self` must be
	# stored inside the designated array (there is an implicit `push`)
	var comprehension: nullable AArrayExpr = null

	# It indicates the number of arguments collected as a vararg.
	#
	# When 0, the argument is used as is, without transformation.
	# When 1, the argument is transformed into an singleton array.
	# Above 1, the arguments and the next ones are transformed into a common array.
	#
	# This attribute is meaning less on expressions not used as attributes.
	var vararg_decl: Int = 0

	redef fun dump_info(v) do
		var res = super
		var mtype = self.mtype
		if mtype != null then
			res += v.yellow(":{mtype}")
		end
		var ict = self.implicit_cast_to
		if ict != null then
			res += v.yellow("(.as({ict}))")
		end
		return res
	end

	# Type the expression as if located in `visited_mpropdef`
	# `TypeVisitor` and `PostTypingVisitor` will be used to do the typing, see them for more information.
	#
	# `visited_mpropdef`: Correspond to the evaluation context in which the expression is located.
	fun do_typing(modelbuilder: ModelBuilder, visited_mpropdef: MPropDef)
	do
		var type_visitor = new TypeVisitor(modelbuilder, visited_mpropdef)
		type_visitor.visit_stmt(self)
		var post_visitor = new PostTypingVisitor(type_visitor)
		post_visitor.enter_visit(self)
	end
end
src/semantize/typing.nit:990,1--1053,3

nitc :: astbuilder $ AExpr
redef class AExpr
	# Return a new variable read that contains the value of the expression
	# This method take care efficiently of creating and initalising an anonymous local variable
	#
	# Note: since this method do side-effects (AST replacement), there could be unexpected effects when used as
	# argument of other methods related to AST transformations.
	fun make_var_read: AVarExpr
	do
		var variable = self.variable_cache
		if variable == null then
			assert parent != null
			var place = detach_with_placeholder
			variable = new Variable("")
			variable.declared_type = self.mtype
			var nvar = new AVarAssignExpr.make(variable, self)
			place.replace_with(nvar)
			self.variable_cache = variable
		end
		return new AVarExpr.make(variable, variable.declared_type.as(not null))
	end

	private var variable_cache: nullable Variable

	# The `detach` method completely remove the node in the parent.
	# However, sometime, it is useful to keep the emplacement of the removed child.
	#
	# The standard use case is the insertion of a node between a parent `p` and a child `p.c`.
	# To create the new node `n`, we need to attach the child to it.
	# But, to put `n` where `c` was in `p`, the place has to be remembered.
	#
	# ~~~nitish
	# var p: AExpr
	# var c = p.c
	# var h = c.detach_with_placeholder
	# var n = astbuilder.make_XXX(c)
	# h.replace_with(n)
	# ~~~
	fun detach_with_placeholder: AExpr
	do
		var h = new APlaceholderExpr.make
		self.replace_with(h)
		return h
	end


	# Add `expr` at the end of the block
	#
	# REQUIRE: self isa ABlockExpr
	#
	# Note: this method, aimed to `ABlockExpr` is promoted to `AExpr` because of the limitations of the hierarchies generated by sablecc3
	fun add(expr: AExpr)
	do
		print "add not implemented in {inspect}"
		abort
	end

	redef fun accept_ast_validation(v)
	do
		super
		if mtype == null and not is_typed then
			#debug "TYPING: untyped expression"
		end
	end
end
src/astbuilder.nit:216,1--279,3

nitc :: rapid_type_analysis $ AExpr
redef class AExpr
	# Make the `mtype` of the expression live
	# Used by literals and instantiations
	fun allocate_mtype(v: RapidTypeVisitor)
	do
		var mtype = self.mtype
		if not mtype isa MClassType then return
		v.add_type(self.mtype.as(MClassType))
	end
end
src/rapid_type_analysis.nit:544,1--553,3

nitc :: naive_interpreter $ AExpr
redef class AExpr
	# Evaluate the node as a possible expression.
	# Return a possible value
	# NOTE: Do not call this method directly, but use `v.expr`
	# This method is here to be implemented by subclasses.
	protected fun expr(v: NaiveInterpreter): nullable Instance
	do
		fatal(v, "NOT YET IMPLEMENTED expr {class_name}")
		abort
	end

	# Evaluate the node as a statement.
	# NOTE: Do not call this method directly, but use `v.stmt`
	# This method is here to be implemented by subclasses (no need to return something).
	protected fun stmt(v: NaiveInterpreter)
	do
		expr(v)
	end

end
src/interpreter/naive_interpreter.nit:1669,1--1688,3

nitc :: explain_assert $ AExpr
redef class AExpr
	# Fill `v` to explain this node if the parent assert fails
	private fun accept_explain_assert(v: ExplainAssertVisitor)
	do if mtype != null then v.explain_expr self
end
src/frontend/explain_assert.nit:188,1--192,3

nitc :: variables_numbering $ AExpr
redef class AExpr
	# Give a position to each variable declared in the node.
	# NOTE: Do not call this method directly, but use `v.numbering`
	# This method is here to be implemented by subclasses.
	# *`v` The current instance of the virtual machine
	# *`position` The first available position in the environment a variable can have
	# Return the next available position a variable can have
	public fun numbering(v: VirtualMachine, position: Int): Int
	do
		return position
	end
end
src/vm/variables_numbering.nit:82,1--93,3

nitc :: abstract_compiler $ AExpr
redef class AExpr
	# Try to compile self as an expression
	# Do not call this method directly, use `v.expr` instead
	private fun expr(v: AbstractCompilerVisitor): nullable RuntimeVariable
	do
		v.add("PRINT_ERROR(\"NOT YET IMPLEMENTED {class_name}:{location.to_s}\\n\");")
		var mtype = self.mtype
		if mtype == null then
			return null
		else
			var res = v.new_var(mtype)
			v.add("/* {res} = NOT YET {class_name} */")
			return res
		end
	end

	# Try to compile self as a statement
	# Do not call this method directly, use `v.stmt` instead
	private fun stmt(v: AbstractCompilerVisitor)
	do
		expr(v)
	end
end
src/compiler/abstract_compiler.nit:3721,1--3743,3

nitc :: ssa $ AExpr
redef class AExpr
	# Generate recursively basic block for this expression
	# *`ssa` An instance of the SSA class initialized with the enclosing `APropdef`
	# *`old_block` A basic block not completely filled
	# Return the last created block (the last block can be nested)
	fun generate_basic_blocks(ssa: SSA, old_block: BasicBlock): BasicBlock
	do
		return old_block
	end
end
src/ssa.nit:573,1--582,3

nitc :: transform $ AExpr
redef class AExpr
	redef fun full_transform_visitor(v: TransformVisitor)
	do
		var na = comprehension
		if na != null then
			# We are building a comprehension array `array`
			# Replace `self` with `array.push(self)`
			var place = detach_with_placeholder
			var recv = na.nnew.make_var_read
			var nadd = v.builder.make_call(recv, na.push_callsite.as(not null), [self])
			place.replace_with(nadd)
		end

		visit_all(v)

		if is_broken then return # Skip broken

		accept_transform_visitor(v)
	end

	redef fun replace_with(other)
	do
		super
		if other isa AExpr then
			if other.implicit_cast_to == null then other.implicit_cast_to = implicit_cast_to
			other.vararg_decl = vararg_decl
		end
	end
end
src/transform.nit:94,1--122,3

nitc :: htmlight $ AExpr
redef class AExpr
	redef fun decorate_tag(v, res, token)
	do
		var t = mtype
		if t == null then return null
		return t.infobox(v)
	end
end
src/htmlight.nit:1107,1--1114,3

nitc :: java_compiler $ AExpr
redef class AExpr
	# Try to compile self as an expression
	# Do not call this method directly, use `v.expr` instead
	private fun expr(v: JavaCompilerVisitor): nullable RuntimeVariable do
		v.info("NOT YET IMPLEMENTED {class_name}::expr")
		return null
	end

	# Try to compile self as a statement
	# Do not call this method directly, use `v.stmt` instead
	private fun stmt(v: JavaCompilerVisitor) do expr(v)
end
src/compiler/java_compiler.nit:1903,1--1914,3