redef class PClassdef
redef fun accept_typing(v)
do
+ v.variable_ctx = new RootVariableContext(v, self)
+ v.base_variable_ctx = v.variable_ctx
v.self_var = new ParamVariable("self".to_symbol, self)
v.self_var.stype = local_class.get_type
super
redef class AAttrPropdef
redef fun accept_typing(v)
do
+ var old_var_ctx = v.variable_ctx
+ v.variable_ctx = old_var_ctx.sub(self)
super
if n_expr != null then
v.check_conform_expr(n_expr.as(not null), prop.signature.return_type.as(not null))
end
+ v.variable_ctx = old_var_ctx
end
end
var _self_var: nullable ParamVariable
redef fun accept_typing(v)
do
- v.variable_ctx = new RootVariableContext(v, self)
- v.base_variable_ctx = v.variable_ctx
+ var old_var_ctx = v.variable_ctx
+ v.variable_ctx = old_var_ctx.sub(self)
_self_var = v.self_var
super
+ v.variable_ctx = old_var_ctx
end
end
redef class AConcreteMethPropdef
- redef fun accept_typing(v)
+ redef fun after_typing(v)
do
super
if v.variable_ctx.unreash == false and method.signature.return_type != null then
redef class PType
fun stype: MMType do return _stype.as(not null)
+ fun is_typed: Bool do return _stype != null
var _stype: nullable MMType
redef fun after_typing(v)
if n_expr != null then v.variable_ctx.mark_is_set(va)
if n_type != null then
+ if not n_type.is_typed then return
va.stype = n_type.stype
if n_expr != null then
v.check_conform_expr(n_expr.as(not null), va.stype)
redef fun after_typing(v)
do
super
+ if not is_typed then return
_meth_init = stype.local_class.select_method(once "init".to_symbol)
end
end
redef fun after_typing(v)
do
super
+ if not is_typed then return
_meth_init = stype.local_class.select_method(once "without_last".to_symbol)
end
end
special AAbsSendExpr
redef fun after_typing(v)
do
- if n_type._stype == null then return
+ if not n_type.is_typed then return
var t = n_type.stype
if t.local_class.global.is_abstract then
v.error(self, "Error: try to instantiate abstract class {t.local_class}.")
redef fun after_typing(v)
do
super
- if not is_typed then return
+ if not n_expr.is_typed or not n_expr2.is_typed then return
if n_expr.stype isa MMTypeNone and not n_expr2.stype.is_nullable or
n_expr2.stype isa MMTypeNone and not n_expr.stype.is_nullable then
v.warning(self, "Warning: comparaison between null and a non nullable value.")
redef fun after_typing(v)
do
super
- if not is_typed then return
+ if not n_expr.is_typed or not n_expr2.is_typed then return
if n_expr.stype isa MMTypeNone and not n_expr2.stype.is_nullable or
n_expr2.stype isa MMTypeNone and not n_expr.stype.is_nullable then
v.warning(self, "Warning: comparaison between null and a non nullable value.")
private fun check_expr_cast(v: TypingVisitor, n_expr: PExpr, n_type: PType)
do
if not v.check_expr(n_expr) then return
+ if not n_type.is_typed then return
var etype = n_expr.stype
var ttype = n_type.stype
if etype == ttype then
redef fun after_typing(v)
do
check_expr_cast(v, n_expr, n_type)
+ if not n_type.is_typed then return
var variable = n_expr.its_variable
if variable != null then
_if_true_variable_ctx = v.variable_ctx.sub_with(self, variable, n_type.stype)
redef fun after_typing(v)
do
check_expr_cast(v, n_expr, n_type)
+ if not n_type.is_typed then return
_stype = n_type.stype
_is_typed = _stype != null
end