mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
compiler: allow slicing arrays of a named type
This commit is contained in:
committed by
Ayke van Laethem
parent
873c1c3b4d
commit
f44dff6f59
@@ -2334,7 +2334,7 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) {
|
||||
switch typ := expr.X.Type().Underlying().(type) {
|
||||
case *types.Pointer: // pointer to array
|
||||
// slice an array
|
||||
length := typ.Elem().(*types.Array).Len()
|
||||
length := typ.Elem().Underlying().(*types.Array).Len()
|
||||
llvmLen := llvm.ConstInt(c.uintptrType, uint64(length), false)
|
||||
if high.IsNil() {
|
||||
high = llvmLen
|
||||
|
||||
Reference in New Issue
Block a user