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
Gwenaël Samain
cython
Commits
c96fc2de
Commit
c96fc2de
authored
Jun 28, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use existing Python not operator for !.
parent
f97b7dc0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
19 deletions
+15
-19
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+14
-15
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+0
-1
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+0
-2
tests/run/cpp_operators.pyx
tests/run/cpp_operators.pyx
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
c96fc2de
...
@@ -6939,7 +6939,20 @@ class NotNode(ExprNode):
...
@@ -6939,7 +6939,20 @@ class NotNode(ExprNode):
def
analyse_types
(
self
,
env
):
def
analyse_types
(
self
,
env
):
self
.
operand
.
analyse_types
(
env
)
self
.
operand
.
analyse_types
(
env
)
self
.
operand
=
self
.
operand
.
coerce_to_boolean
(
env
)
if
self
.
operand
.
type
.
is_cpp_class
:
type
=
self
.
operand
.
type
function
=
type
.
scope
.
lookup
(
"operator!"
)
if
not
function
:
error
(
self
.
pos
,
"'!' operator not defined for %s"
%
(
type
))
self
.
type
=
PyrexTypes
.
error_type
return
func_type
=
function
.
type
if
func_type
.
is_ptr
:
func_type
=
func_type
.
base_type
self
.
type
=
func_type
.
return_type
else
:
self
.
operand
=
self
.
operand
.
coerce_to_boolean
(
env
)
def
calculate_result_code
(
self
):
def
calculate_result_code
(
self
):
return
"(!%s)"
%
self
.
operand
.
result
()
return
"(!%s)"
%
self
.
operand
.
result
()
...
@@ -7021,20 +7034,6 @@ class CUnopNode(UnopNode):
...
@@ -7021,20 +7034,6 @@ class CUnopNode(UnopNode):
def
is_py_operation
(
self
):
def
is_py_operation
(
self
):
return
False
return
False
class
BangNode
(
CUnopNode
):
# unary ! operator
operator
=
'!'
def
analyse_c_operation
(
self
,
env
):
if
self
.
operand
.
type
.
is_ptr
or
self
.
operand
.
type
.
is_numeric
:
self
.
type
=
PyrexTypes
.
c_bint_type
else
:
self
.
type_error
()
def
calculate_result_code
(
self
):
return
"(!%s)"
%
self
.
operand
.
result
()
class
DereferenceNode
(
CUnopNode
):
class
DereferenceNode
(
CUnopNode
):
# unary * operator
# unary * operator
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
c96fc2de
...
@@ -614,7 +614,6 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
...
@@ -614,7 +614,6 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
'typeof'
:
ExprNodes
.
TypeofNode
,
'typeof'
:
ExprNodes
.
TypeofNode
,
'operator.address'
:
ExprNodes
.
AmpersandNode
,
'operator.address'
:
ExprNodes
.
AmpersandNode
,
'operator.bang'
:
ExprNodes
.
BangNode
,
'operator.dereference'
:
ExprNodes
.
DereferenceNode
,
'operator.dereference'
:
ExprNodes
.
DereferenceNode
,
'operator.preincrement'
:
ExprNodes
.
inc_dec_constructor
(
True
,
'++'
),
'operator.preincrement'
:
ExprNodes
.
inc_dec_constructor
(
True
,
'++'
),
'operator.predecrement'
:
ExprNodes
.
inc_dec_constructor
(
True
,
'--'
),
'operator.predecrement'
:
ExprNodes
.
inc_dec_constructor
(
True
,
'--'
),
...
...
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
c96fc2de
...
@@ -333,8 +333,6 @@ a special module ``cython.operator``. The functions provided are:
...
@@ -333,8 +333,6 @@ a special module ``cython.operator``. The functions provided are:
* ``cython.operator.dereference`` for dereferencing. ``dereference(foo)``
* ``cython.operator.dereference`` for dereferencing. ``dereference(foo)``
will produce the C++ code ``*(foo)``
will produce the C++ code ``*(foo)``
* ``cython.operator.bang`` for not. ``bang(foo)``
will produce the C++ code ``!(foo)``
* ``cython.operator.preincrement`` for pre-incrementation. ``preincrement(foo)``
* ``cython.operator.preincrement`` for pre-incrementation. ``preincrement(foo)``
will produce the C++ code ``++(foo)``
will produce the C++ code ``++(foo)``
* ...
* ...
...
...
tests/run/cpp_operators.pyx
View file @
c96fc2de
...
@@ -58,7 +58,7 @@ def test_unops():
...
@@ -58,7 +58,7 @@ def test_unops():
out
(
-
t
[
0
])
out
(
-
t
[
0
])
out
(
~
t
[
0
])
out
(
~
t
[
0
])
out
(
deref
(
t
[
0
]))
out
(
deref
(
t
[
0
]))
out
(
cython
.
operator
.
bang
(
t
[
0
])
)
out
(
not
t
[
0
]
)
del
t
del
t
def
test_incdec
():
def
test_incdec
():
...
...
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