@@ -67,129 +67,97 @@ public function merge_fragment( $node ) {
6767
6868 /** @inheritDoc */
6969 public function has_child (): bool {
70- if ( $ this ->has_unmaterialized_native_ast () ) {
71- return wp_sqlite_mysql_native_ast_has_child ( $ this ->native_ast , $ this ->native_node_index );
72- }
70+ $ this ->materialize_native_children ();
7371 return parent ::has_child ();
7472 }
7573
7674 /** @inheritDoc */
7775 public function has_child_node ( ?string $ rule_name = null ): bool {
78- if ( $ this ->has_unmaterialized_native_ast () ) {
79- return wp_sqlite_mysql_native_ast_has_child_node ( $ this ->native_ast , $ this ->native_node_index , $ rule_name );
80- }
76+ $ this ->materialize_native_children ();
8177 return parent ::has_child_node ( $ rule_name );
8278 }
8379
8480 /** @inheritDoc */
8581 public function has_child_token ( ?int $ token_id = null ): bool {
86- if ( $ this ->has_unmaterialized_native_ast () ) {
87- return wp_sqlite_mysql_native_ast_has_child_token ( $ this ->native_ast , $ this ->native_node_index , $ token_id );
88- }
82+ $ this ->materialize_native_children ();
8983 return parent ::has_child_token ( $ token_id );
9084 }
9185
9286 /** @inheritDoc */
9387 public function get_first_child () {
94- if ( $ this ->has_unmaterialized_native_ast () ) {
95- return wp_sqlite_mysql_native_ast_get_first_child ( $ this ->native_ast , $ this ->native_node_index );
96- }
88+ $ this ->materialize_native_children ();
9789 return parent ::get_first_child ();
9890 }
9991
10092 /** @inheritDoc */
10193 public function get_first_child_node ( ?string $ rule_name = null ): ?WP_Parser_Node {
102- if ( $ this ->has_unmaterialized_native_ast () ) {
103- return wp_sqlite_mysql_native_ast_get_first_child_node ( $ this ->native_ast , $ this ->native_node_index , $ rule_name );
104- }
94+ $ this ->materialize_native_children ();
10595 return parent ::get_first_child_node ( $ rule_name );
10696 }
10797
10898 /** @inheritDoc */
10999 public function get_first_child_token ( ?int $ token_id = null ): ?WP_Parser_Token {
110- if ( $ this ->has_unmaterialized_native_ast () ) {
111- return wp_sqlite_mysql_native_ast_get_first_child_token ( $ this ->native_ast , $ this ->native_node_index , $ token_id );
112- }
100+ $ this ->materialize_native_children ();
113101 return parent ::get_first_child_token ( $ token_id );
114102 }
115103
116104 /** @inheritDoc */
117105 public function get_first_descendant_node ( ?string $ rule_name = null ): ?WP_Parser_Node {
118- if ( $ this ->has_unmaterialized_native_ast () ) {
119- return wp_sqlite_mysql_native_ast_get_first_descendant_node ( $ this ->native_ast , $ this ->native_node_index , $ rule_name );
120- }
106+ $ this ->materialize_native_children ();
121107 return parent ::get_first_descendant_node ( $ rule_name );
122108 }
123109
124110 /** @inheritDoc */
125111 public function get_first_descendant_token ( ?int $ token_id = null ): ?WP_Parser_Token {
126- if ( $ this ->has_unmaterialized_native_ast () ) {
127- return wp_sqlite_mysql_native_ast_get_first_descendant_token ( $ this ->native_ast , $ this ->native_node_index , $ token_id );
128- }
112+ $ this ->materialize_native_children ();
129113 return parent ::get_first_descendant_token ( $ token_id );
130114 }
131115
132116 /** @inheritDoc */
133117 public function get_children (): array {
134- if ( $ this ->has_unmaterialized_native_ast () ) {
135- return wp_sqlite_mysql_native_ast_get_children ( $ this ->native_ast , $ this ->native_node_index );
136- }
118+ $ this ->materialize_native_children ();
137119 return parent ::get_children ();
138120 }
139121
140122 /** @inheritDoc */
141123 public function get_child_nodes ( ?string $ rule_name = null ): array {
142- if ( $ this ->has_unmaterialized_native_ast () ) {
143- return wp_sqlite_mysql_native_ast_get_child_nodes ( $ this ->native_ast , $ this ->native_node_index , $ rule_name );
144- }
124+ $ this ->materialize_native_children ();
145125 return parent ::get_child_nodes ( $ rule_name );
146126 }
147127
148128 /** @inheritDoc */
149129 public function get_child_tokens ( ?int $ token_id = null ): array {
150- if ( $ this ->has_unmaterialized_native_ast () ) {
151- return wp_sqlite_mysql_native_ast_get_child_tokens ( $ this ->native_ast , $ this ->native_node_index , $ token_id );
152- }
130+ $ this ->materialize_native_children ();
153131 return parent ::get_child_tokens ( $ token_id );
154132 }
155133
156134 /** @inheritDoc */
157135 public function get_descendants (): array {
158- if ( $ this ->has_unmaterialized_native_ast () ) {
159- return wp_sqlite_mysql_native_ast_get_descendants ( $ this ->native_ast , $ this ->native_node_index );
160- }
136+ $ this ->materialize_native_children ();
161137 return parent ::get_descendants ();
162138 }
163139
164140 /** @inheritDoc */
165141 public function get_descendant_nodes ( ?string $ rule_name = null ): array {
166- if ( $ this ->has_unmaterialized_native_ast () ) {
167- return wp_sqlite_mysql_native_ast_get_descendant_nodes ( $ this ->native_ast , $ this ->native_node_index , $ rule_name );
168- }
142+ $ this ->materialize_native_children ();
169143 return parent ::get_descendant_nodes ( $ rule_name );
170144 }
171145
172146 /** @inheritDoc */
173147 public function get_descendant_tokens ( ?int $ token_id = null ): array {
174- if ( $ this ->has_unmaterialized_native_ast () ) {
175- return wp_sqlite_mysql_native_ast_get_descendant_tokens ( $ this ->native_ast , $ this ->native_node_index , $ token_id );
176- }
148+ $ this ->materialize_native_children ();
177149 return parent ::get_descendant_tokens ( $ token_id );
178150 }
179151
180152 /** @inheritDoc */
181153 public function get_start (): int {
182- if ( $ this ->has_unmaterialized_native_ast () ) {
183- return wp_sqlite_mysql_native_ast_get_start ( $ this ->native_ast , $ this ->native_node_index );
184- }
154+ $ this ->materialize_native_children ();
185155 return parent ::get_start ();
186156 }
187157
188158 /** @inheritDoc */
189159 public function get_length (): int {
190- if ( $ this ->has_unmaterialized_native_ast () ) {
191- return wp_sqlite_mysql_native_ast_get_length ( $ this ->native_ast , $ this ->native_node_index );
192- }
160+ $ this ->materialize_native_children ();
193161 return parent ::get_length ();
194162 }
195163
0 commit comments