mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:52:46 +00:00 
			
		
		
		
	LibJS: Implement ClassExpression::generate_bytecode()
...and use that in ClassDeclaration::generate_bytecode().
This commit is contained in:
		
							parent
							
								
									75aa900b83
								
							
						
					
					
						commit
						c7e6b65fd2
					
				
					 2 changed files with 11 additions and 3 deletions
				
			
		|  | @ -1337,10 +1337,17 @@ Bytecode::CodeGenerationErrorOr<void> SwitchStatement::generate_bytecode(Bytecod | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void ClassDeclaration::generate_bytecode(Bytecode::Generator& generator) const | ||||
| Bytecode::CodeGenerationErrorOr<void> ClassDeclaration::generate_bytecode(Bytecode::Generator& generator) const | ||||
| { | ||||
|     generator.emit<Bytecode::Op::NewClass>(m_class_expression); | ||||
|     generator.emit<Bytecode::Op::SetVariable>(generator.intern_identifier(m_class_expression.ptr()->name())); | ||||
|     TRY(m_class_expression->generate_bytecode(generator)); | ||||
|     generator.emit<Bytecode::Op::SetVariable>(generator.intern_identifier(m_class_expression.ptr()->name()), Bytecode::Op::SetVariable::InitializationMode::Initialize); | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> ClassExpression::generate_bytecode(Bytecode::Generator& generator) const | ||||
| { | ||||
|     generator.emit<Bytecode::Op::NewClass>(*this); | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> ThisExpression::generate_bytecode(Bytecode::Generator& generator) const | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ali Mohammad Pur
						Ali Mohammad Pur