mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	JSSpecCompiler: Elide nested TreeList nodes
				
					
				
			This commit is contained in:
		
							parent
							
								
									f30815b534
								
							
						
					
					
						commit
						14a86c8fd6
					
				
					 4 changed files with 23 additions and 12 deletions
				
			
		|  | @ -83,10 +83,22 @@ Vector<NodeSubtreePointer> IfElseIfChain::subtrees() | |||
|     return result; | ||||
| } | ||||
| 
 | ||||
| TreeList::TreeList(Vector<Tree>&& trees) | ||||
| { | ||||
|     for (auto const& tree : trees) { | ||||
|         if (tree->is_list()) { | ||||
|             for (auto const& nested_tree : as<TreeList>(tree)->m_trees) | ||||
|                 m_trees.append(nested_tree); | ||||
|         } else { | ||||
|             m_trees.append(tree); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| Vector<NodeSubtreePointer> TreeList::subtrees() | ||||
| { | ||||
|     Vector<NodeSubtreePointer> result; | ||||
|     for (auto& expression : m_expressions) | ||||
|     for (auto& expression : m_trees) | ||||
|         result.append({ &expression }); | ||||
|     return result; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Klishch
						Dan Klishch