mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:32:46 +00:00 
			
		
		
		
	JSSpecCompiler: Introduce Function and ExecutionContext classes
Currently, they are not extremely useful, but the plan is to store all function-local state in JSSpecCompiler::Function and all "translation unit" state in ExecutionContext.
This commit is contained in:
		
							parent
							
								
									f05d291b41
								
							
						
					
					
						commit
						cd8f4aaa7d
					
				
					 9 changed files with 74 additions and 9 deletions
				
			
		
							
								
								
									
										32
									
								
								Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Function.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Function.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2023, Dan Klishch <danilklishch@gmail.com> | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/HashMap.h> | ||||
| #include <AK/RefCounted.h> | ||||
| #include <AK/RefPtr.h> | ||||
| #include <AK/StringView.h> | ||||
| 
 | ||||
| #include "Forward.h" | ||||
| 
 | ||||
| namespace JSSpecCompiler { | ||||
| 
 | ||||
| class ExecutionContext { | ||||
| public: | ||||
|     HashMap<StringView, FunctionPointerRef> m_functions; | ||||
| }; | ||||
| 
 | ||||
| class Function : public RefCounted<Function> { | ||||
| public: | ||||
|     Function(ExecutionContext* context, StringView name, Tree ast); | ||||
| 
 | ||||
|     ExecutionContext* m_context; | ||||
|     StringView m_name; | ||||
|     Tree m_ast; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Klishch
						Dan Klishch