在 return 的时候递归向上扫描所有的 Block,并打上标记,用于后面执行 return 的时候直接返回。
(tree antlr.ParseTree, value interface{})
| 224 | |
| 225 | // 在 return 的时候递归向上扫描所有的 Block,并打上标记,用于后面执行 return 的时候直接返回。 |
| 226 | func (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 | |
| 239 | func (v *Visitor) VisitBlockVarDeclar(ctx *parser.BlockVarDeclarContext) interface{} { |
| 240 | return v.Visit(ctx.VariableDeclarators()) |
no test coverage detected