1- import { isFunction , isProxy } from "../../shared/utils.js" ;
1+ import { isFunction , isNullOrUndefined , isProxy } from "../../shared/utils.js" ;
22import { PURITY_RELATIVE } from "./interpreter.js" ;
33import { Lexer } from "./lexer/lexer.js" ;
44import { Parser } from "./parser/parser.js" ;
@@ -131,7 +131,7 @@ export class ParseProvider {
131131
132132 // Do not invoke for getters
133133 if ( scope ?. getter ) {
134- return ;
134+ return undefined ;
135135 }
136136 const res = isFunction ( value ) ? value ( ) : value ;
137137
@@ -165,16 +165,16 @@ export class ParseProvider {
165165 : [ parsedExpression ] ;
166166
167167 if ( ! interceptorFn . $$pure ) {
168- fn . inputs = fn . inputs . map ( function ( e ) {
168+ fn . inputs = fn . inputs . map ( function ( input ) {
169169 // Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a
170170 // non-pure interceptor function.
171- if ( e . isPure === PURITY_RELATIVE ) {
172- return function depurifier ( s ) {
173- return e ( s ) ;
171+ if ( input . isPure === PURITY_RELATIVE ) {
172+ return function depurifier ( x ) {
173+ return input ( x ) ;
174174 } ;
175175 }
176176
177- return e ;
177+ return input ;
178178 } ) ;
179179 }
180180 }
@@ -226,7 +226,7 @@ function addWatchDelegate(parsedExpression) {
226226 * @param {Function } listener
227227 * @param {* } objectEquality
228228 * @param {import('./interface').CompiledExpression } parsedExpression
229- * @returns
229+ * @returns { any }
230230 */
231231function inputsWatchDelegate (
232232 scope ,
@@ -274,37 +274,39 @@ function inputsWatchDelegate(
274274 oldInputValues [ i ] = null ;
275275 }
276276
277- return scope . $watch (
278- // @ts -ignore
279- ( scope ) => {
280- let changed = false ;
281-
282- for ( let i = 0 , ii = inputExpressions . length ; i < ii ; i ++ ) {
283- const newInputValue = inputExpressions [ i ] ( scope ) ;
284-
285- if (
286- changed ||
287- ( changed = ! expressionInputDirtyCheck (
288- newInputValue ,
289- oldInputValueOfValues [ i ] ,
290- inputExpressions [ i ] . isPure ,
291- ) )
292- ) {
293- oldInputValues [ i ] = newInputValue ;
294- oldInputValueOfValues [ i ] =
295- newInputValue && getValueOf ( newInputValue ) ;
296- }
297- }
298-
299- if ( changed ) {
300- lastResult = parsedExpression ( scope , undefined , oldInputValues ) ;
301- }
302-
303- return lastResult ;
304- } ,
305- listener ,
306- objectEquality ,
307- ) ;
277+ // return scope.$watch(
278+ // // @ts -ignore
279+ // (scope) => {
280+ // debugger
281+ // let changed = false;
282+
283+ // for (let i = 0, ii = inputExpressions.length; i < ii; i++) {
284+ // const newInputValue = inputExpressions[i](scope);
285+
286+ // if (
287+ // changed ||
288+ // (changed = !expressionInputDirtyCheck(
289+ // newInputValue,
290+ // oldInputValueOfValues[i],
291+ // inputExpressions[i].isPure,
292+ // ))
293+ // ) {
294+ // oldInputValues[i] = newInputValue;
295+ // oldInputValueOfValues[i] =
296+ // newInputValue && getValueOf(newInputValue);
297+ // }
298+ // }
299+
300+ // if (changed) {
301+ // lastResult = parsedExpression(scope, undefined, oldInputValues);
302+ // }
303+
304+ // return lastResult;
305+ // },
306+ // listener,
307+ // objectEquality,
308+ // );
309+ return undefined ;
308310 }
309311}
310312
@@ -323,7 +325,7 @@ function expressionInputDirtyCheck(
323325 oldValueOfValue ,
324326 compareObjectIdentity ,
325327) {
326- if ( newValue == null || oldValueOfValue == null ) {
328+ if ( isNullOrUndefined ( newValue ) || isNullOrUndefined ( oldValueOfValue ) ) {
327329 // null/undefined
328330 return newValue === oldValueOfValue ;
329331 }
@@ -346,7 +348,7 @@ function expressionInputDirtyCheck(
346348
347349 return (
348350 newValue === oldValueOfValue ||
349- ( newValue !== newValue && oldValueOfValue !== oldValueOfValue )
351+ ( Number . isNaN ( newValue ) && Number . isNaN ( oldValueOfValue ) )
350352 ) ;
351353}
352354
0 commit comments