venden / pyv8

Automatically exported from code.google.com/p/pyv8
0 stars 0 forks source link

AST can't visit object properties: No to_python (by-value) converter found for C++ type: v8::internal::ObjectLiteralProperty* #235

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

    import PyV8 as v8

    ctx = v8.JSContext()
    ctx.enter()

    class Visitor:
        def onProgram(self, prog):
            for stmt in prog.body:
                stmt.visit(self)

        def onExpressionStatement(self, stmt):
            stmt.expression.visit(self)

        def onObjectLiteral(self, obj):
            print obj.properties

    x = v8.JSEngine().compile("({ a: b })")
    x.visit(Visitor())

What is the expected output? What do you see instead?
The expected output is a list of object properties.
The sample errors:

    Traceback (most recent call last):
      File "pyv8-bug.py", line 18, in <module>
        x.visit(Visitor())
      File "pyv8-bug.py", line 9, in onProgram
        stmt.visit(self)
      File "pyv8-bug.py", line 12, in onExpressionStatement
        stmt.expression.visit(self)
      File "pyv8-bug.py", line 15, in onObjectLiteral
        print obj.properties
    TypeError: No to_python (by-value) converter found for C++ type: v8::internal::ObjectLiteralProperty*

What version of the product are you using? On what operating system?

Revision 19632 on Ubuntu 12.04 x86_64

Please provide any additional information below.

There's a test case that covers this, but it isn't run because the according 
assignment node is never visited. I attached a patch to fix the test case.

Original issue reported on code.google.com by fab...@lastline.com on 5 Aug 2014 at 11:42

Attachments: