diff options
author | Ayke van Laethem <[email protected]> | 2019-04-21 14:04:22 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-04-26 08:52:10 +0200 |
commit | 6d2380921818fdbbdbca0db6c1ef732654792d58 (patch) | |
tree | af9b070151311e881862842a60a2d7dbf41e6993 /compiler/calls.go | |
parent | 024eceb476b1c0d4f129bfd7617830ca49ae963b (diff) | |
download | tinygo-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.go | 5 |
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 |