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:
Ayke van Laethem
2019-08-11 14:30:43 +02:00
committed by Ron Evans
parent ea8e4079bc
commit fea56d4164
2 changed files with 13 additions and 3 deletions
-3
View File
@@ -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)