(isFunction: boolean | undefined, returnByValue: boolean, expression: string, argCount: number, ...argsAndHandles: any[])
| 64 | } |
| 65 | |
| 66 | evaluate(isFunction: boolean | undefined, returnByValue: boolean, expression: string, argCount: number, ...argsAndHandles: any[]) { |
| 67 | const args = argsAndHandles.slice(0, argCount); |
| 68 | const handles = argsAndHandles.slice(argCount); |
| 69 | const parameters = []; |
| 70 | for (let i = 0; i < args.length; i++) |
| 71 | parameters[i] = parseEvaluationResultValue(args[i], handles); |
| 72 | |
| 73 | let result = this.global.eval(expression); |
| 74 | if (isFunction === true) { |
| 75 | result = result(...parameters); |
| 76 | } else if (isFunction === false) { |
| 77 | result = result; |
| 78 | } else { |
| 79 | // auto detect. |
| 80 | if (typeof result === 'function') |
| 81 | result = result(...parameters); |
| 82 | } |
| 83 | return returnByValue ? this._promiseAwareJsonValueNoThrow(result) : result; |
| 84 | } |
| 85 | |
| 86 | jsonValue(returnByValue: true, value: any) { |
| 87 | // Special handling of undefined to work-around multi-step returnByValue handling in WebKit. |
nothing calls this directly
no test coverage detected