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
bc831681
Commit
bc831681
authored
Aug 28, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Type 'self' as const inside const cypclass methods
parent
baae5864
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
Cython/Compiler/CypclassTransforms.py
Cython/Compiler/CypclassTransforms.py
+1
-3
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-0
No files found.
Cython/Compiler/CypclassTransforms.py
View file @
bc831681
...
...
@@ -581,10 +581,8 @@ class CypclassLockTransform(Visitor.EnvTransform):
cyp_class_args
=
(
e
for
e
in
node
.
local_scope
.
arg_entries
if
e
.
type
.
is_cyp_class
)
arg_locks
=
[]
for
arg
in
cyp_class_args
:
is_rlocked
=
arg
.
type
.
is_const
or
arg
.
is_self_arg
and
node
.
entry
.
type
.
is_const_method
arg_id
=
arg
# Mark each cypclass arguments as locked within the function body
arg_locks
.
append
(
self
.
stacklock
(
arg
_id
,
"rlocked"
if
is_rlocked
else
"wlocked"
))
arg_locks
.
append
(
self
.
stacklock
(
arg
,
"rlocked"
if
arg
.
type
.
is_const
else
"wlocked"
))
with_body
=
lambda
:
self
.
visit
(
node
.
body
)
self
.
with_nested_stacklocks
(
iter
(
arg_locks
),
with_body
)
return
node
...
...
Cython/Compiler/Nodes.py
View file @
bc831681
...
...
@@ -2711,6 +2711,8 @@ class CFuncDefNode(FuncDefNode):
if
declarator
.
skipped_self
:
_name
,
_type
,
_pos
,
_
=
declarator
.
skipped_self
_cname
=
"this"
if
self
.
is_const_method
:
_type
=
PyrexTypes
.
CConstType
(
_type
)
entry
=
self
.
local_scope
.
declare
(
_name
,
_cname
,
_type
,
_pos
,
'private'
)
entry
.
is_variable
=
1
entry
.
is_self_arg
=
1
...
...
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