nitc :: ABlockExpr
AExpr
(usually statements)The last AExpr
gives the value of the whole block
nitc :: ABlockExpr :: defaultinit
nitc :: ABlockExpr :: init_ablockexpr
nitc :: ABlockExpr :: make
nitc $ ABlockExpr :: SELF
Type of this instance, automatically specialized in every classnitc :: flow $ ABlockExpr :: accept_flow_visitor
nitc :: pretty $ ABlockExpr :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: typing $ ABlockExpr :: accept_typing
nitc :: java_compiler $ ABlockExpr :: expr
Try to compile self as an expressionnitc :: abstract_compiler $ ABlockExpr :: expr
Try to compile self as an expressionnitc :: naive_interpreter $ ABlockExpr :: expr
Evaluate the node as a possible expression.nitc :: ssa $ ABlockExpr :: generate_basic_blocks
The block needs to know if a new block is creatednitc :: pretty $ ABlockExpr :: is_inlinable
Isself
printable in one line?
nitc :: parser_prod $ ABlockExpr :: n_kwend=
Theend
keyword
nitc :: variables_numbering $ ABlockExpr :: numbering
Give a position to each variable declared in the node.nitc :: parser_prod $ ABlockExpr :: replace_child
Replace a child with an other node in the ASTnitc :: abstract_compiler $ ABlockExpr :: stmt
Try to compile self as a statementnitc :: naive_interpreter $ ABlockExpr :: stmt
Evaluate the node as a statement.nitc :: java_compiler $ ABlockExpr :: stmt
Try to compile self as a statementnitc :: parser_prod $ ABlockExpr :: visit_all
Visit all nodes in order.nitc :: AExpr :: _after_flow_context
The flow after the full evaluation of the expression/statementnitc :: 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 :: Prod :: _n_annotations
All the annotations attached directly to the nodenitc :: 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 :: 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 :: Prod :: defaultinit
core :: Cloneable :: defaultinit
nitc :: AExpr :: defaultinit
nitc :: ABlockExpr :: 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 :: ABlockExpr :: init_ablockexpr
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 :: ABlockExpr :: make
nitc :: AExpr :: make_var_read
Return a new variable read that contains the value of the expressionnitc :: 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 nodecore :: 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 :: 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 sequence of `AExpr` (usually statements)
# The last `AExpr` gives the value of the whole block
class ABlockExpr
super AExpr
# The list of statements in the bloc.
# The last element is often considered as an expression that give the value of the whole block.
var n_expr = new ANodes[AExpr](self)
# The `end` keyword
var n_kwend: nullable TKwend = null is writable
end
src/parser/parser_nodes.nit:1846,1--1857,3
redef class ABlockExpr
init init_ablockexpr (
n_expr: Collection[Object], # Should be Collection[AExpr]
n_kwend: nullable TKwend
)
do
self.n_expr.unsafe_add_all(n_expr)
_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_expr.replace_child(old_child, new_child) then return
if _n_kwend == old_child then
n_kwend = new_child.as(nullable TKwend)
return
end
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
n_expr.visit_all(v)
v.enter_visit(_n_kwend)
end
end
src/parser/parser_prod.nit:2613,1--2645,3
redef class ABlockExpr
redef fun accept_flow_visitor(v)
do
for e in n_expr do
if not v.current_flow_context.is_unreachable then
v.enter_visit(e)
else if not v.current_flow_context.is_already_unreachable then
v.current_flow_context.is_already_unreachable = true
v.toolcontext.error(e.hot_location, "Error: unreachable statement.")
end
end
end
end
src/semantize/flow.nit:300,1--312,3
redef class ABlockExpr
redef fun accept_pretty_printer(v) do
var before = v.indent
var can_inline = v.can_inline(self)
if can_inline and not n_expr.is_empty then
v.visit n_expr.first
v.finish_line
else
for nexpr in n_expr do
var expr_inline = v.can_inline(nexpr)
if not expr_inline and nexpr != n_expr.first then v.addn
v.catch_up nexpr
v.addt
v.visit nexpr
v.finish_line
v.addn
if not expr_inline and nexpr != n_expr.last then v.addn
end
end
assert v.indent == before
end
redef fun is_inlinable do
if not super then return false
if not collect_comments.is_empty then return false
if not n_expr.is_empty then
if n_expr.length > 1 then return false
if not n_expr.first.is_inlinable then return false
end
return true
end
end
src/pretty.nit:1194,1--1229,3
redef class ABlockExpr
redef fun accept_typing(v)
do
for e in self.n_expr do v.visit_stmt(e)
self.is_typed = true
end
# The type of a blockexpr is the one of the last expression (or null if empty)
redef fun mtype
do
if self.n_expr.is_empty then return null
return self.n_expr.last.mtype
end
end
src/semantize/typing.nit:1055,1--1068,3
redef class ABlockExpr
private init make(t: nullable MType)
do
if t != null then
_mtype = t
_is_typed = true
end
end
redef fun add(expr)
do
n_expr.add expr
expr.parent = self
end
fun add_all(exprs: Array[AExpr])
do
for expr in exprs do
add(expr)
end
end
redef fun clone: SELF
do
var clone = new ABlockExpr.make(mtype)
for expr in self.n_expr do
clone.add(expr.clone)
end
return clone
end
end
src/astbuilder.nit:788,1--818,3
redef class ABlockExpr
redef fun expr(v)
do
var last = self.n_expr.last
for e in self.n_expr do
if e == last then break
v.stmt(e)
if v.is_escaping then return null
end
return last.expr(v)
end
redef fun stmt(v)
do
for e in self.n_expr do
v.stmt(e)
if v.is_escaping then return
end
end
end
src/interpreter/naive_interpreter.nit:1690,1--1709,3
redef class ABlockExpr
# The block needs to know if a new block is created
redef fun generate_basic_blocks(ssa, old_block)
do
var last_block = old_block
var current_block: BasicBlock
# Recursively continue in the body of the block
for i in [0..self.n_expr.length[ do
current_block = self.n_expr[i].generate_basic_blocks(ssa, last_block)
if current_block.need_update then
if i < (self.n_expr.length-1) then
# Current_block must be filled
current_block.first = self.n_expr[i+1]
current_block.last = self.n_expr[i+1]
current_block.need_update = false
else
# Put the current block at the end of the block
current_block.first = last_block.last
current_block.last = last_block.last
end
end
if not current_block.last isa AEscapeExpr or current_block.last isa AReturnExpr then
# Re-affected the last block
current_block.last = self.n_expr[i]
end
last_block = current_block
end
return last_block
end
end
src/ssa.nit:923,1--957,3