Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
15577be1
Commit
15577be1
authored
Feb 19, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cimported type fixes.
parent
556f15c6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
23 deletions
+13
-23
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+11
-11
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-12
No files found.
Cython/Compiler/ExprNodes.py
View file @
15577be1
...
@@ -1045,21 +1045,17 @@ class NewExprNode(AtomicExprNode):
...
@@ -1045,21 +1045,17 @@ class NewExprNode(AtomicExprNode):
# C++ new statement
# C++ new statement
#
#
# cppclass string c++ class to create
# cppclass node c++ class to create
# template_parameters None or [ExprNode] temlate parameters, if any
type
=
None
def
infer_type
(
self
,
env
):
def
infer_type
(
self
,
env
):
cppclass
=
self
.
cppclass
.
analyse_as_type
(
env
)
type
=
self
.
cppclass
.
analyse_as_type
(
env
)
entry
=
env
.
lookup
(
cppclass
.
name
)
if
type
is
None
or
not
type
.
is_cpp_class
:
if
entry
is
None
or
not
entry
.
is_cpp_class
:
error
(
self
.
pos
,
"new operator can only be applied to a C++ class"
)
error
(
self
.
pos
,
"new operator can only be applied to a C++ class"
)
self
.
type
=
error_type
return
return
self
.
cpp_check
(
env
)
self
.
cpp_check
(
env
)
if
self
.
template_parameters
is
not
None
:
template_types
=
[
v
.
analyse_as_type
(
env
)
for
v
in
self
.
template_parameters
]
type
=
entry
.
type
.
specialize_here
(
self
.
pos
,
template_types
)
else
:
type
=
entry
.
type
constructor
=
type
.
scope
.
lookup
(
u'<init>'
)
constructor
=
type
.
scope
.
lookup
(
u'<init>'
)
if
constructor
is
None
:
if
constructor
is
None
:
return_type
=
PyrexTypes
.
CFuncType
(
type
,
[])
return_type
=
PyrexTypes
.
CFuncType
(
type
,
[])
...
@@ -1072,6 +1068,7 @@ class NewExprNode(AtomicExprNode):
...
@@ -1072,6 +1068,7 @@ class NewExprNode(AtomicExprNode):
return
self
.
type
return
self
.
type
def
analyse_types
(
self
,
env
):
def
analyse_types
(
self
,
env
):
if
self
.
type
is
None
:
self
.
infer_type
(
env
)
self
.
infer_type
(
env
)
def
generate_result_code
(
self
,
code
):
def
generate_result_code
(
self
,
code
):
...
@@ -2582,6 +2579,9 @@ class SimpleCallNode(CallNode):
...
@@ -2582,6 +2579,9 @@ class SimpleCallNode(CallNode):
return
func_type
return
func_type
def
analyse_c_function_call
(
self
,
env
):
def
analyse_c_function_call
(
self
,
env
):
if
self
.
function
.
type
is
error_type
:
self
.
type
=
self
.
function
.
type
return
if
self
.
function
.
type
.
is_cpp_class
:
if
self
.
function
.
type
.
is_cpp_class
:
function
=
self
.
function
.
type
.
scope
.
lookup
(
"operator()"
)
function
=
self
.
function
.
type
.
scope
.
lookup
(
"operator()"
)
if
function
is
None
:
if
function
is
None
:
...
...
Cython/Compiler/Parsing.py
View file @
15577be1
...
@@ -316,18 +316,8 @@ def p_new_expr(s):
...
@@ -316,18 +316,8 @@ def p_new_expr(s):
# s.systring == 'new'.
# s.systring == 'new'.
pos
=
s
.
position
()
pos
=
s
.
position
()
s
.
next
()
s
.
next
()
node
=
p_atom
(
s
)
cppclass
=
p_c_base_type
(
s
)
if
s
.
sy
==
'.'
:
return
p_call
(
s
,
ExprNodes
.
NewExprNode
(
pos
,
cppclass
=
cppclass
))
name
=
p_trailer
(
s
,
node
)
else
:
name
=
node
if
s
.
sy
==
'['
:
s
.
next
()
template_parameters
=
p_simple_expr_list
(
s
)
s
.
expect
(
']'
)
else
:
template_parameters
=
None
return
p_call
(
s
,
ExprNodes
.
NewExprNode
(
pos
,
cppclass
=
name
,
template_parameters
=
template_parameters
))
#trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
#trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment