mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	JSSpecCompiler: Store arguments in declaration instead of definition
And create a struct encapsulating argument name in the preparation for argument types and optional arguments.
This commit is contained in:
		
							parent
							
								
									0806ccaeec
								
							
						
					
					
						commit
						483e195e48
					
				
					 8 changed files with 57 additions and 40 deletions
				
			
		|  | @ -24,9 +24,9 @@ NonnullRefPtr<FunctionDefinition> CppASTConverter::convert() | |||
|     } | ||||
|     auto tree = make_ref_counted<TreeList>(move(toplevel_statements)); | ||||
| 
 | ||||
|     Vector<StringView> arguments; | ||||
|     Vector<FunctionArgument> arguments; | ||||
|     for (auto const& parameter : m_function->parameters()) | ||||
|         arguments.append(parameter->full_name()); | ||||
|         arguments.append({ .name = parameter->full_name() }); | ||||
| 
 | ||||
|     return make_ref_counted<FunctionDefinition>(name, tree, move(arguments)); | ||||
| } | ||||
|  |  | |||
|  | @ -249,12 +249,12 @@ void SpecParsingStep::run(TranslationUnitRef translation_unit) | |||
| 
 | ||||
|     auto spec_function = SpecFunction::create(&m_document->root()).release_value_but_fixme_should_propagate_errors(); | ||||
| 
 | ||||
|     Vector<StringView> argument_names; | ||||
|     Vector<FunctionArgument> arguments; | ||||
|     for (auto const& argument : spec_function.m_arguments) | ||||
|         argument_names.append(argument.name); | ||||
|         arguments.append({ argument.name }); | ||||
| 
 | ||||
|     translation_unit->adopt_function( | ||||
|         make_ref_counted<FunctionDefinition>(spec_function.m_name, spec_function.m_algorithm.m_tree, move(argument_names))); | ||||
|         make_ref_counted<FunctionDefinition>(spec_function.m_name, spec_function.m_algorithm.m_tree, move(arguments))); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Klishch
						Dan Klishch