Remove support for defclass
attribute lists
This commit is contained in:
parent
6bc9e842e1
commit
c99360b294
2
NEWS.rst
2
NEWS.rst
@ -6,6 +6,8 @@ Unreleased
|
|||||||
Removals
|
Removals
|
||||||
------------------------------
|
------------------------------
|
||||||
* Python 2 is no longer supported.
|
* Python 2 is no longer supported.
|
||||||
|
* Support for attribute lists in `defclass` has been removed. Use `setv`
|
||||||
|
and `defn` instead.
|
||||||
|
|
||||||
0.17.0
|
0.17.0
|
||||||
==============================
|
==============================
|
||||||
|
@ -1475,10 +1475,9 @@ class HyASTCompiler(object):
|
|||||||
|
|
||||||
@special("defclass", [
|
@special("defclass", [
|
||||||
SYM,
|
SYM,
|
||||||
maybe(brackets(many(FORM)) + maybe(STR) +
|
maybe(brackets(many(FORM)) + maybe(STR) + many(FORM))])
|
||||||
maybe(brackets(many(SYM + FORM))) + many(FORM))])
|
|
||||||
def compile_class_expression(self, expr, root, name, rest):
|
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 = (
|
bases_expr, bases, keywords = (
|
||||||
self._compile_collect(base_list[0], with_kwargs=True))
|
self._compile_collect(base_list[0], with_kwargs=True))
|
||||||
@ -1488,11 +1487,6 @@ class HyASTCompiler(object):
|
|||||||
if docstring is not None:
|
if docstring is not None:
|
||||||
bodyr += self.compile(docstring).expr_as_stmt()
|
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:
|
for e in body:
|
||||||
e = self.compile(self._rewire_init(
|
e = self.compile(self._rewire_init(
|
||||||
macroexpand(e, self.module, self)))
|
macroexpand(e, self.module, self)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user