end
j += 1
end
- var stop_prop: MMMethod
+ var stop_prop: MMMethod = null
if j < n.explicit_super_init_calls.length then
stop_prop = n.explicit_super_init_calls[j]
end
protected meth decl_csignature(v: CompilerVisitor, args: Array[String]): String
do
var params = new Array[String]
- var params_new: Array[String]
+ var params_new: Array[String] = null
if global.is_init then
params_new = new Array[String]
end
var old_return_value = v.return_value
var old_has_return = v.has_return
- var itpos: String
+ var itpos: String = null
if self isa AConcreteInitPropdef then
itpos = "VAL2OBJ({params[0]})->vft[{method.local_class.global.init_table_pos_id}].i"
# v.add_instr("printf(\"{method.full_name}: inittable[%d] = %d\\n\", {itpos}, init_table[{itpos}]);")
do
var c = method.local_class.name
var n = method.name
- var s: String
+ var s: String = null
if c == once "Int".to_symbol then
if n == once "object_id".to_symbol then
s = "{p[0]}"
# Static type
readable writable attr _stype: MMType
+ redef meth to_s do return _name.to_s
+
init(n: Symbol, d: PNode)
do
assert n != null
# Is null for statement and for erronus expression
meth stype: MMType is abstract
end
+
+redef class AVardeclExpr
+ # Assiociated local variable
+ readable writable attr _variable: Variable
+end
+
+redef class AForVardeclExpr
+ # Associated automatic local variable
+ readable writable attr _variable: Variable
+end
+
+redef class AVarFormExpr
+ # Associated local variable
+ readable writable attr _variable: Variable
+end
+
attr _dico: Map[Symbol, Variable]
# Build a new VariableContext
- meth sub: VariableContext
+ meth sub: SubVariableContext
do
return new SubVariableContext.with(self, null, null)
end
# Build a nested VariableContext with new variable information
- meth sub_with(v: Variable, t: MMType): VariableContext
+ meth sub_with(v: Variable, t: MMType): SubVariableContext
do
return new SubVariableContext.with(self, v, t)
end
else
var i = 0
var l = explicit_super_init_calls.length
- var cur_m: MMMethod
- var cur_c: MMLocalClass
+ var cur_m: MMMethod = null
+ var cur_c: MMLocalClass = null
if i < l then
cur_m = explicit_super_init_calls[i]
cur_c = cur_m.global.intro.local_class
end
redef class AVardeclExpr
- # Assiociated local variable
- readable attr _variable: Variable
-
redef meth after_typing(v)
do
var va = new Variable(n_id.to_symbol, self)
- _variable = va
+ variable = va
v.variable_ctx.add(va)
if n_type != null then
end
redef class AForVardeclExpr
- # Associated automatic local variable
- readable attr _variable: Variable
-
redef meth after_typing(v)
do
v.variable_ctx = v.variable_ctx.sub
- var variable = new Variable(n_id.to_symbol, self)
- _variable = variable
- v.variable_ctx.add(variable)
+ var va = new Variable(n_id.to_symbol, self)
+ variable = va
+ v.variable_ctx.add(va)
var expr_type = n_expr.stype
if not v.check_conform(self, expr_type, v.type_collection) then
end
var t = prop2.signature.return_type
if not n_expr.is_self then t = t.not_for_self
- variable.stype = t
+ va.stype = t
end
end
end
end
-redef class AVarFormExpr
- # Associated local variable
- readable writable attr _variable: Variable
-end
-
redef class AVarExpr
redef meth is_variable do return true
readable attr _assign_method: MMMethod
end
+redef class AVarReassignExpr
+ redef meth after_typing(v)
+ do
+ var t = v.variable_ctx.stype(variable)
+ do_lvalue_typing(v, t)
+ end
+end
+
redef class PAssignOp
meth method_name: Symbol is abstract
end
redef meth method_name do return once "-".to_symbol
end
-redef class AVarReassignExpr
- redef meth after_typing(v)
- do
- var t = v.variable_ctx.stype(variable)
- do_lvalue_typing(v, t)
- end
-end
-
redef class ASelfExpr
redef meth after_typing(v)
do
redef meth after_typing(v)
do
- var stype: MMType
+ var stype: MMType = null
for n in n_exprs do
var ntype = n.stype
if stype == null or (ntype != null and stype < ntype) then
if precs.first.signature.return_type != null then
var stypes = new Array[MMType]
- var stype: MMType
+ var stype: MMType = null
for prop in precs do
assert prop isa MMMethod
var t = prop.signature.return_type.for_module(v.module).adapt_to(v.local_property.signature.recv)
v.error(self, "Error: Constructor invocation {property} must not be in nested block.")
end
var cla = v.module[property.global.intro.local_class.global]
- var prev_class: MMLocalClass
+ var prev_class: MMLocalClass = null
if not v.explicit_super_init_calls.is_empty then
prev_class = v.explicit_super_init_calls.last.global.intro.local_class
end