Browse Source

BUGFIX: v_args didn't wrap overwritten inherited methods (Issue #350)

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.7.1
Erez Shinan 6 years ago
parent
commit
9420bce40a
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      lark/visitors.py

+ 3
- 1
lark/visitors.py View File

@@ -72,7 +72,9 @@ class Transformer:
assert mro[0] is cls
libmembers = {name for _cls in mro[1:] for name, _ in getmembers(_cls)}
for name, value in getmembers(cls):
if name.startswith('_') or name in libmembers:

# Make sure the function isn't inherited (unless it's overwritten)
if name.startswith('_') or (name in libmembers and name not in cls.__dict__):
continue
if not callable(cls.__dict__[name]):
continue


Loading…
Cancel
Save