Attempt to further fix interface assignment

This commit is contained in:
2023-12-14 21:21:07 -05:00
parent f72bf533e0
commit c4df65d189
4 changed files with 53 additions and 21 deletions

View File

@@ -58,10 +58,12 @@ func (this *generator) generateMethodCall (call *entity.MethodCall) (llvm.Value,
method, err := this.method(sourceType.Name, call.Name)
if err != nil { return nil, err }
source, err := this.generateExpressionLoc(call.Source)
if err != nil { return nil, err }
args[0] = source
return this.blockManager.NewCall(method, method.Signature, args...), nil
if method != nil {
source, err := this.generateExpressionLoc(call.Source)
if err != nil { return nil, err }
args[0] = source
return this.blockManager.NewCall(method, method.Signature, args...), nil
}
}
// check for methods on pointer to named type
@@ -70,18 +72,20 @@ func (this *generator) generateMethodCall (call *entity.MethodCall) (llvm.Value,
method, err := this.method(sourceType.Name, call.Name)
if err != nil { return nil, err }
source, err := this.generateExpression(call.Source)
if err != nil { return nil, err }
args[0] = source
return this.blockManager.NewCall(method, method.Signature, args...), nil
if method != nil {
source, err := this.generateExpression(call.Source)
if err != nil { return nil, err }
args[0] = source
return this.blockManager.NewCall(method, method.Signature, args...), nil
}
}
}
// check for interface behaviors
if sourceType := getInterface(call.Source.Type()); sourceType != nil {
irSourceType, err := this.generateType(sourceType)
irSourceType, err := this.generateType(call.Source.Type())
if err != nil { return nil, err }
source, err := this.generateExpression(call.Source)
source, err := this.generateExpressionLoc(call.Source)
if err != nil { return nil, err }
irBehavior := this.getInterfaceBehavior(sourceType, source, irSourceType, call.Name)