Rename REAMDE to README.md
[nit.git] / src / astbuilder.nit
index 630c1c0..7dafd2f 100644 (file)
@@ -32,7 +32,7 @@ class ASTBuilder
        # Make a new Int literal
        fun make_int(value: Int): AIntExpr
        do
-               return new ADecIntExpr.make(value, mmodule.get_primitive_class("Int").mclass_type)
+               return new ADecIntExpr.make(value, mmodule.int_type)
        end
 
        # Make a new instatiation
@@ -134,11 +134,13 @@ redef class AExpr
        # To create the new node `n`, we need to attach the child to it.
        # But, to put `n` where `c` was in `p`, the place has to be remembered.
        #
-       #     var p: AExpr
-       #     var c = p.c
-       #     var h = c.detach_with_placeholder
-       #     var n = astbuilder.make_XXX(c)
-       #     h.replace_with(n)
+       # ~~~nitish
+       # var p: AExpr
+       # var c = p.c
+       # var h = c.detach_with_placeholder
+       # var n = astbuilder.make_XXX(c)
+       # h.replace_with(n)
+       # ~~~
        fun detach_with_placeholder: AExpr
        do
                var h = new APlaceholderExpr.make
@@ -242,7 +244,9 @@ redef class AIfExpr
                _n_kwif = new TKwif
                _n_expr = condition
                _n_expr.parent = self
+               _n_kwthen = new TKwthen
                _n_then = new ABlockExpr.make
+               _n_kwelse = new TKwelse
                _n_else = new ABlockExpr.make
                self.mtype = mtype
                self.is_typed = true
@@ -275,7 +279,12 @@ redef class ANewExpr
                        n_args.n_exprs.add_all(args)
                end
                self.callsite = callsite
-               self.mtype = callsite.recv
+               self.recvtype = callsite.recv.as(MClassType)
+               if callsite.mproperty.is_new then
+                       self.mtype = callsite.msignature.return_mtype
+               else
+                       self.mtype = callsite.recv
+               end
                self.is_typed = true
        end
 end