typing: remove `raw_arguments` as a cache
authorJean Privat <jean@pryen.org>
Wed, 16 Apr 2014 20:15:52 +0000 (16:15 -0400)
committerJean Privat <jean@pryen.org>
Fri, 25 Apr 2014 13:16:57 +0000 (09:16 -0400)
Because of transform and other potential optimization using astbuilder,
the typing phase cannot stores the raw_arguments and expect it is still
valid after subsequent phases.

The simplest way is to make `raw_arguments` a method that recollect the
correct nodes.

Alternative using some kind of cache invalidation seems to complex for not
a real gain.

Signed-off-by: Jean Privat <jean@pryen.org>

src/astbuilder.nit
src/typing.nit

index 96948ea..d55d51c 100644 (file)
@@ -248,7 +248,6 @@ redef class ACallExpr
        do
                self._n_expr = recv
                recv.parent = self
-               self.raw_arguments = args or else new Array[AExpr]
                _n_args = new AListExprs
                _n_id = new TId
                if args != null then
index fbd3f36..9cae36f 100644 (file)
@@ -1221,7 +1221,6 @@ redef class ASendExpr
                var msignature = callsite.msignature
 
                var args = compute_raw_arguments
-               self.raw_arguments = args
 
                callsite.check_signature(v, args)
 
@@ -1245,7 +1244,7 @@ redef class ASendExpr
        private fun property_name: String is abstract
 
        # An array of all arguments (excluding self)
-       var raw_arguments: nullable Array[AExpr]
+       fun raw_arguments: Array[AExpr] do return compute_raw_arguments
 
        private fun compute_raw_arguments: Array[AExpr] is abstract
 end
@@ -1382,7 +1381,6 @@ redef class ASendReassignFormExpr
                self.callsite = callsite
 
                var args = compute_raw_arguments
-               self.raw_arguments = args
 
                callsite.check_signature(v, args)