Fix on constructor call from cimported C++ classes
authordaniloaf <none@none>
Fri, 19 Feb 2010 17:39:44 +0000 (14:39 -0300)
committerdaniloaf <none@none>
Fri, 19 Feb 2010 17:39:44 +0000 (14:39 -0300)
Cython/Compiler/ExprNodes.py
Cython/Compiler/Parsing.py

index 1c04e93e7c8b9c49e867abec58e66b3065791a6e..37ccce03d7bc25b3c91560479a7a76ea2f25080f 100755 (executable)
@@ -1049,7 +1049,8 @@ class NewExprNode(AtomicExprNode):
     # template_parameters   None or [ExprNode]   temlate parameters, if any
     
     def infer_type(self, env):
-        entry = env.lookup(self.cppclass)
+        cppclass = self.cppclass.analyse_as_type(env)
+        entry = env.lookup(cppclass.name)
         if entry is None or not entry.is_cpp_class:
             error(self.pos, "new operator can only be applied to a C++ class")
             return
index 3f545c10fb7fc5a89bd92cc47c93f6d87dd0711a..984b156b82b7e725c4d56ab515551b0eb7411406 100644 (file)
@@ -316,7 +316,11 @@ def p_new_expr(s):
     # s.systring == 'new'.
     pos = s.position()
     s.next()
-    name = p_ident(s)
+    node = p_atom(s)
+    if s.sy == '.':
+        name = p_trailer(s, node)
+    else:
+        name = node
     if s.sy == '[':
         s.next()
         template_parameters = p_simple_expr_list(s)