* buildOptimizer() * Given an array of identifiers, the optimizer returns a `const` declaration * destructuring `this.${name}`. * * @param {Array } constants * @param {string} name
(constants, name)
| 6155 | * @param {string} name |
| 6156 | */ |
| 6157 | function buildOptimizer(constants, name) { |
| 6158 | // No need to build an optimizer when there are no constants. |
| 6159 | if( constants.length=== 0) return ''; |
| 6160 | // Use 'this' to avoid going through the scope proxy, which is unnecessary |
| 6161 | // since the optimizer only needs references to the safe global. |
| 6162 | // Destructure the constants from the target scope object. |
| 6163 | return `const {${arrayJoin(constants,',') }} = this.${name};`; |
| 6164 | } |
| 6165 | |
| 6166 | /** |
| 6167 | * makeEvaluate() |