Skip to content

Commit

Permalink
ASTBuilder is a TypeContext and use CallSiteBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Jean Privat <jean@pryen.org>
  • Loading branch information
privat committed Aug 15, 2024
1 parent de1ecb7 commit eb84d89
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/astbuilder.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eb84d89

Please sign in to comment.