@@ -117,20 +117,20 @@ end
117117--- @return vm.node outNode
118118function mt :_lookInto (action , topNode , outNode )
119119 if not action then
120- return topNode , outNode
120+ return topNode , outNode or topNode
121121 end
122122 if self ._mark [action ] then
123- return topNode , outNode
123+ return topNode , outNode or topNode
124124 end
125125 self ._mark [action ] = true
126126 local top = self ._objs [self ._index ]
127127 if not top then
128- return topNode , outNode
128+ return topNode , outNode or topNode
129129 end
130130 if not guide .isInRange (action , top .finish )
131131 -- trick for `local tp = type(x);if tp == 'string' then`
132132 and action .type ~= ' binary' then
133- return topNode , outNode
133+ return topNode , outNode or topNode
134134 end
135135 local set
136136 local value = vm .getObjectValue (action )
@@ -151,7 +151,9 @@ function mt:_lookInto(action, topNode, outNode)
151151 self :_fastWard (action .filter .finish , blockNode )
152152 end
153153 blockNode = self :_launchBlock (action , blockNode :copy ())
154- topNode = mainNode :merge (blockNode )
154+ if mainNode then
155+ topNode = mainNode :merge (blockNode )
156+ end
155157 elseif action .type == ' if' then
156158 local hasElse
157159 local mainNode = topNode :copy ()
@@ -314,7 +316,7 @@ function mt:_lookInto(action, topNode, outNode)
314316 if set then
315317 topNode = self :_fastWard (set .range or set .finish , topNode )
316318 end
317- return topNode , outNode
319+ return topNode , outNode or topNode
318320end
319321
320322--- @param block parser.object
@@ -356,7 +358,10 @@ function vm.launchRunner(loc, callback)
356358 if # self ._objs == 0 then
357359 return
358360 end
359-
360- local topNode = self :_launchBlock (guide .getParentBlock (loc ), vm .getNode (loc ):copy ())
361+ local main = guide .getParentBlock (loc )
362+ if not main then
363+ return
364+ end
365+ local topNode = self :_launchBlock (main , vm .getNode (loc ):copy ())
361366 self :_fastWard (math.maxinteger , topNode )
362367end
0 commit comments