Skip to content

Language: Spread operator (...) in arrays and calls #141

@PurHur

Description

@PurHur

Problem

[...$a, ...$b] and foo(...$args) are parsed but not compiled.

Goal

Unpack packed arrays into calls and array literals (VM first).

Tasks

  • Compiler lowering for Unpack nodes
  • VM: merge hashtables / arg list building
  • JIT: defer or lower to runtime helper
  • PHPT: array_merge equivalent via spread

Acceptance

$a = [1, 2];
$b = [3, ...$a];
// $b === [3, 1, 2]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions