compiler: emit error for non-byte subslices
They are not supported for now, as VM has only `SUBSTR` opcode for Buffers (`[]byte` in Go).
This commit is contained in:
parent
3f27cf5901
commit
78948ef7af
2 changed files with 15 additions and 0 deletions
|
@ -517,6 +517,10 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
return nil
|
||||
|
||||
case *ast.SliceExpr:
|
||||
if isCompoundSlice(c.typeOf(n.X.(*ast.Ident)).Underlying()) {
|
||||
c.prog.Err = errors.New("subslices are supported only for []byte")
|
||||
return nil
|
||||
}
|
||||
name := n.X.(*ast.Ident).Name
|
||||
c.emitLoadVar("", name)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue