pylint-bot/astroid-unofficial

Build real AST for Enum

Closed this issue · 1 comments

Originally reported by: BitBucket: ceridwenv, GitHub: ceridwenv


At the moment, the _stdlib enum builder is creating an AST filled with EmptyNodes and inserting base_type, which is a full tree with a ClassDef root, into class_node's bases attribute. Normally bases will never contain anything other than a sequence of Name nodes, and it's impossible to define an AST that looks like that in code because you can't put a statement as an argument to a class's bases. I plan to replace this with a small properly formed AST with a separate ClassDef node for the metaclass, a Name node referring to it, and a mock __init__ function.


Original comment by BitBucket: ceridwenv, GitHub: ceridwenv:


Mock ASTs for enums finished in 2591dc9.