mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	LibJS/Bytecode: Leave GlobalDeclarationInstantiation in C++
Don't try to implement this AO in bytecode. Instead, the bytecode Interpreter class now has a run() API with the same inputs as the AST interpreter. It sets up the necessary environments etc, including invoking the GlobalDeclarationInstantiation AO.
This commit is contained in:
		
							parent
							
								
									32d9c8e3ca
								
							
						
					
					
						commit
						d063f35afd
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-18 01:43:16 +09:00 
				
			
			Author: https://github.com/awesomekling
Commit: d063f35afd
Pull-request: https://github.com/SerenityOS/serenity/pull/19408
Issue: https://github.com/SerenityOS/serenity/issues/15210
			
					 12 changed files with 172 additions and 284 deletions
				
			
		|  | @ -22,7 +22,7 @@ | |||
| 
 | ||||
| #define EXPECT_NO_EXCEPTION(executable)                                                        \ | ||||
|     auto executable = MUST(JS::Bytecode::Generator::generate(program));                        \ | ||||
|     auto result = bytecode_interpreter.run(*executable);                                       \ | ||||
|     auto result = bytecode_interpreter.run(*script);                                           \ | ||||
|     if (result.is_error()) {                                                                   \ | ||||
|         FAIL("unexpected exception");                                                          \ | ||||
|         dbgln("Error: {}", MUST(result.throw_completion().value()->to_deprecated_string(vm))); \ | ||||
|  | @ -113,11 +113,8 @@ TEST_CASE(loading_multiple_files) | |||
|         auto test_file_script = MUST(JS::Script::parse( | ||||
|             "if (f() !== 'hello') throw new Exception('failed'); "sv, ast_interpreter->realm())); | ||||
| 
 | ||||
|         auto const& test_file_program = test_file_script->parse_node(); | ||||
| 
 | ||||
|         auto executable = MUST(JS::Bytecode::Generator::generate(test_file_program)); | ||||
|         // TODO: This could be TRY_OR_FAIL(), if someone implements Formatter<JS::Completion>.
 | ||||
|         MUST(bytecode_interpreter.run(*executable)); | ||||
|         MUST(bytecode_interpreter.run(test_file_script)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling