From eb84d8935b66e315983ecf163c511b770002bfeb Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 15 Aug 2024 15:50:53 -0400 Subject: [PATCH] ASTBuilder is a TypeContext and use CallSiteBuilder Signed-off-by: Jean Privat --- src/astbuilder.nit | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/astbuilder.nit b/src/astbuilder.nit index d4f0721b73..2083377d2a 100644 --- a/src/astbuilder.nit +++ b/src/astbuilder.nit @@ -24,12 +24,11 @@ intrude import modelize_property # General factory to build semantic nodes in the AST of expressions class ASTBuilder - # The module used as reference for the building - # It is used to gather types and other stuff - var mmodule: MModule + super TypeContext - # The anchor used for some mechanism relying on types - var anchor: MClassType + redef var mmodule: MModule + + redef var anchor: MClassType # Check mmodule to avoid a new instantiation of ASTBuilder fun check_mmodule(mmodule: MModule) @@ -205,9 +204,9 @@ class ASTBuilder # `is_self_call` indicate if the method caller is a property of `self` fun create_callsite(modelbuilder: ModelBuilder, caller_property: APropdef, mproperty: MMethod, is_self_call: Bool): CallSite do - # FIXME It's not the better solution to call `TypeVisitor` here to build a model entity, but some make need to have a callsite - var type_visitor = new TypeVisitor(modelbuilder, caller_property.mpropdef.as(not null)) - var callsite = type_visitor.build_callsite_by_property(caller_property, mproperty.intro_mclassdef.bound_mtype, mproperty, is_self_call) + var recv = mproperty.intro_mclassdef.bound_mtype + var builder = new CallSiteBuilder(caller_property.hot_location, recv, self) + var callsite = builder.recv_is_self(is_self_call).by_property(mproperty) assert callsite != null return callsite end