| 
									
										
										
										
											2019-12-03 21:27:39 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Sergey Melyukov @smelukov | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const RuntimeGlobals = require("../RuntimeGlobals"); | 
					
						
							|  |  |  | const RuntimeModule = require("../RuntimeModule"); | 
					
						
							|  |  |  | const Template = require("../Template"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-13 01:24:59 +08:00
										 |  |  | /** @typedef {import("../Compilation")} Compilation */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-03 21:27:39 +08:00
										 |  |  | class HasOwnPropertyRuntimeModule extends RuntimeModule { | 
					
						
							|  |  |  | 	constructor() { | 
					
						
							|  |  |  | 		super("hasOwnProperty shorthand"); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2023-06-17 01:13:03 +08:00
										 |  |  | 	 * @returns {string | null} runtime code | 
					
						
							| 
									
										
										
										
											2019-12-03 21:27:39 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	generate() { | 
					
						
							| 
									
										
										
										
											2023-06-13 01:24:59 +08:00
										 |  |  | 		const compilation = /** @type {Compilation} */ (this.compilation); | 
					
						
							|  |  |  | 		const { runtimeTemplate } = compilation; | 
					
						
							| 
									
										
										
										
											2019-12-03 21:27:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		return Template.asString([ | 
					
						
							|  |  |  | 			`${RuntimeGlobals.hasOwnProperty} = ${runtimeTemplate.returningFunction( | 
					
						
							|  |  |  | 				"Object.prototype.hasOwnProperty.call(obj, prop)", | 
					
						
							|  |  |  | 				"obj, prop" | 
					
						
							|  |  |  | 			)}`
 | 
					
						
							|  |  |  | 		]); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = HasOwnPropertyRuntimeModule; |