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
67d4ed42
Commit
67d4ed42
authored
Jan 14, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dereference node.
parent
f719d11c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+20
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+1
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
67d4ed42
...
@@ -4129,7 +4129,9 @@ class UnopNode(ExprNode):
...
@@ -4129,7 +4129,9 @@ class UnopNode(ExprNode):
self
.
gil_error
()
self
.
gil_error
()
def
is_cpp_operation
(
self
):
def
is_cpp_operation
(
self
):
return
self
.
operand
.
type
.
is_cpp_class
type
=
self
.
operand
.
type
return
(
type
.
is_cpp_class
or
(
type
.
is_ptr
or
type
.
is_reference
)
and
type
.
base_type
.
is_cpp_class
)
def
coerce_operand_to_pyobject
(
self
,
env
):
def
coerce_operand_to_pyobject
(
self
,
env
):
self
.
operand
=
self
.
operand
.
coerce_to_pyobject
(
env
)
self
.
operand
=
self
.
operand
.
coerce_to_pyobject
(
env
)
...
@@ -4156,7 +4158,7 @@ class UnopNode(ExprNode):
...
@@ -4156,7 +4158,7 @@ class UnopNode(ExprNode):
def
analyse_cpp_operation
(
self
,
env
):
def
analyse_cpp_operation
(
self
,
env
):
type
=
operand
.
type
type
=
operand
.
type
if
type
.
is_ptr
:
if
type
.
is_ptr
or
type
.
is_reference
:
type
=
type
.
base_type
type
=
type
.
base_type
entry
=
env
.
lookup
(
type
.
name
)
entry
=
env
.
lookup
(
type
.
name
)
function
=
entry
.
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
function
=
entry
.
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
...
@@ -4259,6 +4261,22 @@ class TildeNode(UnopNode):
...
@@ -4259,6 +4261,22 @@ class TildeNode(UnopNode):
return
"(~%s)"
%
self
.
operand
.
result
()
return
"(~%s)"
%
self
.
operand
.
result
()
class
DereferenceNode
(
UnopNode
):
# unary '*' operator
def
is_py_operation
(
self
):
return
False
def
analyse_c_operation
(
self
,
env
):
if
self
.
operand
.
type
.
is_ptr
:
self
.
type
=
self
.
operand
.
type
.
base_type
else
:
self
.
type_error
()
def
calculate_result_code
(
self
):
return
"(*%s)"
%
self
.
operand
.
result
()
class
AmpersandNode
(
ExprNode
):
class
AmpersandNode
(
ExprNode
):
# The C address-of operator.
# The C address-of operator.
#
#
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
67d4ed42
...
@@ -326,6 +326,7 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
...
@@ -326,6 +326,7 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
unop_method_nodes
=
{
unop_method_nodes
=
{
'typeof'
:
TypeofNode
,
'typeof'
:
TypeofNode
,
'address'
:
AmpersandNode
,
'address'
:
AmpersandNode
,
'dereference'
:
DereferenceNode
,
}
}
special_methods
=
set
([
'declare'
,
'union'
,
'struct'
,
'typedef'
,
'sizeof'
,
'cast'
,
'pointer'
,
'compiled'
,
'NULL'
]
special_methods
=
set
([
'declare'
,
'union'
,
'struct'
,
'typedef'
,
'sizeof'
,
'cast'
,
'pointer'
,
'compiled'
,
'NULL'
]
...
...
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