nitc :: ASuperExpr
super
. OR a call of a super-constructornitc :: ASuperExpr :: _callsite
The method to call if the super is in fact a 'super init call'nitc :: ASuperExpr :: _mpropdef
The method to call is the super is a standardcall-next-method
super-call
nitc :: ASuperExpr :: _n_qualified
The qualifier part before the super (currenlty unused)nitc :: ASuperExpr :: _signaturemap
The mapping used on the call to associate arguments to parameters.nitc :: ASuperExpr :: callsite
The method to call if the super is in fact a 'super init call'nitc :: ASuperExpr :: callsite=
The method to call if the super is in fact a 'super init call'nitc :: ASuperExpr :: defaultinit
nitc :: ASuperExpr :: init_asuperexpr
nitc :: ASuperExpr :: make
nitc :: ASuperExpr :: mpropdef
The method to call is the super is a standardcall-next-method
super-call
nitc :: ASuperExpr :: mpropdef=
The method to call is the super is a standardcall-next-method
super-call
nitc :: ASuperExpr :: n_qualified
The qualifier part before the super (currenlty unused)nitc :: ASuperExpr :: n_qualified=
The qualifier part before the super (currenlty unused)nitc :: ASuperExpr :: process_superinit
nitc :: ASuperExpr :: signaturemap
The mapping used on the call to associate arguments to parameters.nitc :: ASuperExpr :: signaturemap=
The mapping used on the call to associate arguments to parameters.nitc $ ASuperExpr :: SELF
Type of this instance, automatically specialized in every classnitc :: auto_super_init $ ASuperExpr :: accept_auto_super_init
nitc :: pretty $ ASuperExpr :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: rapid_type_analysis $ ASuperExpr :: accept_rapid_type_visitor
nitc :: typing $ ASuperExpr :: accept_typing
nitc :: java_compiler $ ASuperExpr :: expr
Try to compile self as an expressionnitc :: abstract_compiler $ ASuperExpr :: expr
Try to compile self as an expressionnitc :: naive_interpreter $ ASuperExpr :: expr
Evaluate the node as a possible expression.nitc :: ssa $ ASuperExpr :: generate_basic_blocks
Generate recursively basic block for this expressionnitc :: pretty $ ASuperExpr :: is_inlinable
Isself
printable in one line?
nitc :: parser_prod $ ASuperExpr :: n_args=
The arguments of the supernitc :: parser_prod $ ASuperExpr :: n_kwsuper=
Thesuper
keyword
nitc :: parser_prod $ ASuperExpr :: n_qualified=
The qualifier part before the super (currenlty unused)nitc :: parser_prod $ ASuperExpr :: replace_child
Replace a child with an other node in the ASTnitc :: parser_prod $ ASuperExpr :: visit_all
Visit all nodes in order.nitc :: AExpr :: _after_flow_context
The flow after the full evaluation of the expression/statementnitc :: ASuperExpr :: _callsite
The method to call if the super is in fact a 'super init call'nitc :: AExpr :: _comprehension
Is non-null ifself
is a leaf of a comprehension array construction.
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 :: AExpr :: _implicit_cast_to
If required, the following implicit cast.as(XXX)
nitc :: 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 :: ASuperExpr :: _mpropdef
The method to call is the super is a standardcall-next-method
super-call
nitc :: Prod :: _n_annotations
All the annotations attached directly to the nodenitc :: ASuperExpr :: _n_qualified
The qualifier part before the super (currenlty unused)nitc :: ASuperExpr :: _signaturemap
The mapping used on the call to associate arguments to parameters.nitc :: AExpr :: _vararg_decl
It indicates the number of arguments collected as a vararg.nitc :: AExpr :: _variable_cache
nitc :: ANode :: accept_ast_validation
nitc :: ANode :: accept_auto_super_init
nitc :: AExpr :: accept_explain_assert
Fillv
to explain this node if the parent assert fails
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 :: AExpr :: accept_typing
nitc :: AExpr :: after_flow_context
The flow after the full evaluation of the expression/statementnitc :: AExpr :: after_flow_context=
The flow after the full evaluation of the expression/statementnitc :: ANode :: after_simple_misc
nitc :: AExpr :: allocate_mtype
Make themtype
of the expression live
nitc :: ANode :: bad_expr_message
An additional information message to explain the role of a child expression.nitc :: ASuperExpr :: callsite
The method to call if the super is in fact a 'super init call'nitc :: ASuperExpr :: callsite=
The method to call if the super is in fact a 'super init call'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 :: AExpr :: comprehension
Is non-null ifself
is a leaf of a comprehension array construction.
nitc :: AExpr :: comprehension=
Is non-null ifself
is a leaf of a comprehension array construction.
nitc :: ANode :: create_contracts
nitc :: ANode :: decorate_tag
Add aditionnal information on a child-token and return an additionnal HInfoBox on itcore :: Object :: defaultinit
nitc :: ASuperExpr :: defaultinit
nitc :: AExpr :: defaultinit
core :: Cloneable :: defaultinit
nitc :: Prod :: defaultinit
nitc :: ANode :: defaultinit
nitc :: AExpr :: detach_with_placeholder
Thedetach
method completely remove the node in the parent.
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 :: AExpr :: generate_basic_blocks
Generate recursively basic block for this expressionnitc :: 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 :: AExpr :: implicit_cast_to
If required, the following implicit cast.as(XXX)
nitc :: AExpr :: implicit_cast_to=
If required, the following implicit cast.as(XXX)
nitc :: ASuperExpr :: init_asuperexpr
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 :: ASuperExpr :: make
nitc :: AExpr :: make_var_read
Return a new variable read that contains the value of the expressionnitc :: ASuperExpr :: mpropdef
The method to call is the super is a standardcall-next-method
super-call
nitc :: ASuperExpr :: mpropdef=
The method to call is the super is a standardcall-next-method
super-call
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 :: ASuperExpr :: n_qualified
The qualifier part before the super (currenlty unused)nitc :: ASuperExpr :: n_qualified=
The qualifier part before the super (currenlty unused)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 :: ASuperExpr :: process_superinit
nitc :: 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 :: ASuperExpr :: signaturemap
The mapping used on the call to associate arguments to parameters.nitc :: ASuperExpr :: signaturemap=
The mapping used on the call to associate arguments to parameters.nitc :: Prod :: start_token
The token where the production really start (skipping ADoc).nitc :: AExpr :: vararg_decl
It indicates the number of arguments collected as a vararg.nitc :: AExpr :: vararg_decl=
It indicates the number of arguments collected as a vararg.nitc :: AExpr :: variable_cache
nitc :: AExpr :: variable_cache=
nitc :: AExpr :: warn_parentheses
Warn in case of superfluous parenthesesnitc :: ANode :: was_inline
Doesself
was written in one line before transformation?
# A call to `super`. OR a call of a super-constructor
class ASuperExpr
super AExpr
# The qualifier part before the super (currenlty unused)
var n_qualified: nullable AQualified = null is writable
# The `super` keyword
var n_kwsuper: TKwsuper is writable, noinit
# The arguments of the super
var n_args: AExprs is writable, noinit
end
src/parser/parser_nodes.nit:2480,1--2492,3
redef class ASuperExpr
init init_asuperexpr (
n_qualified: nullable AQualified,
n_kwsuper: nullable TKwsuper,
n_args: nullable AExprs
)
do
_n_qualified = n_qualified
if n_qualified != null then n_qualified.parent = self
_n_kwsuper = n_kwsuper.as(not null)
n_kwsuper.parent = self
_n_args = n_args.as(not null)
n_args.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
if _n_qualified == old_child then
n_qualified = new_child.as(nullable AQualified)
return
end
if _n_kwsuper == old_child then
n_kwsuper = new_child.as(TKwsuper)
return
end
if _n_args == old_child then
n_args = new_child.as(AExprs)
return
end
end
redef fun n_qualified=(node)
do
_n_qualified = node
if node != null then node.parent = self
end
redef fun n_kwsuper=(node)
do
_n_kwsuper = node
node.parent = self
end
redef fun n_args=(node)
do
_n_args = node
node.parent = self
end
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_qualified)
v.enter_visit(_n_kwsuper)
v.enter_visit(_n_args)
end
end
src/parser/parser_prod.nit:5666,1--5720,3
redef class ASuperExpr
redef fun accept_pretty_printer(v) do
v.visit n_kwsuper
if not n_args.n_exprs.is_empty then
if is_stmt and n_args.n_exprs.length == 1 then
v.adds
if v.current_token isa TOpar then v.skip
v.visit n_args.n_exprs.first
if v.current_token isa TCpar then v.skip
else
v.visit_args n_args.n_exprs
end
end
end
# Is the call alone on its line?
fun is_stmt: Bool do return self.first_token.is_starting_line
redef fun is_inlinable do return true
end
src/pretty.nit:1890,1--1910,3
redef class ASuperExpr
# The method to call if the super is in fact a 'super init call'
# Note: if the super is a normal call-next-method, then this attribute is null
var callsite: nullable CallSite
# The method to call is the super is a standard `call-next-method` super-call
# Note: if the super is a special super-init-call, then this attribute is null
var mpropdef: nullable MMethodDef
redef fun accept_typing(v)
do
var anchor = v.anchor
var recvtype = v.get_variable(self, v.selfvariable)
assert recvtype != null
var mproperty = v.mpropdef.mproperty
if not mproperty isa MMethod then
v.error(self, "Error: `super` only usable in a `method`.")
return
end
var superprops = mproperty.lookup_super_definitions(v.mmodule, anchor)
if superprops.length == 0 then
if mproperty.is_init and v.mpropdef.is_intro then
process_superinit(v)
return
end
v.error(self, "Error: no super method to call for `{mproperty}`.")
return
end
# FIXME: covariance of return type in linear extension?
var superprop = superprops.first
var msignature = superprop.msignature.as(not null)
msignature = v.resolve_for(msignature, recvtype, true).as(MSignature)
var args = self.n_args.to_a
if args.length > 0 then
signaturemap = v.check_signature(self, args, mproperty, msignature)
end
self.mtype = msignature.return_mtype
self.is_typed = true
v.mpropdef.has_supercall = true
mpropdef = v.mpropdef.as(MMethodDef)
end
# The mapping used on the call to associate arguments to parameters.
# If null then no specific association is required.
var signaturemap: nullable SignatureMap
private fun process_superinit(v: TypeVisitor)
do
var anchor = v.anchor
var recvtype = v.get_variable(self, v.selfvariable)
assert recvtype != null
var mpropdef = v.mpropdef
assert mpropdef isa MMethodDef
var mproperty = mpropdef.mproperty
var superprop: nullable MMethodDef = null
for msupertype in mpropdef.mclassdef.supertypes do
msupertype = msupertype.anchor_to(v.mmodule, anchor)
var errcount = v.modelbuilder.toolcontext.error_count
var candidate = v.try_get_mproperty_by_name2(self, msupertype, mproperty.name).as(nullable MMethod)
if candidate == null then
if v.modelbuilder.toolcontext.error_count > errcount then return # Forward error
continue # Try next super-class
end
if superprop != null and candidate.is_root_init then
continue
end
if superprop != null and superprop.mproperty != candidate and not superprop.mproperty.is_root_init then
v.error(self, "Error: conflicting super constructor to call for `{mproperty}`: `{candidate.full_name}`, `{superprop.mproperty.full_name}`")
return
end
var candidatedefs = candidate.lookup_definitions(v.mmodule, anchor)
if superprop != null and superprop.mproperty == candidate then
if superprop == candidatedefs.first then continue
candidatedefs.add(superprop)
end
if candidatedefs.length > 1 then
v.error(self, "Error: conflicting property definitions for property `{mproperty}` in `{recvtype}`: {candidatedefs.join(", ")}")
return
end
superprop = candidatedefs.first
end
if superprop == null then
v.error(self, "Error: no super method to call for `{mproperty}`.")
return
end
var msignature = superprop.msignature.as(not null)
msignature = v.resolve_for(msignature, recvtype, true).as(MSignature)
var callsite = new CallSite(hot_location, recvtype, v.mmodule, v.anchor, true, superprop.mproperty, superprop, msignature, false)
self.callsite = callsite
var args = self.n_args.to_a
if args.length > 0 then
callsite.check_signature(v, self, args)
else
# Check there is at least enough parameters
if mpropdef.msignature.arity < msignature.arity then
v.error(self, "Error: not enough implicit arguments to pass. Got `{mpropdef.msignature.arity}`, expected at least `{msignature.arity}`. Signature is `{msignature}`.")
return
end
# Check that each needed parameter is conform
var i = 0
for sp in msignature.mparameters do
var p = mpropdef.msignature.mparameters[i]
if not v.is_subtype(p.mtype, sp.mtype) then
v.error(self, "Type Error: expected argument #{i} of type `{sp.mtype}`, got implicit argument `{p.name}` of type `{p.mtype}`. Signature is {msignature}")
return
end
i += 1
end
end
self.is_typed = true
end
redef fun dump_info(v) do
var res = super
var callsite = self.callsite
if callsite != null then
res += v.yellow(" super-init="+callsite.dump_info(v))
end
var mpropdef = self.mpropdef
if mpropdef != null then
res += v.yellow(" call-next-method="+mpropdef.to_s)
end
return res
end
end
src/semantize/typing.nit:2266,1--2395,3
redef class ASuperExpr
redef fun accept_auto_super_init(v)
do
# If the super is a standard call-next-method then there it is considered am explicit super init call
# The the super is a "super int" then it is also an explicit super init call
v.has_explicit_super_init = self
end
end
src/semantize/auto_super_init.nit:205,1--212,3
redef class ASuperExpr
private init make(args: nullable Array[AExpr], n_qualified: nullable AQualified, mpropdef: nullable MMethodDef)
do
var n_args = new AListExprs
if args != null then
n_args.n_exprs.add_all(args)
end
_mpropdef = mpropdef
self.init_asuperexpr(n_qualified, new TKwsuper, n_args)
end
end
src/astbuilder.nit:377,1--387,3
redef class ASuperExpr
redef fun expr(v)
do
var recv = v.frame.arguments.first
var callsite = self.callsite
if callsite != null then
var args
if self.n_args.n_exprs.is_empty then
# Add automatic arguments for the super init call
args = [recv]
for i in [0..callsite.msignature.arity[ do
args.add(v.frame.arguments[i+1])
end
else
args = v.varargize(callsite.mpropdef, callsite.signaturemap, recv, self.n_args.n_exprs)
if args == null then return null
end
# Super init call
var res = v.callsite(callsite, args)
return res
end
# Standard call-next-method
var mpropdef = self.mpropdef
mpropdef = mpropdef.lookup_next_definition(v.mainmodule, recv.mtype)
var args
if self.n_args.n_exprs.is_empty then
args = v.frame.arguments
else
args = v.varargize(mpropdef, signaturemap, recv, self.n_args.n_exprs)
if args == null then return null
end
var res = v.call(mpropdef, args)
return res
end
end
src/interpreter/naive_interpreter.nit:2333,1--2372,3
redef class ASuperExpr
redef fun expr(v)
do
var frame = v.frame.as(not null)
var recv = frame.arguments.first
var callsite = self.callsite
if callsite != null then
if callsite.is_broken then return null
var args
if self.n_args.n_exprs.is_empty then
# Add automatic arguments for the super init call
args = [recv]
for i in [0..callsite.msignature.arity[ do
args.add(frame.arguments[i+1])
end
else
args = v.varargize(callsite.mpropdef, callsite.signaturemap, recv, self.n_args.n_exprs)
end
# Super init call
var res = v.compile_callsite(callsite, args)
return res
end
var mpropdef = self.mpropdef.as(not null)
var args
if self.n_args.n_exprs.is_empty then
args = frame.arguments
else
args = v.varargize(mpropdef, signaturemap, recv, self.n_args.n_exprs)
end
# Standard call-next-method
return v.supercall(mpropdef, recv.mtype.as(MClassType), args)
end
end
src/compiler/abstract_compiler.nit:4453,1--4491,3
redef class ASuperExpr
redef fun generate_basic_blocks(ssa, old_block)
do
# Recursively goes into arguments to find variables if any
for arg in self.n_args.n_exprs do arg.generate_basic_blocks(ssa, old_block)
return old_block
end
end
src/ssa.nit:868,1--876,3
redef class ASuperExpr
redef fun expr(v)
do
var frame = v.frame
assert frame != null
var recv = frame.arguments.first
var callsite = self.callsite
if callsite != null then
var args
if self.n_args.n_exprs.is_empty then
# Add automatic arguments for the super init call
args = [recv]
for i in [0..callsite.msignature.arity[ do
args.add(frame.arguments[i+1])
end
else
args = v.varargize(callsite.mpropdef, callsite.signaturemap, recv, self.n_args.n_exprs)
end
# Super init call
var res = v.compile_callsite(callsite, args)
return res
end
var mpropdef = self.mpropdef.as(not null)
var args
if self.n_args.n_exprs.is_empty then
args = frame.arguments
else
args = v.varargize(mpropdef, signaturemap, recv, self.n_args.n_exprs)
end
# Standard call-next-method
return v.supercall(mpropdef, recv.mtype.as(MClassType), args)
end
end
src/compiler/java_compiler.nit:1966,1--2004,3