MCPcopy Create free account
hub / github.com/crossoverJie/gscript / scanBlockStatementCtx

Method scanBlockStatementCtx

visitor.go:226–237  ·  view source on GitHub ↗

在 return 的时候递归向上扫描所有的 Block,并打上标记,用于后面执行 return 的时候直接返回。

(tree antlr.ParseTree, value interface{})

Source from the content-addressed store, hash-verified

224
225// 在 return 的时候递归向上扫描所有的 Block,并打上标记,用于后面执行 return 的时候直接返回。
226func (v *Visitor) scanBlockStatementCtx(tree antlr.ParseTree, value interface{}) {
227 context, ok := tree.(*parser.BlockContext)
228 if ok {
229 if v.blockCtx2Mark == nil {
230 v.blockCtx2Mark = make(map[*parser.BlockContext]interface{})
231 }
232 v.blockCtx2Mark[context] = value
233 }
234 if tree.GetParent() != nil {
235 v.scanBlockStatementCtx(tree.GetParent().(antlr.ParseTree), value)
236 }
237}
238
239func (v *Visitor) VisitBlockVarDeclar(ctx *parser.BlockVarDeclarContext) interface{} {
240 return v.Visit(ctx.VariableDeclarators())

Callers 1

VisitBlockStmsMethod · 0.95

Calls 1

GetParentMethod · 0.80

Tested by

no test coverage detected