Homec4science

Fix tree for static arrays in XHPAST

Authored by lovro <lovro@fb.com> on May 25 2011, 02:32.

Description

Fix tree for static arrays in XHPAST

Test Plan:
Test script:

<?php
static $var1 = array(1 => 'one', 2 => 'two', 3 => 'three');
$var2 = array(1 => 'one', 2 => 'two', 3 => 'three');

Before, the tree for the static array was:

a node of type n_ARRAY_LITERAL: "array(1 => 'one', 2 => 'two', 3 => 'three')"
  a node of type n_ARRAY_VALUE: "1 => 'one', 2 => 'two', 3 => 'three'"
    a node of type n_NUMERIC_SCALAR: "1"
    a node of type n_STRING_SCALAR: "'one'"
    a node of type n_ARRAY_VALUE: "2 => 'two'"
      a node of type n_NUMERIC_SCALAR: "2"
      a node of type n_STRING_SCALAR: "'two'"
    a node of type n_ARRAY_VALUE: "3 => 'three'"
      a node of type n_NUMERIC_SCALAR: "3"
      a node of type n_STRING_SCALAR: "'three'"

Now it's the same as the non-static array:

a node of type n_ARRAY_VALUE_LIST: "1 => 'one', 2 => 'two', 3 => 'three'"
  a node of type n_ARRAY_VALUE: "1 => 'one'"
    a node of type n_NUMERIC_SCALAR: "1"
    a node of type n_STRING_SCALAR: "'one'"
  a node of type n_ARRAY_VALUE: "2 => 'two'"
    a node of type n_NUMERIC_SCALAR: "2"
    a node of type n_STRING_SCALAR: "'two'"
  a node of type n_ARRAY_VALUE: "3 => 'three'"
    a node of type n_NUMERIC_SCALAR: "3"
    a node of type n_STRING_SCALAR: "'three'"

Reviewed By: epriestley
Reviewers: epriestley
CC: aran, epriestley
Revert Plan:
Tags:

Differential Revision: 342

Details

Committed
lovro <lovro@fb.com>May 25 2011, 19:21
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU91e4f9144e94: Documentation updates.
Branches
Unknown
Tags
Unknown

Event Timeline

lovro <lovro@fb.com> committed rPHU59596a28bb16: Fix tree for static arrays in XHPAST (authored by lovro <lovro@fb.com>).May 25 2011, 19:21