nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nullable: convert lib, tools and tests
[nit.git]
/
src
/
syntax
/
control_flow.nit
diff --git
a/src/syntax/control_flow.nit
b/src/syntax/control_flow.nit
index
4ac5723
..
bed98a0
100644
(file)
--- a/
src/syntax/control_flow.nit
+++ b/
src/syntax/control_flow.nit
@@
-24,7
+24,7
@@
import syntax_base
abstract class VariableContext
# Look for the variable from its name
# Return null if nothing found
abstract class VariableContext
# Look for the variable from its name
# Return null if nothing found
- meth [](s: Symbol): Variable
+ meth [](s: Symbol): nullable Variable
do
if _dico.has_key(s) then
return _dico[s]
do
if _dico.has_key(s) then
return _dico[s]
@@
-64,7
+64,7
@@
abstract class VariableContext
# The effective static type of a given variable
# May be different from the declaration static type
# The effective static type of a given variable
# May be different from the declaration static type
- meth stype(v: Variable): MMType
+ meth stype(v: Variable): nullable MMType
do
if _stypes.has_key(v) then
return _stypes[v]
do
if _stypes.has_key(v) then
return _stypes[v]
@@
-75,7
+75,7
@@
abstract class VariableContext
# Set effective static type of a given variable
# May be different from the declaration static type
# Set effective static type of a given variable
# May be different from the declaration static type
- meth stype=(v: Variable, t: MMType)
+ meth stype=(v: Variable, t: nullable MMType)
do
_stypes[v] = t
end
do
_stypes[v] = t
end
@@
-87,7
+87,7
@@
abstract class VariableContext
attr _all_variables: Set[Variable]
# Updated static type of variables
attr _all_variables: Set[Variable]
# Updated static type of variables
- attr _stypes: Map[Variable, MMType] = new HashMap[Variable, MMType]
+ attr _stypes: Map[Variable, nullable MMType] = new HashMap[Variable, nullable MMType]
# Build a new VariableContext
meth sub(node: PNode): SubVariableContext
# Build a new VariableContext
meth sub(node: PNode): SubVariableContext
@@
-170,9
+170,9
@@
abstract class VariableContext
# NOP
else if s1 == s2 then
stype(v) = s1
# NOP
else if s1 == s2 then
stype(v) = s1
- else if s1 < s2 then
+ else if s2 == null or s1 < s2 then
stype(v) = s2
stype(v) = s2
- else if s2 < s1 then
+ else if s1 == null or s2 < s1 then
stype(v) = s1
else
stype(v) = basectx.stype(v)
stype(v) = s1
else
stype(v) = basectx.stype(v)