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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
f54ccdb2
Commit
f54ccdb2
authored
Jul 01, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new operator
parent
c6050b86
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+7
-8
No files found.
Cython/Compiler/ExprNodes.py
View file @
f54ccdb2
...
...
@@ -1079,28 +1079,24 @@ class ImagNode(AtomicNewTempExprNode):
class
NewExprNode
(
AtomicExprNode
):
type
=
PyrexTypes
.
cpp_class_type
subexpr
=
[
'cppclass'
]
def
analyse_types
(
self
,
env
):
entry
=
env
.
lookup
(
self
.
cppclass
)
if
entry
is
None
or
not
entry
.
is_cpp_class
:
error
(
self
.
pos
,
"new operator can only be applied to a C++ class"
)
return
constructor
=
entry
.
scope
.
lookup
(
'__init__'
)
constructor
=
entry
.
type
.
scope
.
lookup
(
u
'__init__'
)
if
constructor
is
None
:
print
"no constructor declared"
# create one
self
.
class_entry
=
entry
self
.
type
=
PyrexTypes
.
CPtrType
(
entry
.
type
)
self
.
func_type
=
constructor
.
type
self
.
type
=
constructor
.
type
def
generate_result_code
(
self
,
code
):
pass
def
calculate_result_code
(
self
):
return
"new "
+
self
.
entry
.
cname
return
"new "
+
self
.
class_
entry
.
cname
class
NameNode
(
AtomicExprNode
):
...
...
@@ -2456,6 +2452,9 @@ class SimpleCallNode(CallNode):
error
(
self
.
args
[
i
].
pos
,
"Python object cannot be passed as a varargs parameter"
)
# Calc result type and code fragment
if
isinstance
(
self
.
function
,
NewExprNode
):
self
.
type
=
PyrexTypes
.
CPtrType
(
self
.
function
.
class_entry
.
type
)
else
:
self
.
type
=
func_type
.
return_type
if
self
.
type
.
is_pyobject
:
self
.
result_ctype
=
py_object_type
...
...
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