diff options
author | Ayke van Laethem <[email protected]> | 2019-06-07 21:04:56 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-06-08 22:17:09 +0200 |
commit | 6b5b4a681d5820b64ad42861cac56adec6ce7588 (patch) | |
tree | d2e41c6171dd37945c584048ca126c8c55516ad0 /compiler/channel.go | |
parent | 88bb61f287784c316120ccd721cd405572aef794 (diff) | |
download | tinygo-6b5b4a681d5820b64ad42861cac56adec6ce7588.tar.gz tinygo-6b5b4a681d5820b64ad42861cac56adec6ce7588.zip |
compiler: refactor named types to create them lazily
This commit refactors named types to be created lazily. Instead of
defining all types in advance, do it only when necessary.
Diffstat (limited to 'compiler/channel.go')
-rw-r--r-- | compiler/channel.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/channel.go b/compiler/channel.go index b5bcd95b9..8098ea99a 100644 --- a/compiler/channel.go +++ b/compiler/channel.go @@ -12,7 +12,7 @@ import ( // emitMakeChan returns a new channel value for the given channel type. func (c *Compiler) emitMakeChan(expr *ssa.MakeChan) (llvm.Value, error) { - chanType := c.mod.GetTypeByName("runtime.channel") + chanType := c.getLLVMType(c.getRuntimeType("channel")) size := c.targetData.TypeAllocSize(chanType) sizeValue := llvm.ConstInt(c.uintptrType, size, false) ptr := c.createRuntimeCall("alloc", []llvm.Value{sizeValue}, "chan.alloc") |