Clean up string handling in _compile_assign
This commit is contained in:
parent
bc524daee8
commit
88c0f92810
@ -1345,17 +1345,16 @@ class HyASTCompiler(object):
|
|||||||
|
|
||||||
def _compile_assign(self, root, name, result):
|
def _compile_assign(self, root, name, result):
|
||||||
|
|
||||||
str_name = "%s" % name
|
if name in [HySymbol(x) for x in ("None", "True", "False")]:
|
||||||
if str_name in ("None", "True", "False"):
|
|
||||||
raise self._syntax_error(name,
|
raise self._syntax_error(name,
|
||||||
"Can't assign to `%s'" % str_name)
|
"Can't assign to `{}'".format(name))
|
||||||
|
|
||||||
result = self.compile(result)
|
result = self.compile(result)
|
||||||
ld_name = self.compile(name)
|
ld_name = self.compile(name)
|
||||||
|
|
||||||
if isinstance(ld_name.expr, ast.Call):
|
if isinstance(ld_name.expr, ast.Call):
|
||||||
raise self._syntax_error(name,
|
raise self._syntax_error(name,
|
||||||
"Can't assign to a callable: `%s'" % str_name)
|
"Can't assign to a callable: `{}'".format(name))
|
||||||
|
|
||||||
if (result.temp_variables
|
if (result.temp_variables
|
||||||
and isinstance(name, HySymbol)
|
and isinstance(name, HySymbol)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user