Adjust ann_assign_init rule...

We've reduced spurious `sstmt` reductions. The `ann_assign_init` rule needs
to adjust accordingly.
This commit is contained in:
rocky
2020-11-03 18:07:42 -05:00
parent 1164cd90dc
commit 78dbc8ae0f
2 changed files with 6 additions and 5 deletions

View File

@@ -414,10 +414,9 @@ class TreeTransform(GenericASTTraversal, object):
prev = node[0][0]
new_stmts = [node[0]]
for i, sstmt in enumerate(node[1:]):
ann_assign = sstmt[0][0]
ann_assign = sstmt[0]
if (
sstmt[0] == "stmt"
and ann_assign == "ann_assign"
ann_assign == "ann_assign"
and prev == "assign"
):
annotate_var = ann_assign[-2]
@@ -426,7 +425,7 @@ class TreeTransform(GenericASTTraversal, object):
sstmt[0][0] = SyntaxTree(
"ann_assign_init", [ann_assign[0], prev[0], annotate_var]
)
sstmt[0][0].transformed_by = "n_stmts"
sstmt[0].transformed_by = "n_stmts"
pass
pass
new_stmts.append(sstmt)

View File

@@ -10,6 +10,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is suitable for sourcing inside POSIX shell as
# well as importing into Python
# well as importing into Python. That's why there is no
# space around "=" below.
VERSION="3.7.4" # noqa