nitc :: ATypePropdef
nitc :: ATypePropdef :: defaultinit
nitc :: modelize_property $ ATypePropdef :: MPROPDEF
The associated main model entitynitc $ ATypePropdef :: SELF
Type of this instance, automatically specialized in every classnitc :: pretty $ ATypePropdef :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: htmlight $ ATypePropdef :: decorate_tag
Add aditionnal information on a child-token and return an additionnal HInfoBox on itnitc :: pretty $ ATypePropdef :: is_inlinable
Isself
printable in one line?
nitc :: parser_prod $ ATypePropdef :: n_annotations=
All the annotations attached directly to the nodenitc :: parser_prod $ ATypePropdef :: n_doc=
The documentationnitc :: parser_prod $ ATypePropdef :: n_kwredef=
Theredef
keyword
nitc :: parser_prod $ ATypePropdef :: n_qid=
The name of the virtual typenitc :: parser_prod $ ATypePropdef :: n_type=
The bound of the virtual typenitc :: parser_prod $ ATypePropdef :: n_visibility=
The declared visibilitynitc :: parser_prod $ ATypePropdef :: replace_child
Replace a child with an other node in the ASTnitc :: parser_prod $ ATypePropdef :: visit_all
Visit all nodes in order.nitc :: APropdef :: _after_flow_context
The ending flownitc :: APropdef :: _basic_block
The first basic block of the codenitc :: APropdef :: _before_flow_context
The starting flownitc :: APropdef :: _environment_size
The size of the environment to create to call this methodnitc :: 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 :: APropdef :: _is_compiled
Indicite if this propdef was compilenitc :: APropdef :: _is_generated
If true, the basic blocks where generatednitc :: APropdef :: _is_numbering
Indicate if the variables numbering has been donenitc :: APropdef :: _is_phased
Is the propdef already analyzed byrun_phases_on_npropdef
.
nitc :: Prod :: _last_token
The last token of the production in the ASTnitc :: Prod :: _n_annotations
All the annotations attached directly to the nodenitc :: ADefinition :: _n_visibility
The declared visibilitynitc :: APropdef :: _object_sites
Contain all AST-parts related to object mechanisms the propdef has:nitc :: APropdef :: _return_mark
The break escape mark associated with the returnnitc :: APropdef :: _selfvariable
The variable associated to the receiver (if any)nitc :: APropdef :: _variables
The variables contained in the body on this propdefnitc :: 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 :: APropdef :: after_flow_context=
The ending flownitc :: ANode :: after_simple_misc
nitc :: ANode :: bad_expr_message
An additional information message to explain the role of a child expression.nitc :: APropdef :: basic_block
The first basic block of the codenitc :: APropdef :: basic_block=
The first basic block of the codenitc :: APropdef :: before_flow_context
The starting flownitc :: APropdef :: before_flow_context=
The starting flownitc :: APropdef :: build_property
nitc :: APropdef :: build_signature
mpropdef
associated with the current node.
nitc :: APropdef :: can_inline
nitc :: ANode :: check_callsite
nitc :: APropdef :: check_redef_keyword
nitc :: APropdef :: check_repeated_types
Checks for useless type in redef signatures.nitc :: APropdef :: check_signature
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 :: APropdef :: compile_to_c
nitc :: APropdef :: compile_to_java
Compile that property definition to java codenitc :: APropdef :: compute_phi
Compute the first phase of SSA algorithm: placing phi-functionsnitc :: ANode :: create_contracts
nitc :: ANode :: decorate_tag
Add aditionnal information on a child-token and return an additionnal HInfoBox on itnitc :: APropdef :: defaultinit
core :: Object :: defaultinit
nitc :: ANode :: defaultinit
nitc :: ATypePropdef :: defaultinit
nitc :: Prod :: defaultinit
nitc :: ADefinition :: defaultinit
core :: Cloneable :: defaultinit
nitc :: ANode :: do_cloneable
nitc :: APropdef :: do_local_var_init
Entry point of the whole local variable initialization verifiernitc :: APropdef :: environment_size
The size of the environment to create to call this methodnitc :: APropdef :: environment_size=
The size of the environment to create to call this methodnitc :: 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 :: APropdef :: generate_basic_blocks
Generate all basic blocks for this codenitc :: 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 :: APropdef :: is_compiled=
Indicite if this propdef was compilenitc :: APropdef :: is_generated=
If true, the basic blocks where generatednitc :: ANode :: is_noserialize
Is this node annotated to not be made serializable?nitc :: APropdef :: is_numbering
Indicate if the variables numbering has been donenitc :: APropdef :: is_numbering=
Indicate if the variables numbering has been donenitc :: APropdef :: is_phased=
Is the propdef already analyzed byrun_phases_on_npropdef
.
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 :: 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 :: ADefinition :: n_visibility=
The declared visibilitycore :: Object :: native_class_name
The class name of the object in CString format.nitc :: APropdef :: numbering_variables
Numbering the variable inside the propdefnitc :: APropdef :: object_sites
Contain all AST-parts related to object mechanisms the propdef has:nitc :: APropdef :: object_sites=
Contain all AST-parts related to object mechanisms the propdef has: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 :: APropdef :: propagate_dependences
Propagate the dependences of the phi-functions into following variablesnitc :: APropdef :: rename_variables
Compute the second phase of SSA algorithm: renaming variablesnitc :: 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 :: APropdef :: return_mark
The break escape mark associated with the returnnitc :: APropdef :: return_mark=
The break escape mark associated with the returnnitc :: APropdef :: returnvar=
The return variable of the propdefnitc :: APropdef :: selfvariable
The variable associated to the receiver (if any)nitc :: APropdef :: selfvariable=
The variable associated to the receiver (if any)nitc :: APropdef :: ssa_destruction
Transform SSA-representation into an executable code (delete phi-functions)nitc :: Prod :: start_token
The token where the production really start (skipping ADoc).nitc :: APropdef :: variables=
The variables contained in the body on this propdefnitc :: APropdef :: visit_annotations
Factorize annotations visit for all APropdef.nitc :: APropdef :: visit_block
Factorize block visit for APropdefs.nitc :: ANode :: was_inline
Doesself
was written in one line before transformation?
# A definition of a virtual type
class ATypePropdef
super APropdef
# The `type` keyword
var n_kwtype: TKwtype is writable, noinit
# The name of the virtual type
var n_qid: AQclassid is writable, noinit
# The bound of the virtual type
var n_type: AType is writable, noinit
end
src/parser/parser_nodes.nit:1589,1--1601,3
redef class ATypePropdef
init init_atypepropdef (
n_doc: nullable ADoc,
n_kwredef: nullable TKwredef,
n_visibility: nullable AVisibility,
n_kwtype: nullable TKwtype,
n_qid: nullable AQclassid,
n_type: nullable AType,
n_annotations: nullable AAnnotations
)
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_kwtype = n_kwtype.as(not null)
n_kwtype.parent = self
_n_qid = n_qid.as(not null)
n_qid.parent = self
_n_type = n_type.as(not null)
n_type.parent = self
_n_annotations = n_annotations
if n_annotations != null then n_annotations.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_kwtype == old_child then
n_kwtype = new_child.as(TKwtype)
return
end
if _n_qid == old_child then
n_qid = new_child.as(AQclassid)
return
end
if _n_type == old_child then
n_type = new_child.as(AType)
return
end
if _n_annotations == old_child then
n_annotations = new_child.as(nullable AAnnotations)
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_kwtype=(node)
do
_n_kwtype = node
node.parent = self
end
redef fun n_qid=(node)
do
_n_qid = node
node.parent = self
end
redef fun n_type=(node)
do
_n_type = node
node.parent = self
end
redef fun n_annotations=(node)
do
_n_annotations = 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_kwtype)
v.enter_visit(_n_qid)
v.enter_visit(_n_type)
v.enter_visit(_n_annotations)
end
end
src/parser/parser_prod.nit:1033,1--1139,3
redef class ATypePropdef
redef type MPROPDEF: MVirtualTypeDef
redef fun build_property(modelbuilder, mclassdef)
do
var name = self.n_qid.n_id.text
var mprop = modelbuilder.try_get_mproperty_by_name(self.n_qid, mclassdef, name)
if mprop == null then
var mvisibility = new_property_visibility(modelbuilder, mclassdef, self.n_visibility)
mprop = new MVirtualTypeProp(mclassdef, name, self.location, mvisibility)
for c in name.chars do if c >= 'a' and c<= 'z' then
modelbuilder.warning(n_qid, "bad-type-name", "Warning: lowercase in the virtual type `{name}`.")
break
end
else
if mprop.is_broken then return
assert mprop isa MVirtualTypeProp
check_redef_property_visibility(modelbuilder, self.n_visibility, mprop)
end
var mpropdef = new MVirtualTypeDef(mclassdef, mprop, self.location)
self.mpropdef = mpropdef
if mpropdef.is_intro then
modelbuilder.toolcontext.info("{mpropdef} introduces new type {mprop.full_name}", 4)
else
modelbuilder.toolcontext.info("{mpropdef} redefines type {mprop.full_name}", 4)
end
if not self.check_redef_keyword(modelbuilder, mclassdef, self.n_kwredef, not mpropdef.is_intro, mprop) then
mpropdef.is_broken =true
end
mclassdef.mprop2npropdef[mprop] = self
modelbuilder.mpropdef2npropdef[mpropdef] = self
set_doc(mpropdef, modelbuilder)
var atfixed = get_single_annotation("fixed", modelbuilder)
if atfixed != null then
mpropdef.is_fixed = true
end
end
redef fun build_signature(modelbuilder)
do
var mpropdef = self.mpropdef
if mpropdef == null then return # Error thus skipped
var mclassdef = mpropdef.mclassdef
var mtype: nullable MType = null
var ntype = self.n_type
mtype = modelbuilder.resolve_mtype_unchecked(mclassdef, ntype, true)
if mtype == null then return
mpropdef.bound = mtype
# print "{mpropdef}: {mtype}"
end
redef fun check_signature(modelbuilder)
do
var mpropdef = self.mpropdef
if mpropdef == null then return # Error thus skipped
var bound = mpropdef.bound
if bound == null then return # Error thus skipped
modelbuilder.check_visibility(n_type, bound, mpropdef)
var mclassdef = mpropdef.mclassdef
var mmodule = mclassdef.mmodule
var anchor = mclassdef.bound_mtype
var ntype = self.n_type
if modelbuilder.resolve_mtype(mclassdef, ntype) == null then
mpropdef.bound = null
return
end
# Check redefinitions
for p in mpropdef.mproperty.lookup_super_definitions(mmodule, anchor) do
var supbound = p.bound
if supbound == null or supbound isa MBottomType or p.is_broken then break # broken super bound, skip error
if p.is_fixed then
modelbuilder.error(self, "Redef Error: virtual type `{mpropdef.mproperty}` is fixed in super-class `{p.mclassdef.mclass}`.")
break
end
if p.mclassdef.mclass == mclassdef.mclass then
modelbuilder.error(n_type, "Redef Error: a virtual type cannot be refined.")
break
end
if not modelbuilder.check_subtype(n_type, mmodule, anchor, bound, supbound) then
modelbuilder.error(n_type, "Redef Error: expected `{supbound}` bound type; got `{bound}`.")
break
end
end
end
end
src/modelize/modelize_property.nit:1796,1--1889,3
redef class ATypePropdef
redef fun accept_pretty_printer(v) do
super
v.visit n_kwtype
v.adds
v.visit n_qid
v.consume ":"
v.adds
v.visit n_type
visit_annotations(v, n_annotations)
v.finish_line
v.addn
end
redef fun is_inlinable do return true
end
src/pretty.nit:943,1--958,3