nitcc: remove nullable warnings
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 16 Feb 2017 23:12:25 +0000 (18:12 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 16 Feb 2017 23:22:17 +0000 (18:22 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

contrib/nitcc/src/autom.nit
contrib/nitcc/src/nitcc.nit

index a8b9fa5..c1cb412 100644 (file)
@@ -252,8 +252,8 @@ class Automaton
                                if t.symbol == null then continue
 
                                # Check overlaps
-                               var tf = t.symbol.first
-                               var tl = t.symbol.last
+                               var tf = t.symbol.as(not null).first
+                               var tl = t.symbol.as(not null).last
                                if l != null and tf > l then continue
                                if tl != null and f > tl then continue
 
@@ -607,7 +607,7 @@ class Automaton
                                        seen.add(nfa_dest)
                                end
                                if lastst != null and lastst.to == dfa_dest then
-                                       lastst.symbol.last = sym.last
+                                       lastst.symbol.as(not null).last = sym.last
                                else
                                        lastst = dfa_state.add_trans(dfa_dest, sym)
                                end
index 7e380e1..d6d82da 100644 (file)
@@ -46,7 +46,7 @@ var node = p.parse
 
 if not node isa NProd then
        assert node isa NError
-       print "{node.position.to_s} Syntax Error: {node.message}"
+       print "{node.position.as(not null)} Syntax Error: {node.message}"
        exit 1
        abort
 end