|
11 | 11 | * children are never materialized into PHP arrays unless something actually |
12 | 12 | * asks for them. |
13 | 13 | * |
14 | | - * Read methods eagerly call `materialize_native_children()` — once the |
15 | | - * children have been copied into PHP, `was_mutated()` returns true and the |
16 | | - * call falls through to the parent implementation. The `was_mutated` flag is |
17 | | - * NOT a runtime check for whether the native extension is loaded — if this |
18 | | - * class is in use, the extension is loaded by definition. It tracks whether |
19 | | - * THIS specific node has had its children pulled into the inherited |
20 | | - * `$children` array (which happens on first read or first mutation via |
21 | | - * `append_child()` / `merge_fragment()`). From that point on, the node is a |
22 | | - * plain PHP-backed `WP_Parser_Node`. |
| 14 | + * The hedge in those methods (`if ( $this->was_mutated() )`) is NOT a runtime |
| 15 | + * check for whether the native extension is loaded — if this class is in use, |
| 16 | + * the extension is loaded by definition. It checks whether THIS specific node |
| 17 | + * has been mutated from PHP. A node loses its native backing the first time |
| 18 | + * `append_child()` or `merge_fragment()` is called on it: those overrides |
| 19 | + * invoke `materialize_native_children()`, which copies the native children |
| 20 | + * into the inherited `$children` array and drops the native AST reference. |
| 21 | + * From that point on, the node is a plain PHP-backed `WP_Parser_Node` and the |
| 22 | + * read methods fall through to the parent implementation. |
23 | 23 | * |
24 | 24 | * Mutation from PHP is real and intentional — query rewriters in |
25 | 25 | * `WP_PDO_MySQL_On_SQLite` (e.g. building synthetic `count(*)` expressions) |
|
0 commit comments