From 924f8de922cc5191e876969e2bee494b290ff163 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 26 Mar 2014 14:21:42 -0400 Subject: [PATCH] callsite: add `mmodule` and `anchor` to the callsite objects This simplify the job of its users since more model information is available. Signed-off-by: Jean Privat --- src/astbuilder.nit | 4 ++-- src/auto_super_init.nit | 2 +- src/typing.nit | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/astbuilder.nit b/src/astbuilder.nit index 0db3b4d..96948ea 100644 --- a/src/astbuilder.nit +++ b/src/astbuilder.nit @@ -238,7 +238,7 @@ redef class ANewExpr if args != null then n_args.n_exprs.add_all(args) end - callsite = new CallSite(self, mtype, true, mmethod, mmethod.intro, mmethod.intro.msignature.as(not null), false) + callsite = new CallSite(self, mtype, mmethod.intro.mclassdef.mmodule, mtype, true, mmethod, mmethod.intro, mmethod.intro.msignature.as(not null), false) self.mtype = mtype end end @@ -255,7 +255,7 @@ redef class ACallExpr self.n_args.n_exprs.add_all(args) end var mtype = recv.mtype.as(not null) - callsite = new CallSite(self, mtype, true, mmethod, mmethod.intro, mmethod.intro.msignature.as(not null), false) + callsite = new CallSite(self, mtype, mmethod.intro.mclassdef.mmodule, mmethod.intro.mclassdef.bound_mtype, true, mmethod, mmethod.intro, mmethod.intro.msignature.as(not null), false) self.mtype = t self.is_typed = true end diff --git a/src/auto_super_init.nit b/src/auto_super_init.nit index f304d04..8e210cc 100644 --- a/src/auto_super_init.nit +++ b/src/auto_super_init.nit @@ -106,7 +106,7 @@ redef class AConcreteMethPropdef var msignature = candidatedef.msignature msignature = msignature.resolve_for(recvtype, anchor, mmodule, true) - var callsite = new CallSite(self, recvtype, true, candidate, candidatedef, msignature, false) + var callsite = new CallSite(self, recvtype, mmodule, anchor, true, candidate, candidatedef, msignature, false) auto_super_inits.add(callsite) end if auto_super_inits.is_empty then diff --git a/src/typing.nit b/src/typing.nit index 03df217..f888b6f 100644 --- a/src/typing.nit +++ b/src/typing.nit @@ -274,7 +274,7 @@ private class TypeVisitor end end - var callsite = new CallSite(node, recvtype, recv_is_self, mproperty, mpropdef, msignature, erasure_cast) + var callsite = new CallSite(node, recvtype, mmodule, anchor, recv_is_self, mproperty, mpropdef, msignature, erasure_cast) return callsite end @@ -386,9 +386,15 @@ class CallSite # The assiciated node for location var node: ANode - # The statis type of the receiver + # The static type of the receiver (possibly unresolved) var recv: MType + # The module where the callsite is present + var mmodule: MModule + + # The anchor to use with `recv` or `msignature` + var anchor: nullable MClassType + # Is the receiver self? # If "for_self", virtual types of the signature are keeped # If "not_for_self", virtual type are erased @@ -1491,7 +1497,7 @@ redef class ASuperExpr end var msignature = v.resolve_signature_for(superprop, recvtype, true) - var callsite = new CallSite(self, recvtype, true, superprop.mproperty, superprop, msignature, false) + var callsite = new CallSite(self, recvtype, v.mmodule, v.anchor, true, superprop.mproperty, superprop, msignature, false) self.callsite = callsite var args = self.n_args.to_a -- 1.7.9.5