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 -
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 - findSource
-
Void find()Find the method or field with the specified name.
- foundSource
-
CSlot? found -
private Void insertImplicitThis()If the call has no explicit target, and is a instance field or method, then we need to insert an implicit this.
- 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 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 - withBlockAddSource
-
Void withBlockAdd()If we failed to resolve
with.exprand the with target supports anaddmethod, then attempt to resolve as a standaloneexpr(no with base). If that works we assume this is syntax sugar forwith.add(expr)- the CallExpr is created in ResolveExpr after the entire sub-expr has been processed.