From 844256b99bb78bca7e454e4919aa70f5514f6097 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Tue, 3 Oct 2017 14:47:35 -0700 Subject: [PATCH] Make Asty use static rather than instance methods This ensures `asty.Pass is asty.Pass`. --- hy/compiler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hy/compiler.py b/hy/compiler.py index fe47c9b..bc743e4 100755 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -111,13 +111,13 @@ def builds_model(*model_types): # ast.Foo(..., lineno=x.lineno, col_offset=x.col_offset) class Asty(object): def __getattr__(self, name): - setattr(Asty, name, lambda self, x, **kwargs: getattr(ast, name)( + setattr(Asty, name, staticmethod(lambda x, **kwargs: getattr(ast, name)( lineno=getattr( x, 'start_line', getattr(x, 'lineno', None)), col_offset=getattr( x, 'start_column', getattr(x, 'col_offset', None)), - **kwargs)) - return getattr(self, name) + **kwargs))) + return getattr(Asty, name) asty = Asty()