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
0331ccc1
Commit
0331ccc1
authored
Sep 18, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle cpp inplace assignments as binary operation nodes
parent
2c4d22f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-3
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
0331ccc1
...
...
@@ -11556,7 +11556,7 @@ class BinopNode(ExprNode):
or
self
.
operand2
.
type
.
is_cpp_class
)
def
analyse_cpp_py_operation
(
self
,
env
):
operator
=
self
.
operator
if
not
self
.
inplace
else
self
.
operator
+
"="
operator
=
self
.
operator
=
self
.
operator
if
not
self
.
inplace
else
self
.
operator
+
"="
entry
=
None
try
:
entry
=
env
.
lookup_operator
(
operator
,
[
self
.
operand1
,
self
.
operand2
],
throw
=
True
)
...
...
@@ -11583,7 +11583,7 @@ class BinopNode(ExprNode):
self
.
is_temp
=
1
def
analyse_cpp_operation
(
self
,
env
):
operator
=
self
.
operator
if
not
self
.
inplace
else
self
.
operator
+
"="
operator
=
self
.
operator
=
self
.
operator
if
not
self
.
inplace
else
self
.
operator
+
"="
entry
=
env
.
lookup_operator
(
operator
,
[
self
.
operand1
,
self
.
operand2
])
if
not
entry
:
self
.
type_error
()
...
...
@@ -12279,8 +12279,9 @@ class ModNode(DivNode):
op1
=
self
.
operand1
.
result
()
if
self
.
operand1
.
type
.
is_cyp_class
:
op1
=
"(*%s)"
%
op1
return
"(%s %
%
%s)"
%
(
return
"(%s %
s
%s)"
%
(
op1
,
self
.
operator
,
self
.
operand2
.
result
())
else
:
return
"__Pyx_mod_%s(%s, %s)"
%
(
...
...
Cython/Compiler/Nodes.py
View file @
0331ccc1
...
...
@@ -6334,6 +6334,8 @@ class InPlaceAssignmentNode(AssignmentNode):
elif
self
.
lhs
.
type
.
is_string
and
self
.
operator
in
'+-'
:
# use pointer arithmetic for char* LHS instead of string concat
self
.
rhs
=
self
.
rhs
.
coerce_to
(
PyrexTypes
.
c_py_ssize_t_type
,
env
)
elif
self
.
lhs
.
type
.
is_cpp_class
:
return
ExprStatNode
(
self
.
pos
,
expr
=
self
.
create_binop_node
().
analyse_types
(
env
))
return
self
def
generate_execution_code
(
self
,
code
):
...
...
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