A definition of an attribute

For historical reason, old-syle and new-style attributes use the same ANode sub-class

Introduced properties

private var _has_value: Bool

nitc :: AAttrPropdef :: _has_value

Does the node have a default value?
private var _is_lazy: Bool

nitc :: AAttrPropdef :: _is_lazy

Is the node tagged lazy?
private var _is_optional: Bool

nitc :: AAttrPropdef :: _is_optional

Is the node tagged optional?
private var _mlazypropdef: nullable MAttributeDef

nitc :: AAttrPropdef :: _mlazypropdef

The guard associated to a lazy attribute.
private var _mreadpropdef: nullable MMethodDef

nitc :: AAttrPropdef :: _mreadpropdef

The associated getter (read accessor) if any
private var _mtype: nullable MType

nitc :: AAttrPropdef :: _mtype

The static type of the property (declared, inferred or inherited)
private var _mwritepropdef: nullable MMethodDef

nitc :: AAttrPropdef :: _mwritepropdef

The associated setter (write accessor) if any
private var _n_assign: nullable TAssign

nitc :: AAttrPropdef :: _n_assign

The = symbol
private var _n_block: nullable AExpr

nitc :: AAttrPropdef :: _n_block

The initial value, if any (set with do return)
private var _n_expr: nullable AExpr

nitc :: AAttrPropdef :: _n_expr

The initial value, if any (set with =)
private var _n_id2: TId

nitc :: AAttrPropdef :: _n_id2

The identifier for a new-style attribute
private var _n_kwdo: nullable TKwdo

nitc :: AAttrPropdef :: _n_kwdo

The do keyword
private var _n_kwend: nullable TKwend

nitc :: AAttrPropdef :: _n_kwend

The end keyword
private var _n_kwvar: TKwvar

nitc :: AAttrPropdef :: _n_kwvar

The var keyword
private var _n_type: nullable AType

nitc :: AAttrPropdef :: _n_type

The declared type of the attribute
private var _name: String

nitc :: AAttrPropdef :: _name

The name of the attribute
private var _noinit: Bool

nitc :: AAttrPropdef :: _noinit

Is the node tagged noinit?
private var _serialize_name: String

nitc :: AAttrPropdef :: _serialize_name

Name of this attribute in the serialized format
fun build_attribute_property(modelbuilder: ModelBuilder, mclassdef: MClassDef)

nitc :: AAttrPropdef :: build_attribute_property

Build the attribute property
fun build_lazy_property(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: AAttrPropdef :: build_lazy_property

Build the lazy attribute property
fun build_read_property(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: AAttrPropdef :: build_read_property

Build the read method property to get the value of the attribute
fun build_read_signature

nitc :: AAttrPropdef :: build_read_signature

Build the read method signature
fun build_write_property(modelbuilder: ModelBuilder, mclassdef: MClassDef, is_same_visibility: Bool): Bool

nitc :: AAttrPropdef :: build_write_property

Build the write method property to set the attribute value
fun build_write_signature

nitc :: AAttrPropdef :: build_write_signature

Build the write method signature
private fun compile_getter(v: JavaCompilerVisitor, mpropdef: MPropDef, arguments: Array[RuntimeVariable])

nitc :: AAttrPropdef :: compile_getter

Compile the getter method
private fun compile_setter(v: JavaCompilerVisitor, mpropdef: MPropDef, arguments: Array[RuntimeVariable])

nitc :: AAttrPropdef :: compile_setter

Compile the setter method
fun create_lazy: AAttrPropdef

nitc :: AAttrPropdef :: create_lazy

Create the lazy attribute.
fun create_setter(modelbuilder: ModelBuilder, is_same_visibility: nullable Bool): AAttrPropdef

nitc :: AAttrPropdef :: create_setter

Create a new setter for the attribute.
fun define_default(expr: AExpr): AAttrPropdef

nitc :: AAttrPropdef :: define_default

Set the default self value
private fun evaluate_expr(v: AbstractCompilerVisitor, recv: RuntimeVariable): RuntimeVariable

nitc :: AAttrPropdef :: evaluate_expr

Evaluate, store and return the default value of the attribute
private fun evaluate_expr(v: JavaCompilerVisitor, recv: RuntimeVariable): RuntimeVariable

nitc :: AAttrPropdef :: evaluate_expr

Evaluate, store and return the default value of the attribute
fun has_value: Bool

nitc :: AAttrPropdef :: has_value

Does the node have a default value?
protected fun has_value=(has_value: Bool)

nitc :: AAttrPropdef :: has_value=

Does the node have a default value?
private fun infer_static_type(modelbuilder: ModelBuilder, nexpr: AExpr, mclassdef: MClassDef, mmodule: MModule, mreadpropdef: MPropDef): nullable MType

nitc :: AAttrPropdef :: infer_static_type

Detect the static type from the value assigned to the attribute self
init init_aattrpropdef(n_doc: nullable ADoc, n_kwredef: nullable TKwredef, n_visibility: nullable AVisibility, n_kwvar: nullable TKwvar, n_id2: nullable TId, n_type: nullable AType, n_assign: nullable TAssign, n_expr: nullable AExpr, n_annotations: nullable AAnnotations, n_kwdo: nullable TKwdo, n_block: nullable AExpr, n_kwend: nullable TKwend)

nitc :: AAttrPropdef :: init_aattrpropdef

private fun init_expr(v: NaiveInterpreter, recv: Instance)

nitc :: AAttrPropdef :: init_expr

Evaluate and set the default value of the attribute in recv
fun is_lazy: Bool

nitc :: AAttrPropdef :: is_lazy

Is the node tagged lazy?
protected fun is_lazy=(is_lazy: Bool)

nitc :: AAttrPropdef :: is_lazy=

Is the node tagged lazy?
fun is_optional: Bool

nitc :: AAttrPropdef :: is_optional

Is the node tagged optional?
protected fun is_optional=(is_optional: Bool)

nitc :: AAttrPropdef :: is_optional=

Is the node tagged optional?
private init make(name: String, n_type: nullable AType, n_visibility: nullable AVisibility, initial_value: nullable AExpr, n_block: nullable AExpr, m_attributedef: nullable MAttributeDef, m_setterdef: nullable MMethodDef, m_getterdef: nullable MMethodDef)

nitc :: AAttrPropdef :: make

Create a new AAttrPropdef
fun mlazypropdef: nullable MAttributeDef

nitc :: AAttrPropdef :: mlazypropdef

The guard associated to a lazy attribute.
protected fun mlazypropdef=(mlazypropdef: nullable MAttributeDef)

nitc :: AAttrPropdef :: mlazypropdef=

The guard associated to a lazy attribute.
fun mreadpropdef: nullable MMethodDef

nitc :: AAttrPropdef :: mreadpropdef

The associated getter (read accessor) if any
fun mreadpropdef=(mreadpropdef: nullable MMethodDef)

nitc :: AAttrPropdef :: mreadpropdef=

The associated getter (read accessor) if any
fun mtype: nullable MType

nitc :: AAttrPropdef :: mtype

The static type of the property (declared, inferred or inherited)
protected fun mtype=(mtype: nullable MType)

nitc :: AAttrPropdef :: mtype=

The static type of the property (declared, inferred or inherited)
fun mwritepropdef: nullable MMethodDef

nitc :: AAttrPropdef :: mwritepropdef

The associated setter (write accessor) if any
fun mwritepropdef=(mwritepropdef: nullable MMethodDef)

nitc :: AAttrPropdef :: mwritepropdef=

The associated setter (write accessor) if any
fun n_assign: nullable TAssign

nitc :: AAttrPropdef :: n_assign

The = symbol
fun n_assign=(n_assign: nullable TAssign)

nitc :: AAttrPropdef :: n_assign=

The = symbol
fun n_block: nullable AExpr

nitc :: AAttrPropdef :: n_block

The initial value, if any (set with do return)
fun n_block=(n_block: nullable AExpr)

nitc :: AAttrPropdef :: n_block=

The initial value, if any (set with do return)
fun n_expr: nullable AExpr

nitc :: AAttrPropdef :: n_expr

The initial value, if any (set with =)
fun n_expr=(n_expr: nullable AExpr)

nitc :: AAttrPropdef :: n_expr=

The initial value, if any (set with =)
fun n_id2: TId

nitc :: AAttrPropdef :: n_id2

The identifier for a new-style attribute
fun n_id2=(n_id2: TId)

nitc :: AAttrPropdef :: n_id2=

The identifier for a new-style attribute
fun n_kwdo: nullable TKwdo

nitc :: AAttrPropdef :: n_kwdo

The do keyword
fun n_kwdo=(n_kwdo: nullable TKwdo)

nitc :: AAttrPropdef :: n_kwdo=

The do keyword
fun n_kwend: nullable TKwend

nitc :: AAttrPropdef :: n_kwend

The end keyword
fun n_kwend=(n_kwend: nullable TKwend)

nitc :: AAttrPropdef :: n_kwend=

The end keyword
fun n_kwvar: TKwvar

nitc :: AAttrPropdef :: n_kwvar

The var keyword
fun n_kwvar=(n_kwvar: TKwvar)

nitc :: AAttrPropdef :: n_kwvar=

The var keyword
fun n_type: nullable AType

nitc :: AAttrPropdef :: n_type

The declared type of the attribute
fun n_type=(n_type: nullable AType)

nitc :: AAttrPropdef :: n_type=

The declared type of the attribute
fun name: String

nitc :: AAttrPropdef :: name

The name of the attribute
protected fun name=(name: String)

nitc :: AAttrPropdef :: name=

The name of the attribute
fun noinit: Bool

nitc :: AAttrPropdef :: noinit

Is the node tagged noinit?
protected fun noinit=(noinit: Bool)

nitc :: AAttrPropdef :: noinit=

Is the node tagged noinit?
private fun serialize_name: String

nitc :: AAttrPropdef :: serialize_name

Name of this attribute in the serialized format
private fun serialize_name=(serialize_name: String)

nitc :: AAttrPropdef :: serialize_name=

Name of this attribute in the serialized format

Redefined properties

redef type MPROPDEF: MAttributeDef

nitc :: modelize_property $ AAttrPropdef :: MPROPDEF

The associated main model entity
redef type SELF: AAttrPropdef

nitc $ AAttrPropdef :: SELF

Type of this instance, automatically specialized in every class
redef fun accept_pretty_printer(v: PrettyPrinterVisitor)

nitc :: pretty $ AAttrPropdef :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
redef fun build_property(modelbuilder: ModelBuilder, mclassdef: MClassDef)

nitc :: modelize_property $ AAttrPropdef :: build_property

redef fun call(v: NaiveInterpreter, mpropdef: MMethodDef, args: Array[Instance]): nullable Instance

nitc :: naive_interpreter $ AAttrPropdef :: call

Execute a mpropdef associated with the current node.
redef fun check_repeated_types(modelbuilder: ModelBuilder)

nitc :: modelize_property $ AAttrPropdef :: check_repeated_types

Type is useless if the attribute type is the same thant the intro.
redef fun compile_to_java(v: JavaCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable])

nitc :: java_compiler $ AAttrPropdef :: compile_to_java

Compile that property definition to java code
redef fun decorate_tag(v: HtmlightVisitor, res: HTMLTag, token: Token): nullable HInfoBox

nitc :: htmlight $ AAttrPropdef :: decorate_tag

Add aditionnal information on a child-token and return an additionnal HInfoBox on it
redef fun do_typing(modelbuilder: ModelBuilder)

nitc :: typing $ AAttrPropdef :: do_typing

The entry point of the whole typing analysis
redef fun first_token: nullable Token

nitc :: pretty $ AAttrPropdef :: first_token

The first token of the production in the AST
redef fun generate_basic_blocks(ssa: SSA)

nitc :: ssa $ AAttrPropdef :: generate_basic_blocks

Generate all basic blocks for this code
redef fun hot_location: Location

nitc $ AAttrPropdef :: hot_location

The location of the important part of the node (identifier or whatever)
redef fun is_inlinable: Bool

nitc :: pretty $ AAttrPropdef :: is_inlinable

Is self printable in one line?
redef fun n_annotations=(node: nullable AAnnotations)

nitc :: parser_prod $ AAttrPropdef :: n_annotations=

All the annotations attached directly to the node
redef fun n_assign=(node: nullable TAssign)

nitc :: parser_prod $ AAttrPropdef :: n_assign=

The = symbol
redef fun n_block=(node: nullable AExpr)

nitc :: parser_prod $ AAttrPropdef :: n_block=

The initial value, if any (set with do return)
redef fun n_doc=(node: nullable ADoc)

nitc :: parser_prod $ AAttrPropdef :: n_doc=

The documentation
redef fun n_expr=(node: nullable AExpr)

nitc :: parser_prod $ AAttrPropdef :: n_expr=

The initial value, if any (set with =)
redef fun n_id2=(node: TId)

nitc :: parser_prod $ AAttrPropdef :: n_id2=

The identifier for a new-style attribute
redef fun n_kwdo=(node: nullable TKwdo)

nitc :: parser_prod $ AAttrPropdef :: n_kwdo=

The do keyword
redef fun n_kwend=(node: nullable TKwend)

nitc :: parser_prod $ AAttrPropdef :: n_kwend=

The end keyword
redef fun n_kwredef=(node: nullable TKwredef)

nitc :: parser_prod $ AAttrPropdef :: n_kwredef=

The redef keyword
redef fun n_kwvar=(node: TKwvar)

nitc :: parser_prod $ AAttrPropdef :: n_kwvar=

The var keyword
redef fun n_type=(node: nullable AType)

nitc :: parser_prod $ AAttrPropdef :: n_type=

The declared type of the attribute
redef fun n_visibility=(node: nullable AVisibility)

nitc :: parser_prod $ AAttrPropdef :: n_visibility=

The declared visibility
redef fun numbering_variables(vm: VirtualMachine)

nitc :: variables_numbering $ AAttrPropdef :: numbering_variables

Assign a position in the environment to each local variable
redef fun replace_child(old_child: ANode, new_child: nullable ANode)

nitc :: parser_prod $ AAttrPropdef :: replace_child

Replace a child with an other node in the AST
redef fun visit_all(v: Visitor)

nitc :: parser_prod $ AAttrPropdef :: visit_all

Visit all nodes in order.

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 MPROPDEF: MPropDef

nitc :: APropdef :: MPROPDEF

The associated main model entity
type SELF: Object

core :: Object :: SELF

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

nitc :: APropdef :: _after_flow_context

The ending flow
private var _basic_block: nullable BasicBlock

nitc :: APropdef :: _basic_block

The first basic block of the code
private var _before_flow_context: nullable FlowContext

nitc :: APropdef :: _before_flow_context

The starting flow
private var _environment_size: Int

nitc :: APropdef :: _environment_size

The size of the environment to create to call this method
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 _has_value: Bool

nitc :: AAttrPropdef :: _has_value

Does the node have a default value?
private var _is_broken: Bool

nitc :: ANode :: _is_broken

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

nitc :: APropdef :: _is_compiled

Indicite if this propdef was compile
private var _is_generated: Bool

nitc :: APropdef :: _is_generated

If true, the basic blocks where generated
private var _is_lazy: Bool

nitc :: AAttrPropdef :: _is_lazy

Is the node tagged lazy?
private var _is_numbering: Bool

nitc :: APropdef :: _is_numbering

Indicate if the variables numbering has been done
private var _is_optional: Bool

nitc :: AAttrPropdef :: _is_optional

Is the node tagged optional?
private var _is_phased: Bool

nitc :: APropdef :: _is_phased

Is the propdef already analyzed by run_phases_on_npropdef.
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 _mlazypropdef: nullable MAttributeDef

nitc :: AAttrPropdef :: _mlazypropdef

The guard associated to a lazy attribute.
private var _mpropdef: nullable MPROPDEF

nitc :: APropdef :: _mpropdef

The associated propdef once build by a ModelBuilder
private var _mreadpropdef: nullable MMethodDef

nitc :: AAttrPropdef :: _mreadpropdef

The associated getter (read accessor) if any
private var _mtype: nullable MType

nitc :: AAttrPropdef :: _mtype

The static type of the property (declared, inferred or inherited)
private var _mwritepropdef: nullable MMethodDef

nitc :: AAttrPropdef :: _mwritepropdef

The associated setter (write accessor) if any
private var _n_annotations: nullable AAnnotations

nitc :: Prod :: _n_annotations

All the annotations attached directly to the node
private var _n_assign: nullable TAssign

nitc :: AAttrPropdef :: _n_assign

The = symbol
private var _n_block: nullable AExpr

nitc :: AAttrPropdef :: _n_block

The initial value, if any (set with do return)
private var _n_doc: nullable ADoc

nitc :: ADefinition :: _n_doc

The documentation
private var _n_expr: nullable AExpr

nitc :: AAttrPropdef :: _n_expr

The initial value, if any (set with =)
private var _n_id2: TId

nitc :: AAttrPropdef :: _n_id2

The identifier for a new-style attribute
private var _n_kwdo: nullable TKwdo

nitc :: AAttrPropdef :: _n_kwdo

The do keyword
private var _n_kwend: nullable TKwend

nitc :: AAttrPropdef :: _n_kwend

The end keyword
private var _n_kwredef: nullable TKwredef

nitc :: ADefinition :: _n_kwredef

The redef keyword
private var _n_kwvar: TKwvar

nitc :: AAttrPropdef :: _n_kwvar

The var keyword
private var _n_type: nullable AType

nitc :: AAttrPropdef :: _n_type

The declared type of the attribute
private var _n_visibility: nullable AVisibility

nitc :: ADefinition :: _n_visibility

The declared visibility
private var _name: String

nitc :: AAttrPropdef :: _name

The name of the attribute
private var _noinit: Bool

nitc :: AAttrPropdef :: _noinit

Is the node tagged noinit?
private var _object_sites: Array[AExpr]

nitc :: APropdef :: _object_sites

Contain all AST-parts related to object mechanisms the propdef has:
private var _parent: nullable ANode

nitc :: ANode :: _parent

Parent of the node in the AST
private var _return_mark: nullable EscapeMark

nitc :: APropdef :: _return_mark

The break escape mark associated with the return
private var _returnvar: Variable

nitc :: APropdef :: _returnvar

The return variable of the propdef
private var _selfvariable: nullable Variable

nitc :: APropdef :: _selfvariable

The variable associated to the receiver (if any)
private var _serialize_name: String

nitc :: AAttrPropdef :: _serialize_name

Name of this attribute in the serialized format
private var _variables: HashSet[Variable]

nitc :: APropdef :: _variables

The variables contained in the body on this propdef
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 after_flow_context: nullable FlowContext

nitc :: APropdef :: after_flow_context

The ending flow
protected fun after_flow_context=(after_flow_context: nullable FlowContext)

nitc :: APropdef :: after_flow_context=

The ending flow
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.
fun basic_block: nullable BasicBlock

nitc :: APropdef :: basic_block

The first basic block of the code
protected fun basic_block=(basic_block: nullable BasicBlock)

nitc :: APropdef :: basic_block=

The first basic block of the code
fun before_flow_context: nullable FlowContext

nitc :: APropdef :: before_flow_context

The starting flow
protected fun before_flow_context=(before_flow_context: nullable FlowContext)

nitc :: APropdef :: before_flow_context=

The starting flow
fun build_attribute_property(modelbuilder: ModelBuilder, mclassdef: MClassDef)

nitc :: AAttrPropdef :: build_attribute_property

Build the attribute property
fun build_lazy_property(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: AAttrPropdef :: build_lazy_property

Build the lazy attribute property
private fun build_property(modelbuilder: ModelBuilder, mclassdef: MClassDef)

nitc :: APropdef :: build_property

fun build_read_property(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: AAttrPropdef :: build_read_property

Build the read method property to get the value of the attribute
fun build_read_signature

nitc :: AAttrPropdef :: build_read_signature

Build the read method signature
private fun build_signature(modelbuilder: ModelBuilder)

nitc :: APropdef :: build_signature

fun build_write_property(modelbuilder: ModelBuilder, mclassdef: MClassDef, is_same_visibility: Bool): Bool

nitc :: AAttrPropdef :: build_write_property

Build the write method property to set the attribute value
fun build_write_signature

nitc :: AAttrPropdef :: build_write_signature

Build the write method signature
private fun call(v: NaiveInterpreter, mpropdef: MMethodDef, args: Array[Instance]): nullable Instance

nitc :: APropdef :: call

Execute a mpropdef associated with the current node.
private fun check_redef_keyword(modelbuilder: ModelBuilder, mclassdef: MClassDef, kwredef: nullable Token, need_redef: Bool, mprop: MProperty): Bool

nitc :: APropdef :: check_redef_keyword

private fun check_redef_property_visibility(modelbuilder: ModelBuilder, nvisibility: nullable AVisibility, mprop: MProperty)

nitc :: APropdef :: check_redef_property_visibility

private fun check_repeated_types(modelbuilder: ModelBuilder)

nitc :: APropdef :: check_repeated_types

Checks for useless type in redef signatures.
private fun check_signature(modelbuilder: ModelBuilder)

nitc :: APropdef :: check_signature

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 compile(vm: VirtualMachine)

nitc :: APropdef :: compile

Compile this propdef
private fun compile_getter(v: JavaCompilerVisitor, mpropdef: MPropDef, arguments: Array[RuntimeVariable])

nitc :: AAttrPropdef :: compile_getter

Compile the getter method
private fun compile_setter(v: JavaCompilerVisitor, mpropdef: MPropDef, arguments: Array[RuntimeVariable])

nitc :: AAttrPropdef :: compile_setter

Compile the setter method
fun compile_to_java(v: JavaCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable])

nitc :: APropdef :: compile_to_java

Compile that property definition to java code
fun compute_phi(ssa: SSA)

nitc :: APropdef :: compute_phi

Compute the first phase of SSA algorithm: placing phi-functions
fun compute_ssa(ssa: SSA)

nitc :: APropdef :: compute_ssa

Compute the three steps of SSA-algorithm
fun create_lazy: AAttrPropdef

nitc :: AAttrPropdef :: create_lazy

Create the lazy attribute.
fun create_setter(modelbuilder: ModelBuilder, is_same_visibility: nullable Bool): AAttrPropdef

nitc :: AAttrPropdef :: create_setter

Create a new setter for the attribute.
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 define_default(expr: AExpr): AAttrPropdef

nitc :: AAttrPropdef :: define_default

Set the default self value
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
private fun do_cloneable(v: CloneVisitor)

nitc :: ANode :: do_cloneable

fun do_flow(toolcontext: ToolContext)

nitc :: APropdef :: do_flow

The entry point of the whole flow analysis
fun do_local_var_init(toolcontext: ToolContext)

nitc :: APropdef :: do_local_var_init

Entry point of the whole local variable initialization verifier
fun do_scope(toolcontext: ToolContext)

nitc :: APropdef :: do_scope

Entry point of the scope analysis
fun do_typing(modelbuilder: ModelBuilder)

nitc :: APropdef :: do_typing

The entry point of the whole typing analysis
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 environment_size: Int

nitc :: APropdef :: environment_size

The size of the environment to create to call this method
private fun environment_size=(environment_size: Int)

nitc :: APropdef :: environment_size=

The size of the environment to create to call this method
private fun evaluate_expr(v: JavaCompilerVisitor, recv: RuntimeVariable): RuntimeVariable

nitc :: AAttrPropdef :: evaluate_expr

Evaluate, store and return the default value of the attribute
private fun evaluate_expr(v: AbstractCompilerVisitor, recv: RuntimeVariable): RuntimeVariable

nitc :: AAttrPropdef :: evaluate_expr

Evaluate, store and return the default value of the attribute
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.
abstract fun generate_basic_blocks(ssa: SSA)

nitc :: APropdef :: generate_basic_blocks

Generate all basic blocks for this code
fun generate_name(v: Variable, counter: HashMap[Variable, Int], expr: ANode, ssa: SSA): Variable

nitc :: APropdef :: generate_name

Generate a new version of the variable v and return it
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 has_value: Bool

nitc :: AAttrPropdef :: has_value

Does the node have a default value?
protected fun has_value=(has_value: Bool)

nitc :: AAttrPropdef :: has_value=

Does the node have a default value?
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)
private fun infer_static_type(modelbuilder: ModelBuilder, nexpr: AExpr, mclassdef: MClassDef, mmodule: MModule, mreadpropdef: MPropDef): nullable MType

nitc :: AAttrPropdef :: infer_static_type

Detect the static type from the value assigned to the attribute self
fun infobox(v: HtmlightVisitor): nullable HInfoBox

nitc :: ANode :: infobox

Return a optional infobox
init init

core :: Object :: init

init init_aattrpropdef(n_doc: nullable ADoc, n_kwredef: nullable TKwredef, n_visibility: nullable AVisibility, n_kwvar: nullable TKwvar, n_id2: nullable TId, n_type: nullable AType, n_assign: nullable TAssign, n_expr: nullable AExpr, n_annotations: nullable AAnnotations, n_kwdo: nullable TKwdo, n_block: nullable AExpr, n_kwend: nullable TKwend)

nitc :: AAttrPropdef :: init_aattrpropdef

private fun init_expr(v: NaiveInterpreter, recv: Instance)

nitc :: AAttrPropdef :: init_expr

Evaluate and set the default value of the attribute in recv
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.
fun is_compiled: Bool

nitc :: APropdef :: is_compiled

Indicite if this propdef was compile
protected fun is_compiled=(is_compiled: Bool)

nitc :: APropdef :: is_compiled=

Indicite if this propdef was compile
fun is_generated: Bool

nitc :: APropdef :: is_generated

If true, the basic blocks where generated
protected fun is_generated=(is_generated: Bool)

nitc :: APropdef :: is_generated=

If true, the basic blocks where generated
private fun is_inlinable: Bool

nitc :: ANode :: is_inlinable

Is self printable in one line?
fun is_lazy: Bool

nitc :: AAttrPropdef :: is_lazy

Is the node tagged lazy?
protected fun is_lazy=(is_lazy: Bool)

nitc :: AAttrPropdef :: is_lazy=

Is the node tagged lazy?
private fun is_noserialize: Bool

nitc :: ANode :: is_noserialize

Is this node annotated to not be made serializable?
private fun is_numbering: Bool

nitc :: APropdef :: is_numbering

Indicate if the variables numbering has been done
private fun is_numbering=(is_numbering: Bool)

nitc :: APropdef :: is_numbering=

Indicate if the variables numbering has been done
fun is_optional: Bool

nitc :: AAttrPropdef :: is_optional

Is the node tagged optional?
protected fun is_optional=(is_optional: Bool)

nitc :: AAttrPropdef :: is_optional=

Is the node tagged optional?
private fun is_phased: Bool

nitc :: APropdef :: is_phased

Is the propdef already analyzed by run_phases_on_npropdef.
private fun is_phased=(is_phased: Bool)

nitc :: APropdef :: is_phased=

Is the propdef already analyzed by run_phases_on_npropdef.
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 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.
private init make(name: String, n_type: nullable AType, n_visibility: nullable AVisibility, initial_value: nullable AExpr, n_block: nullable AExpr, m_attributedef: nullable MAttributeDef, m_setterdef: nullable MMethodDef, m_getterdef: nullable MMethodDef)

nitc :: AAttrPropdef :: make

Create a new AAttrPropdef
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 mlazypropdef: nullable MAttributeDef

nitc :: AAttrPropdef :: mlazypropdef

The guard associated to a lazy attribute.
protected fun mlazypropdef=(mlazypropdef: nullable MAttributeDef)

nitc :: AAttrPropdef :: mlazypropdef=

The guard associated to a lazy attribute.
fun mpropdef: nullable MPROPDEF

nitc :: APropdef :: mpropdef

The associated propdef once build by a ModelBuilder
fun mpropdef=(mpropdef: nullable MPROPDEF)

nitc :: APropdef :: mpropdef=

The associated propdef once build by a ModelBuilder
fun mreadpropdef: nullable MMethodDef

nitc :: AAttrPropdef :: mreadpropdef

The associated getter (read accessor) if any
fun mreadpropdef=(mreadpropdef: nullable MMethodDef)

nitc :: AAttrPropdef :: mreadpropdef=

The associated getter (read accessor) if any
fun mtype: nullable MType

nitc :: AAttrPropdef :: mtype

The static type of the property (declared, inferred or inherited)
protected fun mtype=(mtype: nullable MType)

nitc :: AAttrPropdef :: mtype=

The static type of the property (declared, inferred or inherited)
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 mwritepropdef: nullable MMethodDef

nitc :: AAttrPropdef :: mwritepropdef

The associated setter (write accessor) if any
fun mwritepropdef=(mwritepropdef: nullable MMethodDef)

nitc :: AAttrPropdef :: mwritepropdef=

The associated setter (write accessor) if any
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
fun n_assign: nullable TAssign

nitc :: AAttrPropdef :: n_assign

The = symbol
fun n_assign=(n_assign: nullable TAssign)

nitc :: AAttrPropdef :: n_assign=

The = symbol
fun n_block: nullable AExpr

nitc :: AAttrPropdef :: n_block

The initial value, if any (set with do return)
fun n_block=(n_block: nullable AExpr)

nitc :: AAttrPropdef :: n_block=

The initial value, if any (set with do return)
fun n_doc: nullable ADoc

nitc :: ADefinition :: n_doc

The documentation
fun n_doc=(n_doc: nullable ADoc)

nitc :: ADefinition :: n_doc=

The documentation
fun n_expr: nullable AExpr

nitc :: AAttrPropdef :: n_expr

The initial value, if any (set with =)
fun n_expr=(n_expr: nullable AExpr)

nitc :: AAttrPropdef :: n_expr=

The initial value, if any (set with =)
fun n_id2: TId

nitc :: AAttrPropdef :: n_id2

The identifier for a new-style attribute
fun n_id2=(n_id2: TId)

nitc :: AAttrPropdef :: n_id2=

The identifier for a new-style attribute
fun n_kwdo: nullable TKwdo

nitc :: AAttrPropdef :: n_kwdo

The do keyword
fun n_kwdo=(n_kwdo: nullable TKwdo)

nitc :: AAttrPropdef :: n_kwdo=

The do keyword
fun n_kwend: nullable TKwend

nitc :: AAttrPropdef :: n_kwend

The end keyword
fun n_kwend=(n_kwend: nullable TKwend)

nitc :: AAttrPropdef :: n_kwend=

The end keyword
fun n_kwredef: nullable TKwredef

nitc :: ADefinition :: n_kwredef

The redef keyword
fun n_kwredef=(n_kwredef: nullable TKwredef)

nitc :: ADefinition :: n_kwredef=

The redef keyword
fun n_kwvar: TKwvar

nitc :: AAttrPropdef :: n_kwvar

The var keyword
fun n_kwvar=(n_kwvar: TKwvar)

nitc :: AAttrPropdef :: n_kwvar=

The var keyword
fun n_type: nullable AType

nitc :: AAttrPropdef :: n_type

The declared type of the attribute
fun n_type=(n_type: nullable AType)

nitc :: AAttrPropdef :: n_type=

The declared type of the attribute
fun n_visibility: nullable AVisibility

nitc :: ADefinition :: n_visibility

The declared visibility
fun n_visibility=(n_visibility: nullable AVisibility)

nitc :: ADefinition :: n_visibility=

The declared visibility
fun name: String

nitc :: AAttrPropdef :: name

The name of the attribute
protected fun name=(name: String)

nitc :: AAttrPropdef :: name=

The name of the attribute
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
private fun new_property_visibility(modelbuilder: ModelBuilder, mclassdef: MClassDef, nvisibility: nullable AVisibility): MVisibility

nitc :: APropdef :: new_property_visibility

fun noinit: Bool

nitc :: AAttrPropdef :: noinit

Is the node tagged noinit?
protected fun noinit=(noinit: Bool)

nitc :: AAttrPropdef :: noinit=

Is the node tagged noinit?
abstract fun numbering_variables(vm: VirtualMachine)

nitc :: APropdef :: numbering_variables

Numbering the variable inside the propdef
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun object_sites: Array[AExpr]

nitc :: APropdef :: object_sites

Contain all AST-parts related to object mechanisms the propdef has:
protected fun object_sites=(object_sites: Array[AExpr])

nitc :: APropdef :: object_sites=

Contain all AST-parts related to object mechanisms the propdef has:
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
fun propagate_dependences(phi: PhiFunction, block: BasicBlock)

nitc :: APropdef :: propagate_dependences

Propagate the dependences of the phi-functions into following variables
fun rename(block: BasicBlock, counter: HashMap[Variable, Int], ssa: SSA)

nitc :: APropdef :: rename

Recursively rename each variable from block
fun rename_variables(ssa: SSA)

nitc :: APropdef :: rename_variables

Compute the second phase of SSA algorithm: renaming variables
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 return_mark: nullable EscapeMark

nitc :: APropdef :: return_mark

The break escape mark associated with the return
protected fun return_mark=(return_mark: nullable EscapeMark)

nitc :: APropdef :: return_mark=

The break escape mark associated with the return
fun returnvar: Variable

nitc :: APropdef :: returnvar

The return variable of the propdef
protected fun returnvar=(returnvar: Variable)

nitc :: APropdef :: returnvar=

The return variable of the propdef
fun root: ANode

nitc :: ANode :: root

The topmost ancestor of the element
fun selfvariable: nullable Variable

nitc :: APropdef :: selfvariable

The variable associated to the receiver (if any)
protected fun selfvariable=(selfvariable: nullable Variable)

nitc :: APropdef :: selfvariable=

The variable associated to the receiver (if any)
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
private fun serialize_name: String

nitc :: AAttrPropdef :: serialize_name

Name of this attribute in the serialized format
private fun serialize_name=(serialize_name: String)

nitc :: AAttrPropdef :: serialize_name=

Name of this attribute in the serialized format
private fun set_doc(mpropdef: MPropDef, modelbuilder: ModelBuilder)

nitc :: APropdef :: set_doc

fun ssa_destruction(ssa: SSA)

nitc :: APropdef :: ssa_destruction

Transform SSA-representation into an executable code (delete phi-functions)
private fun start_token: nullable Token

nitc :: Prod :: start_token

The token where the production really start (skipping ADoc).
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
private fun tag(mpd: MPropDef): HTMLTag

nitc :: APropdef :: tag

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 variables: HashSet[Variable]

nitc :: APropdef :: variables

The variables contained in the body on this propdef
protected fun variables=(variables: HashSet[Variable])

nitc :: APropdef :: variables=

The variables contained in the body on this propdef
abstract fun visit_all(v: Visitor)

nitc :: ANode :: visit_all

Visit all nodes in order.
fun visit_annotations(v: PrettyPrinterVisitor, n_annotations: nullable AAnnotations): Bool

nitc :: APropdef :: visit_annotations

Factorize annotations visit for all APropdef.
fun visit_block(v: PrettyPrinterVisitor, n_block: nullable AExpr, annot_inline: Bool)

nitc :: APropdef :: visit_block

Factorize block visit for APropdefs.
private abstract fun was_inline: Bool

nitc :: ANode :: was_inline

Does self was written in one line before transformation?
package_diagram nitc::AAttrPropdef AAttrPropdef nitc::APropdef APropdef nitc::AAttrPropdef->nitc::APropdef nitc::ADefinition ADefinition nitc::APropdef->nitc::ADefinition ...nitc::ADefinition ... ...nitc::ADefinition->nitc::ADefinition

Ancestors

abstract class ADefinition

nitc :: ADefinition

Abstract class for definition of entities
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.
abstract class Prod

nitc :: Prod

Ancestor of all productions

Parents

abstract class APropdef

nitc :: APropdef

The definition of a property

Class definitions

nitc $ AAttrPropdef
# A definition of an attribute
# For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
class AAttrPropdef
	super APropdef

	# The `var` keyword
	var n_kwvar: TKwvar is writable, noinit

	# The identifier for a new-style attribute
	var n_id2: TId is writable, noinit

	# The declared type of the attribute
	var n_type: nullable AType = null is writable

	# The `=` symbol
	var n_assign: nullable TAssign = null is writable

	# The initial value, if any (set with `=`)
	var n_expr: nullable AExpr = null is writable

	# The `do` keyword
	var n_kwdo: nullable TKwdo = null is writable

	# The initial value, if any (set with `do return`)
	var n_block: nullable AExpr = null is writable

	# The `end` keyword
	var n_kwend: nullable TKwend = null is writable

	redef fun hot_location
	do
		return n_id2.location
	end
end
src/parser/parser_nodes.nit:1369,1--1402,3

nitc :: parser_prod $ AAttrPropdef
redef class AAttrPropdef
	init init_aattrpropdef (
		n_doc: nullable ADoc,
		n_kwredef: nullable TKwredef,
		n_visibility: nullable AVisibility,
		n_kwvar: nullable TKwvar,
		n_id2: nullable TId,
		n_type: nullable AType,
		n_assign: nullable TAssign,
		n_expr: nullable AExpr,
		n_annotations: nullable AAnnotations,
		n_kwdo: nullable TKwdo,
		n_block: nullable AExpr,
		n_kwend: nullable TKwend
	)
	do
		_n_doc = n_doc
		if n_doc != null then n_doc.parent = self
		_n_kwredef = n_kwredef
		if n_kwredef != null then n_kwredef.parent = self
		_n_visibility = n_visibility.as(not null)
		n_visibility.parent = self
		_n_kwvar = n_kwvar.as(not null)
		n_kwvar.parent = self
		_n_id2 = n_id2.as(not null)
		n_id2.parent = self
		_n_type = n_type
		if n_type != null then n_type.parent = self
		_n_assign = n_assign
		if n_assign != null then n_assign.parent = self
		_n_expr = n_expr
		if n_expr != null then n_expr.parent = self
		_n_annotations = n_annotations
		if n_annotations != null then n_annotations.parent = self
		_n_kwdo = n_kwdo
		if n_kwdo != null then n_kwdo.parent = self
		_n_block = n_block
		if n_block != null then n_block.parent = self
		_n_kwend = n_kwend
		if n_kwend != null then n_kwend.parent = self
	end

	redef fun replace_child(old_child: ANode, new_child: nullable ANode)
	do
		if _n_doc == old_child then
			n_doc = new_child.as(nullable ADoc)
			return
		end
		if _n_kwredef == old_child then
			n_kwredef = new_child.as(nullable TKwredef)
			return
		end
		if _n_visibility == old_child then
			n_visibility = new_child.as(AVisibility)
			return
		end
		if _n_kwvar == old_child then
			n_kwvar = new_child.as(TKwvar)
			return
		end
		if _n_id2 == old_child then
			n_id2 = new_child.as(TId)
			return
		end
		if _n_type == old_child then
			n_type = new_child.as(nullable AType)
			return
		end
		if _n_assign == old_child then
			n_assign = new_child.as(nullable TAssign)
			return
		end
		if _n_expr == old_child then
			n_expr = new_child.as(nullable AExpr)
			return
		end
		if _n_annotations == old_child then
			n_annotations = new_child.as(nullable AAnnotations)
			return
		end
		if _n_kwdo == old_child then
			n_kwdo = new_child.as(nullable TKwdo)
			return
		end
		if _n_block == old_child then
			n_block = new_child.as(nullable AExpr)
			return
		end
		if _n_kwend == old_child then
			n_kwend = new_child.as(nullable TKwend)
			return
		end
	end

	redef fun n_doc=(node)
	do
		_n_doc = node
		if node != null then node.parent = self
	end
	redef fun n_kwredef=(node)
	do
		_n_kwredef = node
		if node != null then node.parent = self
	end
	redef fun n_visibility=(node)
	do
		_n_visibility = node
		node.parent = self
	end
	redef fun n_kwvar=(node)
	do
		_n_kwvar = node
		node.parent = self
	end
	redef fun n_id2=(node)
	do
		_n_id2 = node
		node.parent = self
	end
	redef fun n_type=(node)
	do
		_n_type = node
		if node != null then node.parent = self
	end
	redef fun n_assign=(node)
	do
		_n_assign = node
		if node != null then node.parent = self
	end
	redef fun n_expr=(node)
	do
		_n_expr = node
		if node != null then node.parent = self
	end
	redef fun n_annotations=(node)
	do
		_n_annotations = node
		if node != null then node.parent = self
	end
	redef fun n_kwdo=(node)
	do
		_n_kwdo = node
		if node != null then node.parent = self
	end
	redef fun n_block=(node)
	do
		_n_block = node
		if node != null then node.parent = self
	end
	redef fun n_kwend=(node)
	do
		_n_kwend = node
		if node != null then node.parent = self
	end


	redef fun visit_all(v: Visitor)
	do
		v.enter_visit(_n_doc)
		v.enter_visit(_n_kwredef)
		v.enter_visit(_n_visibility)
		v.enter_visit(_n_kwvar)
		v.enter_visit(_n_id2)
		v.enter_visit(_n_type)
		v.enter_visit(_n_assign)
		v.enter_visit(_n_expr)
		v.enter_visit(_n_annotations)
		v.enter_visit(_n_kwdo)
		v.enter_visit(_n_block)
		v.enter_visit(_n_kwend)
	end
end
src/parser/parser_prod.nit:819,1--990,3

nitc :: modelize_property $ AAttrPropdef
redef class AAttrPropdef
	redef type MPROPDEF: MAttributeDef

	# The static type of the property (declared, inferred or inherited)
	# This attribute is also used to check if the property was analyzed and is valid.
	var mtype: nullable MType

	# Is the node tagged `noinit`?
	var noinit = false

	# Is the node tagged lazy?
	var is_lazy = false

	# Is the node tagged optional?
	var is_optional = false

	# Does the node have a default value?
	# Could be through `n_expr`, `n_block` or `is_lazy`
	var has_value = false

	# The name of the attribute
	# Note: The name of the attribute is in reality the name of the mreadpropdef
	var name: String = n_id2.text is lazy

	# The guard associated to a lazy attribute.
	# Because some engines does not have a working `isset`,
	# this additional attribute is used to guard the lazy initialization.
	# TODO: to remove once isset is correctly implemented
	var mlazypropdef: nullable MAttributeDef

	# The associated getter (read accessor) if any
	var mreadpropdef: nullable MMethodDef is writable
	# The associated setter (write accessor) if any
	var mwritepropdef: nullable MMethodDef is writable

	redef fun build_property(modelbuilder, mclassdef)
	do
		var mclass = mclassdef.mclass

		var atabstract = self.get_single_annotation("abstract", modelbuilder)

		if atabstract == null then build_attribute_property(modelbuilder, mclassdef)

		# Construction of the read property. If it's not correctly built just return.
		if not build_read_property(modelbuilder, mclassdef) then return

		if atabstract != null then mreadpropdef.is_abstract = true

		has_value = n_expr != null or n_block != null

		if atabstract != null and has_value then
			modelbuilder.error(atabstract, "Error: `abstract` attributes cannot have an initial value.")
			return
		end

		var atnoinit = self.get_single_annotation("noinit", modelbuilder)
		if atnoinit == null then atnoinit = self.get_single_annotation("noautoinit", modelbuilder)
		if atnoinit != null then
			noinit = true
			if has_value then
				modelbuilder.error(atnoinit, "Error: `noautoinit` attributes cannot have an initial value.")
				return
			end
			if atabstract != null then
				modelbuilder.warning(atnoinit, "useless-noautoinit", "Warning: superfluous `noautoinit` on abstract attribute.")
			end
		end

		# Construction of the read property. If it's not correctly built just return.
		if not build_lazy_property(modelbuilder, mclassdef) then return

		var atoptional = self.get_single_annotation("optional", modelbuilder)
		if atoptional != null then
			if not has_value then
				modelbuilder.error(atoptional, "Error: `optional` attributes need a default value.")
			end
			is_optional = true
		end

		var atreadonly = self.get_single_annotation("readonly", modelbuilder)
		if atreadonly != null then
			if not has_value then
				modelbuilder.error(atreadonly, "Error: `readonly` attributes need a value.")
			end
			# No setter, so just leave
			return
		end

		if not mclassdef.is_intro and not has_value and not noinit then
			modelbuilder.advice(self, "attr-in-refinement", "Warning: attributes in refinement need a value or `noautoinit`.")
		end

		# Construction of the read property. If it's not correctly built just return.
		if not build_write_property(modelbuilder, mclassdef, false) then return

		if atabstract != null then mwritepropdef.is_abstract = true

		var atautoinit = self.get_single_annotation("autoinit", modelbuilder)
		if atautoinit != null then
			if has_value then
				modelbuilder.error(atautoinit, "Error: `autoinit` attributes cannot have an initial value.")
			else if not mwritepropdef.is_intro then
				modelbuilder.error(atautoinit, "Error: `autoinit` attributes cannot be set on redefinitions.")
			else if not mclassdef.is_intro then
				modelbuilder.error(atautoinit, "Error: `autoinit` attributes cannot be used in class refinements.")
			else if atabstract == null then
				modelbuilder.warning(atautoinit, "useless-autoinit", "Warning: superfluous `autoinit` on attribute.")
			end
		else if atabstract != null then
			# By default, abstract attribute are not autoinit
			noinit = true
		end
	end

	# Build the attribute property
	fun build_attribute_property(modelbuilder: ModelBuilder, mclassdef: MClassDef)
	do
		var mclass = mclassdef.mclass
		var attribute_name = "_" + name

		if not mclass.kind.need_init then
			modelbuilder.error(self, "Error: attempt to define attribute `{name}` in the {mclass.kind} `{mclass}`.")
		end
		var mprop = new MAttribute(mclassdef, "_" + name, self.location, private_visibility)
		var mpropdef = new MAttributeDef(mclassdef, mprop, self.location)
		self.mpropdef = mpropdef
		modelbuilder.mpropdef2npropdef[mpropdef] = self
	end

	# Build the read method property to get the value of the attribute
	# Return `true` if the property was correctly created else return `false`.
	# Warning the signature of the property is not set. This step is done by `build_signature`.
	fun build_read_property(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool
	do
		var mclass = mclassdef.mclass

		var readname = name
		var mreadprop = modelbuilder.try_get_mproperty_by_name(self, mclassdef, readname).as(nullable MMethod)
		if mreadprop == null then
			var mvisibility = new_property_visibility(modelbuilder, mclassdef, self.n_visibility)
			mreadprop = new MMethod(mclassdef, readname, self.location, mvisibility)
			if not self.check_redef_keyword(modelbuilder, mclassdef, n_kwredef, false, mreadprop) then
				mreadprop.is_broken = true
				return false
			end
		else
			if mreadprop.is_broken then return false
			if not self.check_redef_keyword(modelbuilder, mclassdef, n_kwredef, true, mreadprop) then return false
			check_redef_property_visibility(modelbuilder, self.n_visibility, mreadprop)
		end
		mclassdef.mprop2npropdef[mreadprop] = self

		var attr_mpropdef = mpropdef
		if attr_mpropdef != null then
			mreadprop.getter_for = attr_mpropdef.mproperty
			attr_mpropdef.mproperty.getter = mreadprop
		end

		var mreadpropdef = new MMethodDef(mclassdef, mreadprop, self.location)
		self.mreadpropdef = mreadpropdef
		modelbuilder.mpropdef2npropdef[mreadpropdef] = self
		set_doc(mreadpropdef, modelbuilder)
		if mpropdef != null then mpropdef.mdoc = mreadpropdef.mdoc

		return true
	end

	# Build the write method property to set the attribute value
	# Return `true` if the property was correctly created else return `false`.
	# Warning the signature of the property is not set.
	fun build_write_property(modelbuilder: ModelBuilder, mclassdef: MClassDef, is_same_visibility: Bool): Bool
	do
		var mclass = mclassdef.mclass

		var writename = name + "="
		var atwritable = self.get_single_annotation("writable", modelbuilder)
		if atwritable != null then
			if not atwritable.n_args.is_empty then
				writename = atwritable.arg_as_id(modelbuilder) or else writename
			end
		end
		var mwriteprop = modelbuilder.try_get_mproperty_by_name(self, mclassdef, writename).as(nullable MMethod)
		var nwkwredef: nullable Token = null
		if atwritable != null then nwkwredef = atwritable.n_kwredef
		if mwriteprop == null then
			var mvisibility
			if atwritable != null then
				mvisibility = new_property_visibility(modelbuilder, mclassdef, atwritable.n_visibility)
			else
				mvisibility = mreadpropdef.mproperty.visibility
				# By default, use protected visibility at most
				if mvisibility > protected_visibility and not is_same_visibility then mvisibility = protected_visibility
			end
			mwriteprop = new MMethod(mclassdef, writename, self.location, mvisibility)
			if not self.check_redef_keyword(modelbuilder, mclassdef, nwkwredef, false, mwriteprop) then
				mwriteprop.is_broken = true
				return false
			end
			mwriteprop.deprecation = mreadpropdef.mproperty.deprecation
		else
			if mwriteprop.is_broken then return false
			if not self.check_redef_keyword(modelbuilder, mclassdef, nwkwredef or else n_kwredef, true, mwriteprop) then return false
			if atwritable != null then
				check_redef_property_visibility(modelbuilder, atwritable.n_visibility, mwriteprop)
			end
		end
		mclassdef.mprop2npropdef[mwriteprop] = self

		var attr_mpropdef = mpropdef
		if attr_mpropdef != null then
			mwriteprop.setter_for = attr_mpropdef.mproperty
			attr_mpropdef.mproperty.setter = mwriteprop
		end

		var mwritepropdef = new MMethodDef(mclassdef, mwriteprop, self.location)
		self.mwritepropdef = mwritepropdef
		modelbuilder.mpropdef2npropdef[mwritepropdef] = self
		mwritepropdef.mdoc = mreadpropdef.mdoc

		return true
	end

	# Build the lazy attribute property
	# Return `true` if the property was correctly created else return `false`.
	fun build_lazy_property(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool
	do
		var mclass = mclassdef.mclass

		var atlazy = self.get_single_annotation("lazy", modelbuilder)
		var atlateinit = self.get_single_annotation("lateinit", modelbuilder)
		if atlazy != null or atlateinit != null then
			if atlazy != null and atlateinit != null then
				modelbuilder.error(atlazy, "Error: `lazy` incompatible with `lateinit`.")
				return false
			end
			if not has_value then
				if atlazy != null then
					modelbuilder.error(atlazy, "Error: `lazy` attributes need a value.")
				else if atlateinit != null then
					modelbuilder.error(atlateinit, "Error: `lateinit` attributes need a value.")
				end
				has_value = true
				return false
			end
			create_lazy
		end
		return true
	end

	redef fun build_signature(modelbuilder)
	do
		var mreadpropdef = self.mreadpropdef
		var mpropdef = self.mpropdef
		if mreadpropdef == null then return # Error thus skipped
		var mclassdef = mreadpropdef.mclassdef
		var mmodule = mclassdef.mmodule
		var mtype: nullable MType = null


		var ntype = self.n_type
		if ntype != null then
			mtype = modelbuilder.resolve_mtype_unchecked(mclassdef, ntype, true)
			if mtype == null then return
		end

		var inherited_type: nullable MType = null
		# Inherit the type from the getter (usually an abstract getter)
		if not mreadpropdef.is_intro then
			var msignature = mreadpropdef.mproperty.intro.msignature
			if msignature == null then return # Error, thus skipped
			inherited_type = msignature.return_mtype
			if inherited_type != null then
				# The inherited type is adapted to use the local formal types, if any.
				inherited_type = inherited_type.resolve_for(mclassdef.mclass.mclass_type, mclassdef.bound_mtype, mmodule, false)
				if mtype == null then mtype = inherited_type
			end
		end

		var nexpr = self.n_expr
		if mtype == null then
			if nexpr != null then
				mtype = infer_static_type(modelbuilder, nexpr, mclassdef, mmodule, mreadpropdef)
				if mtype == null then return
			end
		else if ntype != null and inherited_type == mtype then
			if nexpr isa ANewExpr then
				var xmtype = modelbuilder.resolve_mtype_unchecked(mclassdef, nexpr.n_type, true)
				if xmtype == mtype then
					modelbuilder.advice(ntype, "useless-type", "Warning: useless type definition")
				end
			end
		end

		if mtype == null then
			modelbuilder.error(self, "Error: untyped attribute `{mreadpropdef}`.")
			return
		end

		self.mtype = mtype

		if mpropdef != null then
			mpropdef.static_mtype = mtype
		end

		build_read_signature

		if self.mwritepropdef != null then build_write_signature

		var mlazypropdef = self.mlazypropdef
		if mlazypropdef != null then
			mlazypropdef.static_mtype = mmodule.bool_type
		end
		check_repeated_types(modelbuilder)
	end

	# Build the read method signature
	# `except`: mreadpropdef != null
	# `expect`: mtype != null
	fun build_read_signature
	is
		expect(mreadpropdef != null and mtype != null)
	do
		var msignature = new MSignature(new Array[MParameter], mtype)
		mreadpropdef.msignature = msignature
	end

	# Build the write method signature
	# `except`: mwritepropdef != null
	# `expect`: mtype != null
	fun build_write_signature
	is
		expect(mwritepropdef != null and mtype != null)
	do
		var mwritetype = mtype.as(not null)
		if is_optional then
			mwritetype = mwritetype.as_nullable
		end
		var mparameter = new MParameter(name, mwritetype, false)
		var msignature = new MSignature([mparameter], null)
		mwritepropdef.msignature = msignature
	end

	# Create a new setter for the attribute.
	#
	# `modelbuilder`: It's used to link the new `mwritepropdef` and `self`
	# `visibility`: Is the setter has the same visibilty of the `mreadpropdef`.
	#	If `not is_same_visibility and mreadpropdef.mproperty.visibility > protected_visibility` the `mwritepropdef` visibility will be set to protected.
	fun create_setter(modelbuilder: ModelBuilder, is_same_visibility: nullable Bool): AAttrPropdef
	is
		expect(mreadpropdef != null) # Use to define the visibility, the mclassdef and the doc of the `mwritepropdef`
	do
		if mwritepropdef != null then return self # Self already has a `mwritepropdef`
		var same_visibility = false
		if is_same_visibility != null then same_visibility = is_same_visibility

		self.build_write_property(modelbuilder, mreadpropdef.mclassdef, same_visibility)
		self.build_write_signature
		return self
	end

	# Set the default `self` value
	#
	# `expr`: Represents the default value of the attribute. If `expr isa ABlockExpr` `self.n_block` will be set.
	fun define_default(expr: AExpr): AAttrPropdef
	do
		self.has_value = true
		if expr isa ABlockExpr then
			self.n_block = expr
		else
			self.n_expr = expr
		end
		return self
	end

	# Set `self` as optional
	fun define_as_optional: AAttrPropdef
	is
		expect(has_value)
	do
		is_optional = true
		return self
	end

	# Create the lazy attribute.
	#
	# see `mlazypropdef` for more information about this property.
	fun create_lazy: AAttrPropdef
	is
		expect(has_value and mpropdef != null) # The only way to get a null `mpropdef` is when the attribute is defined as `abstract`. But if the attribute has a value, it cannot be abstract.
	do
		if self.mlazypropdef != null then return self # Self already has a `mlazypropdef`
		is_lazy = true
		var mlazyprop = new MAttribute(mpropdef.mclassdef, "lazy _" + name, self.location, none_visibility)
		mlazyprop.is_fictive = true
		var mlazypropdef = new MAttributeDef(mpropdef.mclassdef, mlazyprop, self.location)
		mlazypropdef.is_fictive = true
		self.mlazypropdef = mlazypropdef
		return self
	end

	# Detect the static type from the value assigned to the attribute `self`
	#
	# Return the static type if it can be safely inferred.
	private fun infer_static_type(modelbuilder: ModelBuilder, nexpr: AExpr,
		mclassdef: MClassDef, mmodule: MModule, mreadpropdef: MPropDef): nullable MType
	do
		var mtype = null
		if nexpr isa ANewExpr then
			mtype = modelbuilder.resolve_mtype_unchecked(mclassdef, nexpr.n_type, true)
		else if nexpr isa AAsCastExpr then
			mtype = modelbuilder.resolve_mtype_unchecked(mclassdef, nexpr.n_type, true)
		else if nexpr isa AIntegerExpr then
			var cla: nullable MClass = null
			if nexpr.value isa Int then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Int")
			else if nexpr.value isa Byte then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Byte")
			else if nexpr.value isa Int8 then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Int8")
			else if nexpr.value isa Int16 then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Int16")
			else if nexpr.value isa UInt16 then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "UInt16")
			else if nexpr.value isa Int32 then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Int32")
			else if nexpr.value isa UInt32 then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "UInt32")
			else
				# Should not happen, and should be updated as new types are added
				abort
			end
			if cla != null then mtype = cla.mclass_type
		else if nexpr isa AFloatExpr then
			var cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Float")
			if cla != null then mtype = cla.mclass_type
		else if nexpr isa ACharExpr then
			var cla: nullable MClass
			if nexpr.is_code_point then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Int")
			else
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Char")
			end
			if cla != null then mtype = cla.mclass_type
		else if nexpr isa ABoolExpr then
			var cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Bool")
			if cla != null then mtype = cla.mclass_type
		else if nexpr isa ASuperstringExpr then
			var cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "String")
			if cla != null then mtype = cla.mclass_type
		else if nexpr isa AStringFormExpr then
			var cla: nullable MClass
			if nexpr.is_bytestring then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Bytes")
			else if nexpr.is_re then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "Regex")
			else if nexpr.is_string then
				cla = modelbuilder.try_get_mclass_by_name(nexpr, mmodule, "String")
			else
				abort
			end
			if cla != null then mtype = cla.mclass_type
		else if nexpr isa AArrayExpr and nexpr.n_type == null and nexpr.n_exprs.not_empty then
			# Non-empty arrays without an explicit type

			var item_mtypes = new Set[MType]
			var fails = false
			for node in nexpr.n_exprs do
				var item_mtype = infer_static_type(modelbuilder, node, mclassdef, mmodule, mreadpropdef)
				if item_mtype == null then
					fails = true
				else
					item_mtypes.add item_mtype
				end
			end

			if fails then return null # Failed to infer some types

			if item_mtypes.length > 1 then
				modelbuilder.error(self, "Type Error: ambiguous array type {item_mtypes.join(" ")}")
			end

			mtype = mmodule.array_type(item_mtypes.first)
		else if nexpr isa AUminusExpr and (nexpr.n_expr isa AIntegerExpr or nexpr.n_expr isa AFloatExpr) then
			# The Int and Float unary - is defined in `kernel`, so this may
			# result in an invalid behavior when using a custom kernel.
			# A workaround is to declare the attribute static type.
			# This is still very useful, especially to novice programmers.
			mtype = infer_static_type(modelbuilder, nexpr.n_expr, mclassdef, mmodule, mreadpropdef)
		else if nexpr isa AOnceExpr then
			mtype = infer_static_type(modelbuilder, nexpr.n_expr, mclassdef, mmodule, mreadpropdef)
		else
			modelbuilder.error(self, "Error: untyped attribute `{mreadpropdef}`. Implicit typing allowed only for literals and new.")
		end
		return mtype
	end

	redef fun check_signature(modelbuilder)
	do
		var mpropdef = self.mpropdef
		if mpropdef == null then return # Error thus skipped
		var ntype = self.n_type
		var mtype = self.mtype
		if mtype == null then return # Error thus skipped

		var mclassdef = mpropdef.mclassdef
		var mmodule = mclassdef.mmodule

		# Check types
		if ntype != null then
			if modelbuilder.resolve_mtype(mclassdef, ntype) == null then return
		end
		var nexpr = n_expr
		if nexpr isa ANewExpr then
			if modelbuilder.resolve_mtype(mclassdef, nexpr.n_type) == null then return
		end

		# Lookup for signature in the precursor
		# FIXME all precursors should be considered
		if not mpropdef.is_intro then
			var precursor_type = mpropdef.mproperty.intro.static_mtype
			if precursor_type == null then return

			if mtype != precursor_type then
				modelbuilder.error(ntype.as(not null), "Redef Error: expected `{precursor_type}` type as a bound; got `{mtype}`.")
				return
			end
		end

		# Check getter and setter
		var meth = self.mreadpropdef
		if meth != null then
			self.check_method_signature(modelbuilder, meth)
			var node: nullable ANode = ntype
			if node == null then node = self
			modelbuilder.check_visibility(node, mtype, meth)
		end
		meth = self.mwritepropdef
		if meth != null then
			self.check_method_signature(modelbuilder, meth)
			var node: nullable ANode = ntype
			if node == null then node = self
			modelbuilder.check_visibility(node, mtype, meth)
		end
	end

	private fun check_method_signature(modelbuilder: ModelBuilder, mpropdef: MMethodDef)
	do
		var mclassdef = mpropdef.mclassdef
		var mmodule = mclassdef.mmodule
		var nsig = self.n_type
		var mysignature = mpropdef.msignature
		if mysignature == null then return # Error thus skiped

		# Lookup for signature in the precursor
		# FIXME all precursors should be considered
		if not mpropdef.is_intro then
			var msignature = mpropdef.mproperty.intro.msignature
			if msignature == null then return

			if mysignature.arity != msignature.arity then
				var node: ANode
				if nsig != null then node = nsig else node = self
				modelbuilder.error(node, "Redef Error: expected {msignature.arity} parameter(s) for `{mpropdef.mproperty.name}{msignature}`; got {mysignature.arity}. See introduction at `{mpropdef.mproperty.full_name}`.")
				return
			end
			var precursor_ret_type = msignature.return_mtype
			var ret_type = mysignature.return_mtype
			if ret_type != null and precursor_ret_type == null then
				var node: ANode
				if nsig != null then node = nsig else node = self
				modelbuilder.error(node, "Redef Error: `{mpropdef.mproperty}` is a procedure, not a function.")
				return
			end

			if mysignature.arity > 0 then
				# Check parameters types
				for i in [0..mysignature.arity[ do
					var myt = mysignature.mparameters[i].mtype
					var prt = msignature.mparameters[i].mtype
					var node: ANode
					if nsig != null then node = nsig else node = self
					if not modelbuilder.check_sametype(node, mmodule, mclassdef.bound_mtype, myt, prt) then
						modelbuilder.error(node, "Redef Error: expected `{prt}` type for parameter `{mysignature.mparameters[i].name}'; got `{myt}`.")
					end
				end
			end
			if precursor_ret_type != null then
				var node: ANode
				if nsig != null then node = nsig else node = self
				if ret_type == null then
					# Inherit the return type
					ret_type = precursor_ret_type
				else if not modelbuilder.check_subtype(node, mmodule, mclassdef.bound_mtype, ret_type, precursor_ret_type) then
					modelbuilder.error(node, "Redef Error: expected `{precursor_ret_type}` return type; got `{ret_type}`.")
				end
			end
		end
	end

	# Type is useless if the attribute type is the same thant the intro.
	redef fun check_repeated_types(modelbuilder) do
		var mreadpropdef = self.mreadpropdef
		if mreadpropdef == null then return
		if mreadpropdef.is_intro or n_type == null then return
		# get intro
		var intro = mreadpropdef.mproperty.intro
		var n_intro = modelbuilder.mpropdef2npropdef.get_or_null(intro)
		if n_intro == null then return
		# get intro type
		var ntype = null
		if n_intro isa AMethPropdef then
			ntype = n_intro.n_signature.ret_type
		else if n_intro isa AAttrPropdef and n_intro.n_type != null then
			ntype = n_intro.n_type.mtype
		end
		# check
		if ntype == null or ntype != n_type.mtype or mpropdef == null then return
		modelbuilder.advice(n_type, "useless-signature", "Warning: useless type repetition on redefined attribute `{mpropdef.name}`")
	end
end
src/modelize/modelize_property.nit:1175,1--1794,3

nitc :: pretty $ AAttrPropdef
redef class AAttrPropdef
	redef fun accept_pretty_printer(v) do
		super
		v.visit n_kwvar
		v.adds
		v.visit n_id2

		if n_type != null then
			v.consume ":"
			v.adds
			v.visit n_type
		end

		if n_expr != null then
			v.adds
			v.consume "="
			v.adds
			v.visit n_expr
		end

		var annot_inline = visit_annotations(v, n_annotations)
		visit_block(v, n_block, annot_inline)
		v.finish_line
		v.addn
	end

	redef fun first_token do
		if n_doc != null then return n_doc.first_token
		if not n_visibility isa APublicVisibility then return n_visibility.first_token
		if n_kwredef != null then return n_kwredef
		return n_kwvar
	end

	redef fun is_inlinable do return true
end
src/pretty.nit:907,1--941,3

nitc :: serialization_model_phase $ AAttrPropdef
redef class AAttrPropdef
	# Name of this attribute in the serialized format
	private var serialize_name: String = name is lazy
end
src/frontend/serialization_model_phase.nit:269,1--272,3

nitc :: typing $ AAttrPropdef
redef class AAttrPropdef
	redef fun do_typing(modelbuilder: ModelBuilder)
	do
		if not has_value then return

		var mpropdef = self.mreadpropdef
		if mpropdef == null or mpropdef.msignature == null then return # skip error

		var v = new TypeVisitor(modelbuilder, mpropdef)
		self.selfvariable = v.selfvariable

		var nexpr = self.n_expr
		if nexpr != null then
			var mtype = self.mtype
			v.visit_expr_subtype(nexpr, mtype)
		end
		var nblock = self.n_block
		if nblock != null then
			v.visit_stmt(nblock)
			if not nblock.after_flow_context.is_unreachable then
				# We reach the end of the init without having a return, it is bad
				v.error(self, "Error: reached end of block; expected `return`.")
			end
		end
	end
end
src/semantize/typing.nit:961,1--986,3

nitc :: astbuilder $ AAttrPropdef
redef class AAttrPropdef

	# Create a new `AAttrPropdef`
	# Note: By default if the `AVisibility` is not given the visibility is set to public
	private init make(name: String,
					n_type: nullable AType,
					n_visibility: nullable AVisibility,
					initial_value: nullable AExpr,
					n_block: nullable AExpr,
					m_attributedef: nullable MAttributeDef,
					m_setterdef: nullable MMethodDef,
					m_getterdef: nullable MMethodDef)
	do
		# Set the model type
		if n_type != null then mtype = n_type.mtype
		# Define the visibility default is public
		if n_visibility == null then n_visibility = new APublicVisibility
		init_aattrpropdef(null, null, n_visibility, new TKwvar, new TId, n_type, null, initial_value, null, null , n_block, null)
		# Set the name of the attribute
		_n_id2.text = name
		_mpropdef = m_attributedef
		_mreadpropdef = m_getterdef
		_mwritepropdef = m_setterdef
		if initial_value != null or n_block != null then has_value = true
		if m_attributedef != null then self.location = m_attributedef.location
	end
end
src/astbuilder.nit:335,1--361,3

nitc :: naive_interpreter $ AAttrPropdef
redef class AAttrPropdef
	redef fun call(v, mpropdef, args)
	do
		var recv = args.first
		assert recv isa MutableInstance
		var attr = self.mpropdef.mproperty
		if mpropdef == mreadpropdef then
			assert args.length == 1
			if not is_lazy or v.isset_attribute(attr, recv) then return v.read_attribute(attr, recv)
			var f = v.new_frame(self, mpropdef, args)
			return evaluate_expr(v, recv, f)
		else if mpropdef == mwritepropdef then
			assert args.length == 2
			var arg = args[1]
			if is_optional and arg.is_null then
				var f = v.new_frame(self, mpropdef, args)
				arg = evaluate_expr(v, recv, f)
			end
			v.write_attribute(attr, recv, arg)
			return null
		else
			abort
		end
	end

	# Evaluate and set the default value of the attribute in `recv`
	private fun init_expr(v: NaiveInterpreter, recv: Instance)
	do
		if is_lazy or is_optional then return
		if has_value then
			var f = v.new_frame(self, mreadpropdef.as(not null), [recv])
			evaluate_expr(v, recv, f)
			return
		end
		var mpropdef = self.mpropdef
		if mpropdef == null then return
		var mtype = self.mtype.as(not null)
		mtype = mtype.anchor_to(v.mainmodule, recv.mtype.as(MClassType))
		if mtype isa MNullableType then
			v.write_attribute(self.mpropdef.mproperty, recv, v.null_instance)
		end
	end

	private fun evaluate_expr(v: NaiveInterpreter, recv: Instance, f: Frame): Instance
	do
		assert recv isa MutableInstance
		v.frames.unshift(f)

		var val

		var nexpr = self.n_expr
		var nblock = self.n_block
		if nexpr != null then
			val = v.expr(nexpr)
		else if nblock != null then
			v.stmt(nblock)
			assert v.escapemark == return_mark
			val = v.escapevalue
			v.escapemark = null
		else
			abort
		end
		assert val != null

		v.frames.shift
		assert not v.is_escaping
		v.write_attribute(self.mpropdef.mproperty, recv, val)
		return val
	end
end
src/interpreter/naive_interpreter.nit:1555,1--1624,3

nitc :: abstract_compiler $ AAttrPropdef
redef class AAttrPropdef
	redef fun can_inline: Bool do return not is_lazy

	redef fun compile_to_c(v, mpropdef, arguments)
	do
		if mpropdef == mreadpropdef then
			assert arguments.length == 1
			var recv = arguments.first
			var res
			if is_lazy then
				var set
				var ret = self.mtype
				var useiset = not ret.is_c_primitive and not ret isa MNullableType
				var guard = self.mlazypropdef.mproperty
				if useiset then
					set = v.isset_attribute(self.mpropdef.mproperty, recv)
				else
					set = v.read_attribute(guard, recv)
				end
				v.add("if(likely({set})) \{")
				res = v.read_attribute(self.mpropdef.mproperty, recv)
				v.add("\} else \{")

				var value = evaluate_expr(v, recv)

				v.assign(res, value)
				if not useiset then
					var true_v = v.bool_instance(true)
					v.write_attribute(guard, arguments.first, true_v)
				end
				v.add("\}")
			else
				res = v.read_attribute(self.mpropdef.mproperty, arguments.first)
			end
			v.assign(v.frame.returnvar.as(not null), res)
		else if mpropdef == mwritepropdef then
			assert arguments.length == 2
			var recv = arguments.first
			var arg = arguments[1]
			if is_optional and v.maybe_null(arg) then
				var value = v.new_var(self.mpropdef.static_mtype.as(not null))
				v.add("if ({arg} == NULL) \{")
				v.assign(value, evaluate_expr(v, recv))
				v.add("\} else \{")
				v.assign(value, arg)
				v.add("\}")
				arg = value
			end
			v.write_attribute(self.mpropdef.mproperty, arguments.first, arg)
			if is_lazy then
				var ret = self.mtype
				var useiset = not ret.is_c_primitive and not ret isa MNullableType
				if not useiset then
					v.write_attribute(self.mlazypropdef.mproperty, arguments.first, v.bool_instance(true))
				end
			end
		else
			abort
		end
	end

	fun init_expr(v: AbstractCompilerVisitor, recv: RuntimeVariable)
	do
		if has_value and not is_lazy and not is_optional and not n_expr isa ANullExpr then evaluate_expr(v, recv)
	end

	# Evaluate, store and return the default value of the attribute
	private fun evaluate_expr(v: AbstractCompilerVisitor, recv: RuntimeVariable): RuntimeVariable
	do
		var oldnode = v.current_node
		v.current_node = self
		var old_frame = v.frame
		var frame = new StaticFrame(v, self.mreadpropdef.as(not null), recv.mcasttype.undecorate.as(MClassType), [recv])
		v.frame = frame

		var value
		var mtype = self.mtype
		assert mtype != null

		var nexpr = self.n_expr
		var nblock = self.n_block
		if nexpr != null then
			value = v.expr(nexpr, mtype)
		else if nblock != null then
			value = v.new_var(mtype)
			frame.returnvar = value
			frame.returnlabel = v.get_name("RET_LABEL")
			v.add("\{")
			v.stmt(nblock)
			v.add("{frame.returnlabel.as(not null)}:(void)0;")
			v.add("\}")
		else
			abort
		end

		v.write_attribute(self.mpropdef.mproperty, recv, value)

		v.frame = old_frame
		v.current_node = oldnode

		return value
	end

	fun check_expr(v: AbstractCompilerVisitor, recv: RuntimeVariable)
	do
		var nexpr = self.n_expr
		if nexpr != null then return

		var oldnode = v.current_node
		v.current_node = self
		var old_frame = v.frame
		var frame = new StaticFrame(v, self.mpropdef.as(not null), recv.mtype.as(MClassType), [recv])
		v.frame = frame
		# Force read to check the initialization
		v.read_attribute(self.mpropdef.mproperty, recv)
		v.frame = old_frame
		v.current_node = oldnode
	end
end
src/compiler/abstract_compiler.nit:3561,1--3679,3

nitc :: separate_compiler $ AAttrPropdef
redef class AAttrPropdef
	redef fun init_expr(v, recv)
	do
		super
		if is_lazy and v.compiler.modelbuilder.toolcontext.opt_no_union_attribute.value then
			var guard = self.mlazypropdef.mproperty
			v.write_attribute(guard, recv, v.bool_instance(false))
		end
	end
end
src/compiler/separate_compiler.nit:2666,1--2675,3

nitc :: ssa $ AAttrPropdef
redef class AAttrPropdef
	redef fun generate_basic_blocks(ssa: SSA)
	do
		basic_block = new BasicBlock
		basic_block.first = self
		basic_block.last = self

		# Add the return variable
		variables.add(returnvar)

		# Add the self variable
		if self.selfvariable != null then variables.add(selfvariable.as(not null))

		# Recursively goes into the nodes
		if n_block != null then
			n_block.generate_basic_blocks(ssa, basic_block.as(not null))
			is_generated = true
		end
	end
end
src/ssa.nit:471,1--490,3

nitc :: variables_numbering $ AAttrPropdef
redef class AAttrPropdef
	# Assign a position in the environment to each local variable
	# *`vm` The current VirtualMachine
	redef fun numbering_variables(vm: VirtualMachine)
	do
		# The position in the environment
		var position = 0

		# The `self` variable has the first position
		if self.selfvariable != null then
			self.selfvariable.position = position
			position += 1
		end

		# Recursively go into the AST nodes to number all local variables
		if n_block != null then
			position = vm.numbering(self.n_block, position)
		end

		is_numbering = true

		# The size of the environment to create to execute a call to this method
		environment_size = position
	end
end
src/vm/variables_numbering.nit:152,1--176,3

nitc :: java_compiler $ AAttrPropdef
redef class AAttrPropdef
	redef fun compile_to_java(v, mpropdef, arguments) do
		v.current_node = self
		if mpropdef == mreadpropdef then
			compile_getter(v, mpropdef, arguments)
		else if mpropdef == mwritepropdef then
			compile_setter(v, mpropdef, arguments)
		else
			abort
		end
		v.current_node = null
	end

	# Compile the setter method
	private fun compile_setter(v: JavaCompilerVisitor, mpropdef: MPropDef, arguments: Array[RuntimeVariable]) do
		var mtype = v.compiler.mainmodule.object_type
		var recv = arguments.first
		var val = v.new_expr("args[1]", mtype)
		v.write_attribute(self.mpropdef.as(not null).mproperty, recv, val)
		v.ret v.null_instance
	end

	# Compile the getter method
	private fun compile_getter(v: JavaCompilerVisitor, mpropdef: MPropDef, arguments: Array[RuntimeVariable]) do
		var recv = arguments.first
		v.ret v.read_attribute(self.mpropdef.as(not null).mproperty, recv)
	end

	private fun init_expr(v: JavaCompilerVisitor, recv: RuntimeVariable) do
		if has_value and not is_lazy and not n_expr isa ANullExpr then evaluate_expr(v, recv)
	end

	# Evaluate, store and return the default value of the attribute
	private fun evaluate_expr(v: JavaCompilerVisitor, recv: RuntimeVariable): RuntimeVariable do
		var old = v.frame
		var frame = new JavaStaticFrame(v, self.mreadpropdef.as(not null), recv.mcasttype.undecorate.as(MClassType), [recv])
		v.frame = frame

		var value
		var mtype = self.mtype
		assert mtype != null

		var nexpr = self.n_expr
		var nblock = self.n_block
		if nexpr != null then
			value = v.expr(nexpr, mtype)
		else if nblock != null then
			value = v.new_var(mtype)
			frame.returnvar = value
			frame.returnlabel = v.get_name("RET_LABEL")
			v.add("{frame.returnlabel.as(not null)}: \{")
			v.stmt(nblock)
			v.add("\}")
		else
			abort
		end

		v.write_attribute(self.mpropdef.as(not null).mproperty, recv, value)
		v.frame = old
		return value
	end
end
src/compiler/java_compiler.nit:1840,1--1901,3

nitc :: htmlight $ AAttrPropdef
redef class AAttrPropdef
	redef fun decorate_tag(v, res, token)
	do
		if not token isa TId then return null
		res.add_class("nc_def")
		var mpd: nullable MPropDef
		mpd = mreadpropdef
		if mpd == null then mpd = mpropdef
		if mpd == null then return null
		return mpd.infobox(v)
	end
end
src/htmlight.nit:964,1--975,3