aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/calls.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-04-21 14:04:22 +0200
committerRon Evans <[email protected]>2019-04-26 08:52:10 +0200
commit6d2380921818fdbbdbca0db6c1ef732654792d58 (patch)
treeaf9b070151311e881862842a60a2d7dbf41e6993 /compiler/calls.go
parent024eceb476b1c0d4f129bfd7617830ca49ae963b (diff)
downloadtinygo-6d2380921818fdbbdbca0db6c1ef732654792d58.tar.gz
tinygo-6d2380921818fdbbdbca0db6c1ef732654792d58.zip
compiler: simplify code around getZeroValue
The LLVM library we use does not (yet) provide a llvm.Zero (like it provides a llvm.Undef) so we have implemented our own. However, in theory it might return an error in some cases. No real-world errors have been seen in a while and errors would likely indicate a serious compiler bug anyway (not an external error), so make it panic instead of returning an error.
Diffstat (limited to 'compiler/calls.go')
-rw-r--r--compiler/calls.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/calls.go b/compiler/calls.go
index 2ac293ba1..b5296f91a 100644
--- a/compiler/calls.go
+++ b/compiler/calls.go
@@ -123,10 +123,7 @@ func (c *Compiler) collapseFormalParamInternal(t llvm.Type, fields []llvm.Value)
switch t.TypeKind() {
case llvm.StructTypeKind:
if len(c.flattenAggregateType(t)) <= MaxFieldsPerParam {
- value, err := c.getZeroValue(t)
- if err != nil {
- panic("could not get zero value of struct: " + err.Error())
- }
+ value := c.getZeroValue(t)
for i, subtyp := range t.StructElementTypes() {
structField, remaining := c.collapseFormalParamInternal(subtyp, fields)
fields = remaining