@@ -117,20 +117,10 @@ export function template(templateSpec, env) {
117117 return container . lookupProperty ( obj , name ) ;
118118 } ,
119119 strictLookup : function ( depths , name , loc ) {
120- const len = depths . length ;
121- let depth ;
122- for ( let i = 0 ; i < len ; i ++ ) {
123- const d = depths [ i ] ;
124- if (
125- d &&
126- ( typeof d === 'object' || typeof d === 'function' ) &&
127- name in d
128- ) {
129- depth = d ;
130- break ;
131- }
132- }
133- return container . strict ( depth , name , loc ) ;
120+ const result = container . lookup ( depths , name ) ;
121+ return result !== undefined
122+ ? result
123+ : container . strict ( undefined , name , loc ) ;
134124 } ,
135125 lookupProperty : function ( parent , propertyName ) {
136126 if ( Utils . isMap ( parent ) ) {
@@ -153,9 +143,17 @@ export function template(templateSpec, env) {
153143 lookup : function ( depths , name ) {
154144 const len = depths . length ;
155145 for ( let i = 0 ; i < len ; i ++ ) {
156- let result = depths [ i ] && container . lookupProperty ( depths [ i ] , name ) ;
157- if ( result != null ) {
158- return depths [ i ] [ name ] ;
146+ const d = depths [ i ] ;
147+ if ( d == null ) continue ;
148+ if ( typeof d === 'object' || typeof d === 'function' ) {
149+ if ( Utils . isMap ( d ) ? d . has ( name ) : name in d ) {
150+ return container . lookupProperty ( d , name ) ;
151+ }
152+ } else {
153+ const result = container . lookupProperty ( d , name ) ;
154+ if ( result != null ) {
155+ return result ;
156+ }
159157 }
160158 }
161159 } ,
0 commit comments