Commits

Amaury Forgeot d'Arc committed 2b627c6

Some missing _fields

  • Participants
  • Parent commits 308470e
  • Branches split-ast-classes

Comments (0)

Files changed (3)

pypy/interpreter/astcompiler/ast.py

         _ifs = [expr.from_object(space, w_item) for w_item in ifs_w]
         return comprehension(_target, _iter, _ifs)
 
-State.ast_type('comprehension', 'AST', None)
+State.ast_type('comprehension', 'AST', ['target', 'iter', 'ifs'])
 
 class excepthandler(AST):
 
         _defaults = [expr.from_object(space, w_item) for w_item in defaults_w]
         return arguments(_args, _vararg, _kwarg, _defaults)
 
-State.ast_type('arguments', 'AST', None)
+State.ast_type('arguments', 'AST', ['args', 'vararg', 'kwarg', 'defaults'])
 
 class keyword(AST):
 
         _value = expr.from_object(space, w_value)
         return keyword(_arg, _value)
 
-State.ast_type('keyword', 'AST', None)
+State.ast_type('keyword', 'AST', ['arg', 'value'])
 
 class alias(AST):
 
         _asname = space.str_or_None_w(w_asname)
         return alias(_name, _asname)
 
-State.ast_type('alias', 'AST', None)
+State.ast_type('alias', 'AST', ['name', 'asname'])
 
 class ASTVisitor(object):
 

pypy/interpreter/astcompiler/test/test_ast.py

                                  space.wrap("_fields"))
         assert space.eq_w(w_fields, space.wrap(
             ('name', 'args', 'body', 'decorator_list')))
+        w_fields = space.getattr(ast.get(space).w_arguments,
+                                 space.wrap("_fields"))
+        assert space.eq_w(w_fields, space.wrap(
+            ('args', 'vararg', 'kwarg', 'defaults')))
         
     def test_attributes(self, space):
         w_attrs = space.getattr(ast.get(space).w_FunctionDef,

pypy/interpreter/astcompiler/tools/asdl_py.py

         self.emit("visitor.visit_%s(self)" % (name,), 2)
         self.emit("")
         self.make_converters(product.fields, name)
-        self.emit("State.ast_type('%r', 'AST', None)" % (name,))
+        self.emit("State.ast_type('%r', 'AST', %s)" %
+                  (name, [repr(f.name) for f in product.fields]))
         self.emit("")
 
     def get_value_converter(self, field, value):