| 
									
										
										
										
											2021-06-15 00:04:08 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibJS/Runtime/NativeFunction.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace JS { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 27.3.1 %GeneratorFunction%, https://tc39.es/ecma262/#sec-generatorfunction-constructor
 | 
					
						
							|  |  |  | class GeneratorFunctionConstructor final : public NativeFunction { | 
					
						
							|  |  |  |     JS_OBJECT(GeneratorFunctionConstructor, NativeFunction); | 
					
						
							| 
									
										
										
										
											2023-11-19 09:45:05 +01:00
										 |  |  |     JS_DECLARE_ALLOCATOR(GeneratorFunctionConstructor); | 
					
						
							| 
									
										
										
										
											2021-06-15 00:04:08 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     virtual void initialize(Realm&) override; | 
					
						
							| 
									
										
										
										
											2022-03-14 10:25:06 -06:00
										 |  |  |     virtual ~GeneratorFunctionConstructor() override = default; | 
					
						
							| 
									
										
										
										
											2021-06-15 00:04:08 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-20 21:16:30 +01:00
										 |  |  |     virtual ThrowCompletionOr<Value> call() override; | 
					
						
							| 
									
										
										
										
											2022-12-14 19:18:10 +00:00
										 |  |  |     virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override; | 
					
						
							| 
									
										
										
										
											2021-07-12 15:01:38 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-08-28 23:51:28 +02:00
										 |  |  |     explicit GeneratorFunctionConstructor(Realm&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-12 15:01:38 +03:00
										 |  |  |     bool has_constructor() const override { return true; } | 
					
						
							| 
									
										
										
										
											2021-06-15 00:04:08 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |