with
statementnitc :: AWithExpr :: _break_mark
The break escape mark associated with the 'with'nitc :: AWithExpr :: _method_finish
nitc :: AWithExpr :: _method_start
nitc :: AWithExpr :: break_mark
The break escape mark associated with the 'with'nitc :: AWithExpr :: break_mark=
The break escape mark associated with the 'with'nitc :: AWithExpr :: defaultinit
nitc :: AWithExpr :: init_awithexpr
nitc :: AWithExpr :: method_finish
nitc :: AWithExpr :: method_finish=
nitc :: AWithExpr :: method_start
nitc :: AWithExpr :: method_start=
nitc :: flow $ AWithExpr :: accept_flow_visitor
nitc :: scope $ AWithExpr :: accept_scope_visitor
nitc :: transform $ AWithExpr :: accept_transform_visitor
is replaced with a do/end and injected calls tostart
and finish
nitc :: typing $ AWithExpr :: accept_typing
nitc :: simple_misc_analysis $ AWithExpr :: after_simple_misc
nitc :: parser_prod $ AWithExpr :: replace_child
Replace a child with an other node in the ASTnitc :: naive_interpreter $ AWithExpr :: stmt
Evaluate the node as a statement.nitc :: AExpr :: _after_flow_context
The flow after the full evaluation of the expression/statementnitc :: AWithExpr :: _break_mark
The break escape mark associated with the 'with'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 :: AWithExpr :: _method_finish
nitc :: AWithExpr :: _method_start
nitc :: Prod :: _n_annotations
All the annotations attached directly to the nodenitc :: ALabelable :: _n_label
The associated label declatationnitc :: 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 :: AWithExpr :: break_mark
The break escape mark associated with the 'with'nitc :: AWithExpr :: break_mark=
The break escape mark associated with the 'with'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 itnitc :: ANode :: defaultinit
core :: Object :: defaultinit
core :: Cloneable :: defaultinit
nitc :: AExpr :: defaultinit
nitc :: Prod :: defaultinit
nitc :: ALabelable :: defaultinit
nitc :: AWithExpr :: 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 :: AWithExpr :: init_awithexpr
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 :: AExpr :: make_var_read
Return a new variable read that contains the value of the expressionnitc :: AWithExpr :: method_finish
nitc :: AWithExpr :: method_finish=
nitc :: AWithExpr :: method_start
nitc :: AWithExpr :: method_start=
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 :: ALabelable :: n_label=
The associated label declatationcore :: 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 `with` statement
class AWithExpr
super AExpr
super ALabelable
# The `with` keyword
var n_kwwith: TKwwith is writable, noinit
# The expression used to get the value to control
var n_expr: AExpr is writable, noinit
# The `do` keyword
var n_kwdo: TKwdo is writable, noinit
# The body of the loop
var n_block: nullable AExpr = null is writable
end
src/parser/parser_nodes.nit:2068,1--2084,3
redef class AWithExpr
init init_awithexpr (
n_kwwith: nullable TKwwith,
n_expr: nullable AExpr,
n_kwdo: nullable TKwdo,
n_block: nullable AExpr,
n_label: nullable ALabel
)
do
_n_kwwith = n_kwwith.as(not null)
n_kwwith.parent = self
_n_expr = n_expr.as(not null)
n_expr.parent = self
_n_kwdo = n_kwdo.as(not null)
n_kwdo.parent = self
_n_block = n_block
if n_block != null then n_block.parent = self
_n_label = n_label
if n_label != null then n_label.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
if _n_kwwith == old_child then
n_kwwith = new_child.as(TKwwith)
return
end
if _n_expr == old_child then
n_expr = new_child.as(AExpr)
return
end
if _n_kwdo == old_child then
n_kwdo = new_child.as(TKwdo)
return
end
if _n_block == old_child then
n_block = new_child.as(nullable AExpr)
return
end
if _n_label == old_child then
n_label = new_child.as(nullable ALabel)
return
end
end
redef fun n_kwwith=(node)
do
_n_kwwith = node
node.parent = self
end
redef fun n_expr=(node)
do
_n_expr = node
node.parent = self
end
redef fun n_kwdo=(node)
do
_n_kwdo = node
node.parent = self
end
redef fun n_block=(node)
do
_n_block = node
if node != null then node.parent = self
end
redef fun n_label=(node)
do
_n_label = node
if node != null then node.parent = self
end
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_kwwith)
v.enter_visit(_n_expr)
v.enter_visit(_n_kwdo)
v.enter_visit(_n_block)
v.enter_visit(_n_label)
end
end
src/parser/parser_prod.nit:3414,1--3494,3
redef class AWithExpr
redef fun after_simple_misc(v)
do
v.check_do_expr(n_block)
end
end
src/frontend/simple_misc_analysis.nit:186,1--191,3
redef class AWithExpr
# The break escape mark associated with the 'with'
var break_mark: nullable EscapeMark
redef fun accept_scope_visitor(v)
do
v.scopes.unshift(new Scope)
var escapemark = v.make_escape_mark(n_label, true)
self.break_mark = escapemark
v.enter_visit(n_expr)
v.enter_visit_block(n_block, escapemark)
v.shift_scope
end
end
src/semantize/scope.nit:451,1--467,3
redef class AWithExpr
redef fun accept_flow_visitor(v)
do
super
v.merge_breaks(self.break_mark)
end
end
src/semantize/flow.nit:458,1--464,3
redef class AWithExpr
var method_start: nullable CallSite
var method_finish: nullable CallSite
redef fun accept_typing(v: TypeVisitor)
do
var mtype = v.visit_expr(n_expr)
if mtype == null then return
method_start = v.build_callsite_by_name(self, mtype, "start", n_expr isa ASelfExpr)
method_finish = v.build_callsite_by_name(self, mtype, "finish", n_expr isa ASelfExpr)
v.visit_stmt(n_block)
self.mtype = n_block.mtype
self.is_typed = true
end
end
src/semantize/typing.nit:1474,1--1490,3
redef class AWithExpr
redef fun stmt(v)
do
var expr = v.expr(self.n_expr)
if expr == null then return
v.callsite(method_start, [expr])
v.stmt(self.n_block)
v.is_escape(self.break_mark) # Clear the break
# Execute the finally without an escape
var old_mark = v.escapemark
v.escapemark = null
v.callsite(method_finish, [expr])
# Restore the escape unless another escape was provided
if v.escapemark == null then v.escapemark = old_mark
end
end
src/interpreter/naive_interpreter.nit:1929,1--1946,3
redef class AWithExpr
# is replaced with a do/end and injected calls to `start` and `finish`
#
# Basically, the following
#
# ~~~nitish
# with expr do
# block
# end label l
# ~~~
#
# is transformed into
#
# ~~~nitish
# var x = expr
# do
# x.start
# block
# end label l
# x.finish
# ~~~
#
# The point is that `finish` is called even if the block is escaped.
redef fun accept_transform_visitor(v)
do
var escapemark = self.break_mark
assert escapemark != null
var nblock = v.builder.make_block
var nexpr = n_expr
nblock.add nexpr
var ndo = v.builder.make_do
ndo.break_mark = escapemark
var start = v.builder.make_call(nexpr.make_var_read, method_start.as(not null), null)
ndo.add start
ndo.add self.n_block.as(not null)
nblock.add ndo
nblock.add v.builder.make_call(nexpr.make_var_read, method_finish.as(not null), null)
replace_with(nblock)
end
end
src/transform.nit:310,1--359,3