typing: use `location` attribute instead of `node` to isolate CallSite from the AST
authorJean Privat <jean@pryen.org>
Wed, 7 Oct 2015 02:23:19 +0000 (22:23 -0400)
committerJean Privat <jean@pryen.org>
Wed, 7 Oct 2015 02:23:36 +0000 (22:23 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/semantize/auto_super_init.nit
src/semantize/typing.nit

index 4a432c7..1da19d4 100644 (file)
@@ -127,7 +127,7 @@ redef class AMethPropdef
                        var msignature = candidatedef.new_msignature or else candidatedef.msignature
                        msignature = msignature.resolve_for(recvtype, anchor, mmodule, true)
 
                        var msignature = candidatedef.new_msignature or else candidatedef.msignature
                        msignature = msignature.resolve_for(recvtype, anchor, mmodule, true)
 
-                       var callsite = new CallSite(self, recvtype, mmodule, anchor, true, candidate, candidatedef, msignature, false)
+                       var callsite = new CallSite(hot_location, recvtype, mmodule, anchor, true, candidate, candidatedef, msignature, false)
                        auto_super_inits.add(callsite)
                        modelbuilder.toolcontext.info("Old-style auto-super init for {mpropdef} to {candidate.full_name}", 4)
                end
                        auto_super_inits.add(callsite)
                        modelbuilder.toolcontext.info("Old-style auto-super init for {mpropdef} to {candidate.full_name}", 4)
                end
@@ -162,7 +162,7 @@ redef class AMethPropdef
                        var msignature = candidatedef.new_msignature or else candidatedef.msignature
                        msignature = msignature.resolve_for(recvtype, anchor, mmodule, true)
 
                        var msignature = candidatedef.new_msignature or else candidatedef.msignature
                        msignature = msignature.resolve_for(recvtype, anchor, mmodule, true)
 
-                       var callsite = new CallSite(self, recvtype, mmodule, anchor, true, the_root_init_mmethod, candidatedef, msignature, false)
+                       var callsite = new CallSite(hot_location, recvtype, mmodule, anchor, true, the_root_init_mmethod, candidatedef, msignature, false)
                        auto_super_inits.add(callsite)
                        modelbuilder.toolcontext.info("Auto-super init for {mpropdef} to {the_root_init_mmethod.full_name}", 4)
                end
                        auto_super_inits.add(callsite)
                        modelbuilder.toolcontext.info("Auto-super init for {mpropdef} to {the_root_init_mmethod.full_name}", 4)
                end
index 4a00d04..d0c34ac 100644 (file)
@@ -389,7 +389,7 @@ private class TypeVisitor
                        end
                end
 
                        end
                end
 
-               var callsite = new CallSite(node, recvtype, mmodule, anchor, recv_is_self, mproperty, mpropdef, msignature, erasure_cast)
+               var callsite = new CallSite(node.hot_location, recvtype, mmodule, anchor, recv_is_self, mproperty, mpropdef, msignature, erasure_cast)
                return callsite
        end
 
                return callsite
        end
 
@@ -621,8 +621,8 @@ end
 
 # A specific method call site with its associated informations.
 class CallSite
 
 # A specific method call site with its associated informations.
 class CallSite
-       # The associated node for location
-       var node: ANode
+       # The associated location of the callsite
+       var location: Location
 
        # The static type of the receiver (possibly unresolved)
        var recv: MType
 
        # The static type of the receiver (possibly unresolved)
        var recv: MType
@@ -1977,7 +1977,7 @@ redef class ASuperExpr
                var msignature = superprop.new_msignature or else superprop.msignature.as(not null)
                msignature = v.resolve_for(msignature, recvtype, true).as(MSignature)
 
                var msignature = superprop.new_msignature or else superprop.msignature.as(not null)
                msignature = v.resolve_for(msignature, recvtype, true).as(MSignature)
 
-               var callsite = new CallSite(self, recvtype, v.mmodule, v.anchor, true, superprop.mproperty, superprop, msignature, false)
+               var callsite = new CallSite(hot_location, recvtype, v.mmodule, v.anchor, true, superprop.mproperty, superprop, msignature, false)
                self.callsite = callsite
 
                var args = self.n_args.to_a
                self.callsite = callsite
 
                var args = self.n_args.to_a