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
ed063894
Commit
ed063894
authored
Jan 15, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cpp () operator
parent
c0b49eab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
2 deletions
+27
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+9
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
tests/run/cpp_operators.pyx
tests/run/cpp_operators.pyx
+14
-0
tests/run/cpp_operators_helper.h
tests/run/cpp_operators_helper.h
+3
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
ed063894
...
...
@@ -2579,7 +2579,15 @@ class SimpleCallNode(CallNode):
return
func_type
def
analyse_c_function_call
(
self
,
env
):
entry
=
PyrexTypes
.
best_match
(
self
.
args
,
self
.
function
.
entry
.
all_alternatives
(),
self
.
pos
)
if
self
.
function
.
type
.
is_cpp_class
:
function
=
self
.
function
.
type
.
scope
.
lookup
(
"operator()"
)
if
function
is
None
:
self
.
type
=
PyrexTypes
.
error_type
self
.
result_code
=
"<error>"
return
else
:
function
=
self
.
function
.
entry
entry
=
PyrexTypes
.
best_match
(
self
.
args
,
function
.
all_alternatives
(),
self
.
pos
)
if
not
entry
:
self
.
type
=
PyrexTypes
.
error_type
self
.
result_code
=
"<error>"
...
...
Cython/Compiler/Parsing.py
View file @
ed063894
...
...
@@ -2061,7 +2061,7 @@ supported_overloaded_operators = set([
'+'
,
'-'
,
'*'
,
'/'
,
'%'
,
'++'
,
'--'
,
'~'
,
'|'
,
'&'
,
'^'
,
'<<'
,
'>>'
,
'=='
,
'!='
,
'>='
,
'>'
,
'<='
,
'<'
,
'[]'
,
'[]'
,
'()'
,
])
def
p_c_simple_declarator
(
s
,
ctx
,
empty
,
is_type
,
cmethod_flag
,
...
...
tests/run/cpp_operators.pyx
View file @
ed063894
...
...
@@ -34,6 +34,9 @@ cdef extern from "cpp_operators_helper.h":
char
*
operator
>
(
int
)
char
*
operator
<
(
int
)
char
*
operator
[](
int
)
char
*
operator
()(
int
)
def
test_unops
():
"""
>>> test_unops()
...
...
@@ -111,3 +114,14 @@ def test_cmp():
print
t
[
0
]
<=
1
print
t
[
0
]
<
1
del
t
def
test_index_call
():
"""
>>> test_index_call()
binary []
binary ()
"""
cdef
TestOps
*
t
=
new
TestOps
()
print
t
[
0
][
100
]
print
t
[
0
](
100
)
del
t
tests/run/cpp_operators_helper.h
View file @
ed063894
...
...
@@ -38,4 +38,7 @@ public:
BIN_OP
(
>=
);
BIN_OP
(
>
);
BIN_OP
([]);
BIN_OP
(());
};
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