newmm: parse literal floats using String#to_f
authorJean Privat <jean@pryen.org>
Sun, 12 Aug 2012 15:17:47 +0000 (11:17 -0400)
committerJean Privat <jean@pryen.org>
Sun, 12 Aug 2012 15:17:47 +0000 (11:17 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/literal.nit

index bdea381..5bb3f47 100644 (file)
@@ -67,9 +67,7 @@ redef class AFloatExpr
        var value: nullable Float
        redef fun accept_literal(v)
        do
-               # FIXME: no method to_f on string so just go ugly
-               var parts = self.n_float.text.split_with(".")
-               self.value = parts.first.to_i.to_f
+               self.value = self.n_float.text.to_f
        end
 end