mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 06:23:39 +00:00
compiler: add support for full slice expression for slicing arrays
This was an oversight in the main commit for full slice expressions: https://github.com/tinygo-org/tinygo/pull/472 This syntax is used by the regexp package, for example.
This commit is contained in:
committed by
Ron Evans
parent
ea8e4079bc
commit
fea56d4164
@@ -1776,9 +1776,6 @@ 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
|
||||
if expr.Max != nil {
|
||||
return llvm.Value{}, c.makeError(expr.Pos(), "todo: full slice expressions (with max): "+expr.Type().String())
|
||||
}
|
||||
// slice an array
|
||||
length := typ.Elem().Underlying().(*types.Array).Len()
|
||||
llvmLen := llvm.ConstInt(c.uintptrType, uint64(length), false)
|
||||
|
||||
Reference in New Issue
Block a user