fix(lsp): walk MatchClass sub-patterns as patterns so case captures bind
case Some(v): v is now declared and colored as a variable in the arm body.
This commit is contained in:
1 parent
1f491c6dba
commit
695c886ed0
1 file changed
+11
-2
@@ -1122,8 +1122,17 @@ def _WalkPattern(pool: memhub.MemManager*, a: LspAnalysis*, scope: LspScope*,
|
||||
if k == ast.ASTKind.MatchClass:
|
||||
mc: ast.MatchClass* = (ast.MatchClass*)(node)
|
||||
_WalkExpr(pool, a, scope, mc.cls)
|
||||
_WalkList(pool, a, scope, mc.patterns)
|
||||
_WalkList(pool, a, scope, mc.kwd_patterns)
|
||||
# Sub-patterns are patterns (captures bind variables), not plain expressions.
|
||||
if mc.patterns is not None:
|
||||
pi: int = 0
|
||||
while pi < int(len(mc.patterns)):
|
||||
_WalkPattern(pool, a, scope, mc.patterns.get(sizet(pi)))
|
||||
pi += 1
|
||||
if mc.kwd_patterns is not None:
|
||||
pi = 0
|
||||
while pi < int(len(mc.kwd_patterns)):
|
||||
_WalkPattern(pool, a, scope, mc.kwd_patterns.get(sizet(pi)))
|
||||
pi += 1
|
||||
return
|
||||
if k == ast.ASTKind.MatchAs:
|
||||
ma_p: ast.MatchAs* = (ast.MatchAs*)(node)
|
||||
|
||||
Reference in new issue
Block a user