CallResolver handles the process of resolving a CallExpr or UnknownVarExpr to a method call or a field access.
Slots
- argsSource
-
Expr[] args
- baseSource
-
CType? base
- baseItSource
-
CType? baseIt
-
private Void castForSymbolLiteral()
If the epxression base expression is a symbol literal and we are calling one of the value methods then we know the value type at compile time.
-
private Void castForThisType()
If the epxression is a call which returns sys::This, then we need to insert an implicit cast.
-
private Void constantFolding()
If the epxression is a call, check for constant folding.
- curMethodSource
-
MethodDef? curMethod
- curTypeSource
-
TypeDef? curType
-
private Str errSig()
- exprSource
-
NameExpr expr
-
private Void ffiCoercion()
If this field access or method call returns a type which isn't directly represented in the Fan type system, then implicitly coerce it
- findSource
-
Void find()
Find the method or field with the specified name.
- foundSource
-
CSlot? found
- foundOnItSource
-
Bool foundOnIt
-
private Void inferClosureType()
If the last argument to the resolved call is a closure, then use the method to infer the function type
- inferClosureTypeFromCallSource
-
static Expr inferClosureTypeFromCall(CompilerSupport support, CallExpr call, CType base)
If the last argument to the resolved call is a closure, then use the method to infer the function type. If the last arg is a closure, but the call doesn't take a closure, then translate into an implicit call to Obj.with
-
private Void insertImplicitThisOrIt()
If the call has no explicit target, and is a instance field or method, then we need to insert an implicit this or it.
- isStaticLiteralSource
-
Bool isStaticLiteral()
If this is a standalone name without a base target such as "Foo" and the name maps to a type name, then this is a type literal.
- isVarSource
-
Bool isVar
- locationSource
-
Location location
- makeSource
-
new make(Compiler compiler, TypeDef? curType, MethodDef? curMethod, NameExpr expr)
Construct with NameExpr (base class of CallExpr and UnknownVarExpr)
- nameSource
-
Str name
- resolveSource
-
Expr resolve()
Resolve into a method call or field access
- resolveBaseSource
-
Void resolveBase()
Resolve the base type which defines the slot we are calling.
-
private Void resolveForeign()
If we have a FFI call, then give the foreign bridge a chance to resolve the method and deal with method overloading. Note at this point we've already resolved the call by name to some method (in the find step). But this callback gives the bridge a chance to resolve to the correct overloaded method. We need to this during ResolveExpr in order to infer local variables correctly.
-
private CallExpr resolveToCallExpr()
-
private Void resolveToExpr()
Compute the expression type the call itself (what gets left on the stack).
-
private FieldExpr resolveToFieldExpr()
- resultSource
-
Expr? result
-
private Void safeToNullable()
If the epxression is a safe call using "?.", then the resulting expression type is nullable.
- targetSource
-
Expr? target