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
22e2b0e0
Commit
22e2b0e0
authored
Jun 26, 2009
by
Danilo Freitas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workint with 'new' operator
parent
ebd8a5d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+20
-0
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+10
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
22e2b0e0
...
...
@@ -1077,6 +1077,26 @@ class ImagNode(AtomicNewTempExprNode):
self
.
c99_complex
=
code
.
globalstate
.
directives
[
'c99_complex'
]
class
NewExprNode
(
AtomicExprNode
):
type
=
PyrexTypes
.
cpp_class_type
subexpr
=
[
'arg'
]
def
analyse_types
(
self
,
env
):
entry
=
env
.
lookup
(
self
.
arg
.
name
)
if
not
entry
:
self
.
type
=
PyrexTypes
.
error_type
return
def
coerce_to
(
self
,
type
,
env
):
return
self
def
generate_result_code
(
self
,
code
):
pass
def
calculate_result_code
(
self
):
pass
class
NameNode
(
AtomicExprNode
):
# Reference to a local or global variable name.
...
...
Cython/Compiler/Parsing.py
View file @
22e2b0e0
...
...
@@ -279,6 +279,8 @@ def p_yield_expression(s):
#power: atom trailer* ('**' factor)*
def
p_power
(
s
):
if
s
.
systring
==
'new'
:
return
p_new_expr
(
s
)
n1
=
p_atom
(
s
)
while
s
.
sy
in
(
'('
,
'['
,
'.'
):
n1
=
p_trailer
(
s
,
n1
)
...
...
@@ -289,6 +291,14 @@ def p_power(s):
n1
=
ExprNodes
.
binop_node
(
pos
,
'**'
,
n1
,
n2
)
return
n1
def
p_new_expr
(
s
):
# s.systring == 'new'
pos
=
s
.
position
()
s
.
next
()
args
=
p_simple_expr_list
(
s
)
return
ExprNodes
.
NewExprNode
(
pos
,
arg
=
args
[
0
])
#trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
def
p_trailer
(
s
,
node1
):
...
...
Cython/Compiler/PyrexTypes.py
View file @
22e2b0e0
...
...
@@ -1586,6 +1586,8 @@ c_anon_enum_type = CAnonEnumType(-1, 1)
c_py_buffer_type
=
CStructOrUnionType
(
"Py_buffer"
,
"struct"
,
None
,
1
,
"Py_buffer"
)
c_py_buffer_ptr_type
=
CPtrType
(
c_py_buffer_type
)
cpp_class_type
=
CppClassType
(
"cpp_class"
,
"cppclass"
,
None
,
1
,
"cpp_class"
,
[])
error_type
=
ErrorType
()
unspecified_type
=
UnspecifiedType
()
...
...
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