| 
									
										
										
										
											2022-02-12 19:54:08 +03:30
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Error.h>
 | 
					
						
							| 
									
										
										
										
											2023-02-16 11:03:49 -05:00
										 |  |  | #include <AK/String.h>
 | 
					
						
							| 
									
										
										
										
											2022-02-12 19:54:08 +03:30
										 |  |  | #include <AK/StringView.h>
 | 
					
						
							|  |  |  | #include <LibJS/Forward.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace JS::Bytecode { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct CodeGenerationError { | 
					
						
							|  |  |  |     ASTNode const* failing_node { nullptr }; | 
					
						
							|  |  |  |     StringView reason_literal; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-16 11:03:49 -05:00
										 |  |  |     ErrorOr<String> to_string() const; | 
					
						
							| 
									
										
										
										
											2022-02-12 19:54:08 +03:30
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<typename T> | 
					
						
							|  |  |  | using CodeGenerationErrorOr = ErrorOr<T, CodeGenerationError>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |