@@ -82,8 +82,8 @@ export const evaluate = (h, built, fields, args) => {
8282 for ( let i = 1 ; i < built . length ; i ++ ) {
8383 const type = built [ i ++ ] ;
8484
85- // Set `built[0]` to truthy if this element depends on a dynamic value.
86- const value = built [ i ] ? fields [ built [ 0 ] = built [ i ++ ] ] : built [ ++ i ] ;
85+ // Set `built[0]`'s appropriate bits if this element depends on a dynamic value.
86+ const value = built [ i ] ? ( ( built [ 0 ] |= type ? 1 : 2 ) , fields [ built [ i ++ ] ] ) : built [ ++ i ] ;
8787
8888 if ( type === TAG_SET ) {
8989 args [ 0 ] = value ;
@@ -97,14 +97,15 @@ export const evaluate = (h, built, fields, args) => {
9797 else if ( type === PROP_APPEND ) {
9898 args [ 1 ] [ built [ ++ i ] ] += ( value + '' ) ;
9999 }
100- else if ( type ) {
101- // type === CHILD_RECURSE
102- tmp = h . apply ( 0 , evaluate ( h , value , fields , [ '' , null ] ) ) ;
100+ else if ( type ) { // type === CHILD_RECURSE
101+ // Set the operation list (including the staticness bits) as
102+ // `this` for the `h` call.
103+ tmp = h . apply ( value , evaluate ( h , value , fields , [ '' , null ] ) ) ;
103104 args . push ( tmp ) ;
104105
105106 if ( value [ 0 ] ) {
106- // If the child element is dynamic, then so is the current element.
107- built [ 0 ] = 1 ;
107+ // Set the 2nd lowest bit it the child element is dynamic .
108+ built [ 0 ] |= 2 ;
108109 }
109110 else {
110111 // Rewrite the operation list in-place if the child element is static.
@@ -116,8 +117,7 @@ export const evaluate = (h, built, fields, args) => {
116117 built [ i ] = tmp ;
117118 }
118119 }
119- else {
120- // type === CHILD_APPEND
120+ else { // type === CHILD_APPEND
121121 args . push ( value ) ;
122122 }
123123 }
0 commit comments