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
ace24117
Commit
ace24117
authored
Jun 14, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make reifying narg&optarg helper use lambdas
parent
c7415220
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+5
-5
No files found.
Cython/Compiler/ModuleNode.py
View file @
ace24117
...
...
@@ -1163,12 +1163,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
target_object_code
=
target_object_type
.
declaration_code
(
target_object_cname
)
target_object_argument_code
=
target_object_type
.
declaration_code
(
target_object_name
)
def
put_
refcount_op_on_narg_optarg
(
op
,
func_type
,
opt_arg_name
,
code
):
def
put_
cypclass_op_on_narg_optarg
(
op_lbda
,
func_type
,
opt_arg_name
,
code
):
opt_arg_count
=
func_type
.
optional_arg_count
narg_count
=
len
(
func_type
.
args
)
-
opt_arg_count
for
narg
in
func_type
.
args
[:
narg_count
]:
if
narg
.
type
.
is_cyp_class
:
code
.
putln
(
"%s(this->%s);"
%
(
op
,
narg
.
cname
))
code
.
putln
(
"%s(this->%s);"
%
(
op
_lbda
(
narg
)
,
narg
.
cname
))
code
.
putln
(
"if (this->%s != NULL) {"
%
opt_arg_name
)
num_if
=
0
...
...
@@ -1180,7 +1180,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
opt_idx
))
code
.
putln
(
"%s(this->%s->%s);"
%
(
op
,
(
op
_lbda
(
optarg
)
,
opt_arg_name
,
func_type
.
opt_arg_cname
(
optarg
.
name
)
))
...
...
@@ -1245,7 +1245,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"this->%s = NULL;"
%
message_opt_arg_attr_name
)
code
.
putln
(
"}"
)
# Acquire a ref on CyObject, as we don't know when the message will be processed
put_
refcount_op_on_narg_optarg
(
"Cy_INCREF"
,
reified_function_entry
.
type
,
message_opt_arg_attr_name
,
code
)
put_
cypclass_op_on_narg_optarg
(
lambda
_
:
"Cy_INCREF"
,
reified_function_entry
.
type
,
message_opt_arg_attr_name
,
code
)
code
.
putln
(
"}"
)
code
.
putln
(
"int activate() {"
)
code
.
putln
(
"/* Activate only if its sync object agrees to do so */"
)
...
...
@@ -1278,7 +1278,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# Destructor
code
.
putln
(
"virtual ~%s() {"
%
class_name
)
put_
refcount_op_on_narg_optarg
(
"Cy_DECREF"
,
reified_function_entry
.
type
,
message_opt_arg_attr_name
,
code
)
put_
cypclass_op_on_narg_optarg
(
lambda
_
:
"Cy_DECREF"
,
reified_function_entry
.
type
,
message_opt_arg_attr_name
,
code
)
if
opt_arg_count
:
code
.
putln
(
"free(this->%s);"
%
message_opt_arg_attr_name
)
code
.
putln
(
"}"
)
...
...
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