While most definitions are AStdClassdef
s,
there are 2 special cases of class definitions.
nitc :: AClassdef :: _build_properties_is_done
Marker used inModelBuilder::build_properties
nitc :: AClassdef :: _mclassdef
The associated MClassDef once build by aModelBuilder
nitc :: AClassdef :: _n_propdefs
All the declared properties (including the main method)nitc :: AClassdef :: build_properties_is_done
Marker used inModelBuilder::build_properties
nitc :: AClassdef :: build_properties_is_done=
Marker used inModelBuilder::build_properties
mpropdef
associated with the current node.
nitc :: AClassdef :: compile_to_c
nitc :: AClassdef :: compile_to_java
nitc :: AClassdef :: defaultinit
nitc :: AClassdef :: mclassdef=
The associated MClassDef once build by aModelBuilder
nitc :: AClassdef :: n_propdefs
All the declared properties (including the main method)nitc :: AClassdef :: n_propdefs=
All the declared properties (including the main method)nitc :: pretty $ AClassdef :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: AClassdef :: _build_properties_is_done
Marker used inModelBuilder::build_properties
nitc :: Prod :: _first_location
Location on the first token after the start of a productionnitc :: Prod :: _first_token
The first token of the production in the ASTnitc :: ANode :: _is_broken
The indication that the node did not pass some semantic verifications.nitc :: Prod :: _last_token
The last token of the production in the ASTnitc :: AClassdef :: _mclassdef
The associated MClassDef once build by aModelBuilder
nitc :: Prod :: _n_annotations
All the annotations attached directly to the nodenitc :: AClassdef :: _n_propdefs
All the declared properties (including the main method)nitc :: ANode :: accept_ast_validation
nitc :: ANode :: accept_auto_super_init
nitc :: ANode :: accept_flow_visitor
nitc :: ANode :: accept_forward_analysis
Apply the forward analysisv
to self
.
nitc :: ANode :: accept_literal
nitc :: ANode :: accept_post_typing
nitc :: ANode :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: ANode :: accept_reaching_defs
Apply a ReachingDefsAnalysis toself
.
nitc :: ANode :: accept_regex_visitor
nitc :: ANode :: accept_scope_visitor
nitc :: ANode :: accept_simple_misc
nitc :: ANode :: accept_string_finder
nitc :: ANode :: after_simple_misc
nitc :: ANode :: bad_expr_message
An additional information message to explain the role of a child expression.nitc :: AClassdef :: build_properties_is_done
Marker used inModelBuilder::build_properties
nitc :: AClassdef :: build_properties_is_done=
Marker used inModelBuilder::build_properties
mpropdef
associated with the current node.
nitc :: ANode :: check_callsite
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: ANode :: collect_annotations_by_name
Do a deep search and return an array of node that are annotatednitc :: Prod :: collect_comments
Collect allTComment
contained in the production
nitc :: ANode :: collect_length
Collect the length (inChar
) of the node.
nitc :: ANode :: collect_tokens_by_text
Do a deep search and return an array of tokens that match a given textnitc :: ANode :: common_parent
The most specific common parent betweenself
and other
nitc :: AClassdef :: compile_to_c
nitc :: AClassdef :: compile_to_java
nitc :: ANode :: create_contracts
nitc :: ANode :: decorate_tag
Add aditionnal information on a child-token and return an additionnal HInfoBox on itnitc :: Prod :: defaultinit
nitc :: ANode :: defaultinit
nitc :: AClassdef :: defaultinit
core :: Object :: defaultinit
core :: Cloneable :: defaultinit
nitc :: ANode :: do_cloneable
nitc :: Prod :: first_location
Location on the first token after the start of a productionnitc :: Prod :: first_location=
Location on the first token after the start of a productionnitc :: Prod :: first_token
The first token of the production in the ASTnitc :: Prod :: first_token=
The first token of the production in the ASTnitc :: ANode :: force_block=
Forceself
to be rendered as a block.
nitc :: ANode :: force_inline=
Forceself
to be rendered as a line.
nitc :: ANode :: full_transform_visitor
nitc :: Prod :: get_annotations
Return all its annotations of a given name in the order of their declarationnitc :: Prod :: get_single_annotation
Try to get its single annotation with a given namenitc :: ANode :: hot_location
The location of the important part of the node (identifier or whatever)nitc :: ANode :: is_broken=
The indication that the node did not pass some semantic verifications.nitc :: ANode :: is_noserialize
Is this node annotated to not be made serializable?core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: ANode :: is_serialize
Is this node annotated to be made serializable?nitc :: ANode :: is_structural
Isself
a token or a pure-structural production like AQId
?
nitc :: Prod :: last_token
The last token of the production in the ASTnitc :: Prod :: last_token=
The last token of the production in the ASTnitc :: AClassdef :: mclassdef=
The associated MClassDef once build by aModelBuilder
nitc :: ANode :: must_be_block
Doesself
have to be rendered as a block?
nitc :: ANode :: must_be_inline
Doesself
have be rendered as a line?
nitc :: Prod :: n_annotations
All the annotations attached directly to the nodenitc :: Prod :: n_annotations=
All the annotations attached directly to the nodenitc :: AClassdef :: n_propdefs
All the declared properties (including the main method)nitc :: AClassdef :: n_propdefs=
All the declared properties (including the main method)core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: ANode :: parentize_tokens
Visit the AST and computes advanced AST attributes on Tokens and Prodnitc :: ANode :: replace_child
Replace a child with an other node in the ASTnitc :: ANode :: replace_with
Replace itself with an other node in the ASTnitc :: Prod :: start_token
The token where the production really start (skipping ADoc).nitc :: ANode :: was_inline
Doesself
was written in one line before transformation?
nitc :: AStdClassdef
A standard class definition with a name, superclasses and properties
# A class definition
#
# While most definitions are `AStdClassdef`s,
# there are 2 special cases of class definitions.
abstract class AClassdef
super Prod
# All the declared properties (including the main method)
var n_propdefs = new ANodes[APropdef](self)
end
src/parser/parser_nodes.nit:1237,1--1245,3
redef class AClassdef
# The associated MClass once build by a `ModelBuilder`
var mclass: nullable MClass
# The associated MClassDef once build by a `ModelBuilder`
var mclassdef: nullable MClassDef
# All (self and other) definitions for the same mclassdef
var all_defs: nullable Array[AClassdef]
end
src/modelize/modelize_class.nit:513,1--520,3
redef class AClassdef
# Marker used in `ModelBuilder::build_properties`
private var build_properties_is_done = false
end
src/modelize/modelize_property.nit:517,1--520,3
redef class AClassdef
redef fun accept_pretty_printer(v) do
for n_propdef in n_propdefs do
v.catch_up n_propdef
if n_propdef.n_doc != null or not v.can_inline(n_propdef) then
if v.skip_empty and n_propdef != n_propdefs.first then v.addn
v.visit n_propdef
if v.skip_empty and n_propdef != n_propdefs.last then v.addn
else
v.visit n_propdef
end
end
end
end
src/pretty.nit:667,1--681,3
redef class AClassdef
# Execute an implicit `mpropdef` associated with the current node.
private fun call(v: NaiveInterpreter, mpropdef: MMethodDef, arguments: Array[Instance]): nullable Instance
do
if mpropdef.mproperty.is_root_init then
assert arguments.length == 1
if not mpropdef.is_intro then
# standard call-next-method
var superpd = mpropdef.lookup_next_definition(v.mainmodule, arguments.first.mtype)
v.call(superpd, arguments)
end
return null
else if mclassdef.default_init == mpropdef then
var recv = arguments.first
var initializers = mpropdef.initializers
var no_init = false
if not initializers.is_empty and not mpropdef.is_old_style_init then
var i = 1
for p in initializers do
if p isa MMethod then
var args = [recv]
for x in p.intro.msignature.mparameters do
args.add arguments[i]
i += 1
end
v.send(p, args)
if p.intro.is_calling_init then no_init = true
else if p isa MAttribute then
assert recv isa MutableInstance
v.write_attribute(p, recv, arguments[i])
i += 1
else abort
end
assert i == arguments.length
end
if not no_init then v.send(mclass.the_root_init_mmethod.as(not null), [recv])
return null
else
abort
end
end
end
src/interpreter/naive_interpreter.nit:1626,1--1667,3
redef class AClassdef
private fun compile_to_c(v: AbstractCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable])
do
if mpropdef.mproperty.is_root_init then
assert arguments.length == 1
if not mpropdef.is_intro then
v.supercall(mpropdef, arguments.first.mtype.as(MClassType), arguments)
end
return
else if mclassdef.default_init == mpropdef then
var recv = arguments.first
var initializers = mpropdef.initializers
var no_init = false
if not initializers.is_empty and not mpropdef.is_old_style_init then
var i = 1
for p in initializers do
if p isa MMethod then
var args = [recv]
for x in p.intro.msignature.mparameters do
args.add arguments[i]
i += 1
end
v.send(p, args)
if p.intro.is_calling_init then no_init = true
else if p isa MAttribute then
v.write_attribute(p, recv, arguments[i])
i += 1
else abort
end
assert i == arguments.length
end
if not no_init then v.send(mclass.the_root_init_mmethod.as(not null), [recv])
return
else
abort
end
end
end
src/compiler/abstract_compiler.nit:3681,1--3719,3
redef class AClassdef
private fun compile_to_java(v: JavaCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable]) do
if mpropdef.mproperty.is_root_init then
if not mpropdef.is_intro then
v.supercall(mpropdef, arguments.first.mtype.as(MClassType), arguments)
end
else
abort
end
end
end
src/compiler/java_compiler.nit:1483,1--1493,3