From c99360b294acbe96f8c1d710cf532869864c7b83 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Tue, 2 Jul 2019 12:04:15 -0400 Subject: [PATCH] Remove support for `defclass` attribute lists --- NEWS.rst | 2 ++ hy/compiler.py | 10 ++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 00103d4..a0a00a9 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -6,6 +6,8 @@ Unreleased Removals ------------------------------ * Python 2 is no longer supported. +* Support for attribute lists in `defclass` has been removed. Use `setv` + and `defn` instead. 0.17.0 ============================== diff --git a/hy/compiler.py b/hy/compiler.py index 7638893..27ea786 100755 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -1475,10 +1475,9 @@ class HyASTCompiler(object): @special("defclass", [ SYM, - maybe(brackets(many(FORM)) + maybe(STR) + - maybe(brackets(many(SYM + FORM))) + many(FORM))]) + maybe(brackets(many(FORM)) + maybe(STR) + many(FORM))]) def compile_class_expression(self, expr, root, name, rest): - base_list, docstring, attrs, body = rest or ([[]], None, None, []) + base_list, docstring, body = rest or ([[]], None, []) bases_expr, bases, keywords = ( self._compile_collect(base_list[0], with_kwargs=True)) @@ -1488,11 +1487,6 @@ class HyASTCompiler(object): if docstring is not None: bodyr += self.compile(docstring).expr_as_stmt() - if attrs is not None: - bodyr += self.compile(self._rewire_init(HyExpression( - [HySymbol("setv")] + - [x for pair in attrs[0] for x in pair]).replace(attrs))) - for e in body: e = self.compile(self._rewire_init( macroexpand(e, self.module, self)))