nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
typing: Make `TypeVisitor::mclassdef` non-nullable
[nit.git]
/
src
/
semantize
/
typing.nit
diff --git
a/src/semantize/typing.nit
b/src/semantize/typing.nit
index
fc89e5f
..
41b5eeb
100644
(file)
--- a/
src/semantize/typing.nit
+++ b/
src/semantize/typing.nit
@@
-43,10
+43,10
@@
private class TypeVisitor
var anchor: nullable MClassType = null
# The analyzed mclassdef
var anchor: nullable MClassType = null
# The analyzed mclassdef
- var mclassdef: nullable MClassDef = null
+ var mclassdef: MClassDef is noinit
# The analyzed property
# The analyzed property
- var mpropdef: nullable MPropDef
+ var mpropdef: MPropDef
var selfvariable = new Variable("self")
var selfvariable = new Variable("self")
@@
-59,23
+59,19
@@
private class TypeVisitor
init
do
var mpropdef = self.mpropdef
init
do
var mpropdef = self.mpropdef
+ var mclassdef = mpropdef.mclassdef
+ self.mclassdef = mclassdef
+ self.anchor = mclassdef.bound_mtype
- if mpropdef != null then
- self.mpropdef = mpropdef
- var mclassdef = mpropdef.mclassdef
- self.mclassdef = mclassdef
- self.anchor = mclassdef.bound_mtype
-
- var mclass = mclassdef.mclass
+ var mclass = mclassdef.mclass
- var selfvariable = new Variable("self")
- self.selfvariable = selfvariable
- selfvariable.declared_type = mclass.mclass_type
+ var selfvariable = new Variable("self")
+ self.selfvariable = selfvariable
+ selfvariable.declared_type = mclass.mclass_type
- var mprop = mpropdef.mproperty
- if mprop isa MMethod and mprop.is_new then
- is_toplevel_context = true
- end
+ var mprop = mpropdef.mproperty
+ if mprop isa MMethod and mprop.is_new then
+ is_toplevel_context = true
end
end
end
end
@@
-740,7
+736,7
@@
end
class CallSite
super MEntity
class CallSite
super MEntity
- redef var location: Location
+ redef var location
# The static type of the receiver (possibly unresolved)
var recv: MType
# The static type of the receiver (possibly unresolved)
var recv: MType
@@
-791,7
+787,7
@@
end
redef class Variable
# The declared type of the variable
redef class Variable
# The declared type of the variable
- var declared_type: nullable MType is writable
+ var declared_type: nullable MType = null is writable
# Was the variable type-adapted?
# This is used to speedup type retrieval while it remains `false`
# Was the variable type-adapted?
# This is used to speedup type retrieval while it remains `false`