File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ const jwScope = {
6262 }
6363 } ,
6464
65+ depth ( array ) {
66+ return array . length
67+ }
68+
6569 current ( array ) {
6670 let set = new Set ( )
6771 for ( let i = 0 ; i < array . length ; i ++ ) {
@@ -186,13 +190,18 @@ class Extension {
186190 }
187191 } ,
188192 } ,
189- "---" ,
190193 {
191194 opcode : "reset" ,
192195 blockType : BlockType . COMMAND ,
193196 text : "reset scope"
194197 } ,
195198 "---" ,
199+ {
200+ opcode : "depth" ,
201+ blockType : BlockType . REPORTER ,
202+ text : "depth of scope"
203+ } ,
204+ "---" ,
196205 {
197206 opcode : "current" ,
198207 text : "current scope" ,
@@ -245,6 +254,9 @@ class Extension {
245254 reset : ( generator , block ) => ( {
246255 kind : 'stack'
247256 } ) ,
257+ depth : ( generator , block ) => ( {
258+ kind : 'input'
259+ } ) ,
248260 current : ( generator , block ) => ( {
249261 kind : 'input'
250262 } ) ,
@@ -274,6 +286,9 @@ class Extension {
274286 reset : ( node , compiler , imports ) => {
275287 compiler . source += `vm.jwScope.reset(jwScope);\n`
276288 } ,
289+ depth : ( node , compiler , imports ) => {
290+ return new imports . TypedInput ( `vm.jwScope.depth(jwScope)` , imports . TYPE_NUMBER )
291+ } ,
277292 current : ( node , compiler , imports ) => {
278293 return new imports . TypedInput ( ! ! vm . jwArray ? 'vm.jwScope.current(jwScope)' : '0' , imports . TYPE_UNKNOWN )
279294 } ,
You can’t perform that action at this time.
0 commit comments