feat(option): allow case None on nullable pointers
None stays a keyword literal; the pattern parser already produced MatchSingleton, and the nullable-pointer match now treats it as the Nil branch. LSP colors None as a keyword.
This commit is contained in:
1 parent
c7ab075594
commit
98d4da7602
2 files changed
+3
No files matched your search
@@ -301,6 +301,7 @@ novirtual class MatchGenMixin:
|
||||
if vnm is None: return 0
|
||||
if string.strcmp(vnm, "Some") == 0: return 1
|
||||
if string.strcmp(vnm, "Nil") == 0: return 2
|
||||
if k == ast.ASTKind.MatchSingleton: return 2
|
||||
return 0
|
||||
|
||||
def _match_has_opt_pattern(self, node: ast.Match*) -> int:
|
||||
|
||||
@@ -535,6 +535,8 @@ def _LexStream(pool: memhub.MemManager*,
|
||||
typ = ST_NUMBER
|
||||
elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "own") == 0:
|
||||
typ = ST_KEYWORD
|
||||
elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "None") == 0:
|
||||
typ = ST_KEYWORD
|
||||
elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "Some") == 0:
|
||||
typ = ST_CLASS
|
||||
elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "Nil") == 0:
|
||||
|
||||
Reference in new issue
Block a user