# Concrete NIT implicit constructor
class MMImplicitInit
special MMMethSrcMethod
+ fun super_init: nullable MMLocalProperty is abstract
redef fun is_init do return true
readable var _unassigned_attributes: Array[MMSrcAttribute]
readable var _super_inits: Array[MMLocalProperty]
return _module.class_by_name(once ("Collection".to_symbol)).get_instantiate_type([type_object.as_nullable])
end
+ # The primitive type NativeString
+ fun type_nativestring: MMType
+ do
+ return _module.class_by_name(once ("NativeString".to_symbol)).get_type
+ end
+
# The primitive type Array[?]
fun type_array(stype: MMType): MMType
do
fun writemethod: nullable MMSrcMethod is abstract
end
+redef class AConcreteInitPropdef
+ readable var _super_init_calls: Array[MMMethod] = new Array[MMMethod]
+ readable var _explicit_super_init_calls: Array[MMMethod] = new Array[MMMethod]
+end
+
redef class AMethPropdef
# Associated method (MM entity)
fun method: MMMethSrcMethod is abstract
# Useful with get_unchecked_stype
# Remember that conformance check need that ancestors are totaly computed
fun check_conform(v: AbsSyntaxVisitor) is abstract
+
+ # Is the node correcly typed
+ # Return false if typed was not yet computed or
+ # if an error occured during the typing computation
+ fun is_typed: Bool is abstract
+
+ # Return corresponding static type. (require is_typed)
+ fun stype: MMType is abstract
end
redef class AType
fun stype: MMType is abstract
end
+class AAbsAbsSendExpr
+special PExpr
+ # The signature of the called property (require is_typed)
+ fun prop_signature: MMSignature is abstract
+
+ # The real arguments used (after star transformation) (require is_typed)
+ fun arguments: Array[PExpr] is abstract
+end
+
+class AAbsSendExpr
+special AAbsAbsSendExpr
+ # The invoked method (require is_typed)
+ fun prop: MMMethod is abstract
+
+ # The return type (if any) (once computed)
+ fun return_type: nullable MMType is abstract
+end
+
+class ASuperInitCall
+special AAbsSendExpr
+end
+
+redef class ASuperExpr
+special ASuperInitCall
+ fun init_in_superclass: nullable MMMethod is abstract
+end
+
+redef class ANewExpr
+special AAbsSendExpr
+end
+
+redef class ASendExpr
+special ASuperInitCall
+ # Closure definitions
+ fun closure_defs: nullable Array[PClosureDef] is abstract
+end
+
+redef class AReassignFormExpr
+ # Method used through the reassigment operator (require is_typed)
+ fun assign_method: MMMethod is abstract
+end
+
+class ASendReassignExpr
+special ASendExpr
+special AReassignFormExpr
+ # The invoked method used to read (require is_typed)
+ # prop is the method used to write
+ fun read_prop: MMMethod is abstract
+end
+
+redef class ACallReassignExpr
+special ASendReassignExpr
+end
+
+redef class ABraReassignExpr
+special ASendReassignExpr
+end
+
+redef class AAttrFormExpr
+ # Attribute accessed (require is_typed)
+ fun prop: MMAttribute is abstract
+
+ # Attribute type of the acceded attribute (require is_typed)
+ fun attr_type: MMType is abstract
+end
+
+redef class AStringFormExpr
+ fun meth_with_native: MMMethod is abstract
+end
+
+redef class ASuperstringExpr
+ fun meth_with_capacity: MMMethod is abstract
+ fun meth_add: MMMethod is abstract
+ fun meth_to_s: MMMethod is abstract
+ fun atype: MMType is abstract
+end
+
+redef class AArrayExpr
+ fun meth_with_capacity: MMMethod is abstract
+ fun meth_add: MMMethod is abstract
+end
+
+redef class ARangeExpr
+ fun meth_init: MMMethod is abstract
+end
+
redef class AVardeclExpr
# Assiociated local variable
fun variable: VarVariable is abstract
redef class AForExpr
# Associated automatic local variable
fun variable: AutoVariable is abstract
- #readable writable var _variable: nullable AutoVariable
+ fun meth_iterator: MMMethod is abstract
+ fun meth_is_ok: MMMethod is abstract
+ fun meth_item: MMMethod is abstract
+ fun meth_next: MMMethod is abstract
end
redef class ASelfExpr
end
redef class AClosureCallExpr
+special AAbsAbsSendExpr
# Associated closure variable
fun variable: ClosureVariable is abstract
#readable writable var _variable: nullable ClosureVariable
end
redef class AConcreteInitPropdef
- readable var _super_init_calls: Array[MMMethod] = new Array[MMMethod]
- readable var _explicit_super_init_calls: Array[MMMethod] = new Array[MMMethod]
redef fun accept_typing(v)
do
v.top_block = n_block
end
redef class PType
- fun stype: MMType do return _stype.as(not null)
- fun is_typed: Bool do return _stype != null
+ redef fun stype: MMType do return _stype.as(not null)
+ redef fun is_typed: Bool do return _stype != null
var _stype: nullable MMType
redef fun after_typing(v)
readable var _escapable: nullable EscapableBlock
var _meth_iterator: nullable MMMethod
- fun meth_iterator: MMMethod do return _meth_iterator.as(not null)
+ redef fun meth_iterator: MMMethod do return _meth_iterator.as(not null)
var _meth_is_ok: nullable MMMethod
- fun meth_is_ok: MMMethod do return _meth_is_ok.as(not null)
+ redef fun meth_is_ok: MMMethod do return _meth_is_ok.as(not null)
var _meth_item: nullable MMMethod
- fun meth_item: MMMethod do return _meth_item.as(not null)
+ redef fun meth_item: MMMethod do return _meth_item.as(not null)
var _meth_next: nullable MMMethod
- fun meth_next: MMMethod do return _meth_next.as(not null)
+ redef fun meth_next: MMMethod do return _meth_next.as(not null)
redef fun accept_typing(v)
do
var escapable = new EscapableBlock(self)
return psig.return_type.not_for_self
end
- # Method used through the reassigment operator (once computed)
- readable var _assign_method: nullable MMMethod
+ redef fun assign_method do return _assign_method.as(not null)
+ var _assign_method: nullable MMMethod
end
redef class AVarReassignExpr
redef class AStringFormExpr
var _meth_with_native: nullable MMMethod
- fun meth_with_native: MMMethod do return _meth_with_native.as(not null)
+ redef fun meth_with_native: MMMethod do return _meth_with_native.as(not null)
redef fun after_typing(v)
do
_stype = v.type_string
end
redef class ASuperstringExpr
- fun meth_with_capacity: MMMethod do return _meth_with_capacity.as(not null)
+ redef fun meth_with_capacity: MMMethod do return _meth_with_capacity.as(not null)
var _meth_with_capacity: nullable MMMethod
- fun meth_add: MMMethod do return _meth_add.as(not null)
+ redef fun meth_add: MMMethod do return _meth_add.as(not null)
var _meth_add: nullable MMMethod
- fun meth_to_s: MMMethod do return _meth_to_s.as(not null)
+ redef fun meth_to_s: MMMethod do return _meth_to_s.as(not null)
var _meth_to_s: nullable MMMethod
- readable var _atype: nullable MMType
+ redef fun atype do return _atype.as(not null)
+ var _atype: nullable MMType
redef fun after_typing(v)
do
var stype = v.type_string
end
redef class AArrayExpr
- fun meth_with_capacity: MMMethod do return _meth_with_capacity.as(not null)
+ redef fun meth_with_capacity: MMMethod do return _meth_with_capacity.as(not null)
var _meth_with_capacity: nullable MMMethod
- fun meth_add: MMMethod do return _meth_add.as(not null)
+ redef fun meth_add: MMMethod do return _meth_add.as(not null)
var _meth_add: nullable MMMethod
redef fun after_typing(v)
end
redef class ARangeExpr
- fun meth_init: MMMethod do return _meth_init.as(not null)
+ redef fun meth_init: MMMethod do return _meth_init.as(not null)
var _meth_init: nullable MMMethod
redef fun after_typing(v)
do
redef class ASuperExpr
-special ASuperInitCall
- # readable var _prop: MMSrcMethod
- readable var _init_in_superclass: nullable MMMethod
+ redef readable var _init_in_superclass: nullable MMMethod
redef fun after_typing(v)
do
var precs: Array[MMLocalProperty] = v.local_property.prhe.direct_greaters
end
redef class AAttrFormExpr
- # Attribute accessed
- readable var _prop: nullable MMAttribute
+ redef fun prop do return _prop.as(not null)
+ var _prop: nullable MMAttribute
- # Attribute type of the acceded attribute
- readable var _attr_type: nullable MMType
+ redef fun attr_type do return _attr_type.as(not null)
+ var _attr_type: nullable MMType
# Compute the attribute accessed
private fun do_typing(v: TypingVisitor)
redef fun after_typing(v)
do
do_typing(v)
- if prop == null then return
+ if _prop == null then return
_stype = attr_type
_is_typed = true
end
redef fun after_typing(v)
do
do_typing(v)
- if prop == null then return
+ if _prop == null then return
if not v.check_conform_expr(n_value, attr_type) then return
_is_typed = true
end
redef fun after_typing(v)
do
do_typing(v)
- if prop == null then return
+ if _prop == null then return
var t = do_rvalue_typing(v, attr_type)
if t == null then return
v.check_conform(self, t, n_value.stype)
redef fun after_typing(v)
do
do_typing(v)
- if prop == null then return
+ if _prop == null then return
if attr_type.is_nullable then
v.error(self, "Error: isset on a nullable attribute.")
end
end
end
-class AAbsAbsSendExpr
-special PExpr
+redef class AAbsAbsSendExpr
# The signature of the called property
- readable var _prop_signature: nullable MMSignature
+ redef fun prop_signature do return _prop_signature.as(not null)
+ var _prop_signature: nullable MMSignature
# The real arguments used (after star transformation) (once computed)
- readable var _arguments: nullable Array[PExpr]
+ redef fun arguments do return _arguments.as(not null)
+ var _arguments: nullable Array[PExpr]
# Check the conformity of a set of arguments `raw_args' to a signature.
private fun process_signature(v: TypingVisitor, psig: MMSignature, name: Symbol, raw_args: nullable Array[PExpr]): nullable Array[PExpr]
end
end
-class AAbsSendExpr
-special AAbsAbsSendExpr
+redef class AAbsSendExpr
# Compute the called global property
private fun do_typing(v: TypingVisitor, type_recv: MMType, is_implicit_self: Bool, recv_is_self: Bool, name: Symbol, raw_args: nullable Array[PExpr], closure_defs: nullable Array[PClosureDef])
do
end
# The invoked method (once computed)
- readable var _prop: nullable MMMethod
+ redef fun prop do return _prop.as(not null)
+ var _prop: nullable MMMethod
# The return type (if any) (once computed)
- readable var _return_type: nullable MMType
+ redef readable var _return_type: nullable MMType
end
# A possible call of constructor in a super class
# Could be an explicit call or with the 'super' keyword
-class ASuperInitCall
-special AAbsSendExpr
+redef class ASuperInitCall
private fun register_super_init_call(v: TypingVisitor, property: MMMethod)
do
if parent != v.top_block and self != v.top_block then
end
redef class ANewExpr
-special AAbsSendExpr
redef fun after_typing(v)
do
if not n_type.is_typed then return
end
do_typing(v, t, false, false, name, n_args.to_a, null)
- if prop == null then return
+ if _prop == null then return
if not prop.global.is_init then
v.error(self, "Error: {prop} is not a constructor.")
redef class ASendExpr
-special ASuperInitCall
# Name of the invoked property
fun name: Symbol is abstract
fun raw_arguments: nullable Array[PExpr] is abstract
# Closure definitions
- fun closure_defs: nullable Array[PClosureDef] do return null
+ redef fun closure_defs: nullable Array[PClosureDef] do return null
redef fun after_typing(v)
do
end
end
-class ASendReassignExpr
-special ASendExpr
-special AReassignFormExpr
- readable var _read_prop: nullable MMMethod
+redef class ASendReassignExpr
+ redef fun read_prop do return _read_prop.as(not null)
+ var _read_prop: nullable MMMethod
redef fun do_all_typing(v)
do
if not v.check_expr(n_expr) then return
end
redef class ACallReassignExpr
-special ASendReassignExpr
redef fun variable_create(variable)
do
return new AVarReassignExpr.init_avarreassignexpr(n_id, n_assign_op, n_value)
end
redef class ABraReassignExpr
-special ASendReassignExpr
redef fun name do return once "[]".to_symbol
redef fun raw_arguments do return n_args.to_a
end
end
redef class AClosureCallExpr
-special AAbsAbsSendExpr
var _variable: nullable ClosureVariable
redef fun variable do return _variable.as(not null)