Amaury Forgeot d'Arc avatar Amaury Forgeot d'Arc committed 2b627c6

Some missing _fields

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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.