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
7e498e65
Commit
7e498e65
authored
Jan 31, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work towards #494, binding directive.
parent
6d66c50b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+12
-5
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+3
-0
No files found.
Cython/Compiler/Nodes.py
View file @
7e498e65
...
@@ -1076,7 +1076,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1076,7 +1076,7 @@ class FuncDefNode(StatNode, BlockNode):
self
.
generate_cached_builtins_decls
(
lenv
,
code
)
self
.
generate_cached_builtins_decls
(
lenv
,
code
)
# ----- Function header
# ----- Function header
code
.
putln
(
""
)
code
.
putln
(
""
)
with_pymethdef
=
env
.
is_py_class_scope
or
env
.
is_closure_scope
with_pymethdef
=
self
.
needs_assignment_synthesis
(
env
,
code
)
if
self
.
py_func
:
if
self
.
py_func
:
self
.
py_func
.
generate_function_header
(
code
,
self
.
py_func
.
generate_function_header
(
code
,
with_pymethdef
=
with_pymethdef
,
with_pymethdef
=
with_pymethdef
,
...
@@ -1635,7 +1635,6 @@ class DefNode(FuncDefNode):
...
@@ -1635,7 +1635,6 @@ class DefNode(FuncDefNode):
# name string the Python name of the function
# name string the Python name of the function
# lambda_name string the internal name of a lambda 'function'
# lambda_name string the internal name of a lambda 'function'
# decorators [DecoratorNode] list of decorators
# decorators [DecoratorNode] list of decorators
# binding bool bind like a Python function
# args [CArgDeclNode] formal arguments
# args [CArgDeclNode] formal arguments
# star_arg PyArgDeclNode or None * argument
# star_arg PyArgDeclNode or None * argument
# starstar_arg PyArgDeclNode or None ** argument
# starstar_arg PyArgDeclNode or None ** argument
...
@@ -1662,7 +1661,6 @@ class DefNode(FuncDefNode):
...
@@ -1662,7 +1661,6 @@ class DefNode(FuncDefNode):
entry
=
None
entry
=
None
acquire_gil
=
0
acquire_gil
=
0
self_in_stararg
=
0
self_in_stararg
=
0
binding
=
False
def
__init__
(
self
,
pos
,
**
kwds
):
def
__init__
(
self
,
pos
,
**
kwds
):
FuncDefNode
.
__init__
(
self
,
pos
,
**
kwds
)
FuncDefNode
.
__init__
(
self
,
pos
,
**
kwds
)
...
@@ -1962,10 +1960,19 @@ class DefNode(FuncDefNode):
...
@@ -1962,10 +1960,19 @@ class DefNode(FuncDefNode):
def
analyse_expressions
(
self
,
env
):
def
analyse_expressions
(
self
,
env
):
self
.
local_scope
.
directives
=
env
.
directives
self
.
local_scope
.
directives
=
env
.
directives
self
.
analyse_default_values
(
env
)
self
.
analyse_default_values
(
env
)
if
env
.
is_py_class_scope
or
env
.
is_closure_scope
:
if
self
.
needs_assignment_synthesis
(
env
)
:
# Shouldn't we be doing this at the module level too?
# Shouldn't we be doing this at the module level too?
self
.
synthesize_assignment_node
(
env
)
self
.
synthesize_assignment_node
(
env
)
def
needs_assignment_synthesis
(
self
,
env
,
code
=
None
):
# Should enable for module level as well, that will require more testing...
if
env
.
is_module_scope
:
if
code
is
None
:
return
env
.
directives
[
'binding'
]
else
:
return
code
.
globalstate
.
directives
[
'binding'
]
return
env
.
is_py_class_scope
or
env
.
is_closure_scope
def
synthesize_assignment_node
(
self
,
env
):
def
synthesize_assignment_node
(
self
,
env
):
import
ExprNodes
import
ExprNodes
if
env
.
is_py_class_scope
:
if
env
.
is_py_class_scope
:
...
@@ -1977,7 +1984,7 @@ class DefNode(FuncDefNode):
...
@@ -1977,7 +1984,7 @@ class DefNode(FuncDefNode):
self
.
pos
,
pymethdef_cname
=
self
.
entry
.
pymethdef_cname
)
self
.
pos
,
pymethdef_cname
=
self
.
entry
.
pymethdef_cname
)
else
:
else
:
rhs
=
ExprNodes
.
PyCFunctionNode
(
rhs
=
ExprNodes
.
PyCFunctionNode
(
self
.
pos
,
pymethdef_cname
=
self
.
entry
.
pymethdef_cname
,
binding
=
self
.
binding
)
self
.
pos
,
pymethdef_cname
=
self
.
entry
.
pymethdef_cname
,
binding
=
env
.
directives
[
'binding'
]
)
self
.
assmt
=
SingleAssignmentNode
(
self
.
pos
,
self
.
assmt
=
SingleAssignmentNode
(
self
.
pos
,
lhs
=
ExprNodes
.
NameNode
(
self
.
pos
,
name
=
self
.
name
),
lhs
=
ExprNodes
.
NameNode
(
self
.
pos
,
name
=
self
.
name
),
rhs
=
rhs
)
rhs
=
rhs
)
...
...
Cython/Compiler/Options.py
View file @
7e498e65
...
@@ -72,6 +72,9 @@ directive_defaults = {
...
@@ -72,6 +72,9 @@ directive_defaults = {
# test support
# test support
'test_assert_path_exists'
:
[],
'test_assert_path_exists'
:
[],
'test_fail_if_path_exists'
:
[],
'test_fail_if_path_exists'
:
[],
# experimental, subject to change
'binding'
:
False
,
}
}
# Override types possibilities above, if needed
# Override types possibilities above, if needed
...
...
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