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
Boxiang Sun
cython
Commits
3a3a60e7
Commit
3a3a60e7
authored
Jul 15, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rhs -> default for clarity
parent
1cae03c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+16
-16
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
No files found.
Cython/Compiler/Nodes.py
View file @
3a3a60e7
...
...
@@ -352,11 +352,11 @@ class CDeclaratorNode(Node):
class
CNameDeclaratorNode
(
CDeclaratorNode
):
# name string The Pyrex name being declared
# cname string or None C name, if specified
#
rhs
ExprNode or None the value assigned on declaration
# name
string The Pyrex name being declared
# cname
string or None C name, if specified
#
default
ExprNode or None the value assigned on declaration
child_attrs
=
[]
child_attrs
=
[
'default'
]
def
analyse
(
self
,
base_type
,
env
,
nonempty
=
0
):
if
nonempty
and
self
.
name
==
''
:
...
...
@@ -368,25 +368,25 @@ class CNameDeclaratorNode(CDeclaratorNode):
def
analyse_expressions
(
self
,
env
):
self
.
entry
=
env
.
lookup
(
self
.
name
)
if
self
.
rhs
is
not
None
:
env
.
control_flow
.
set_state
(
self
.
rhs
.
end_pos
(),
(
self
.
entry
.
name
,
'initalized'
),
True
)
env
.
control_flow
.
set_state
(
self
.
rhs
.
end_pos
(),
(
self
.
entry
.
name
,
'source'
),
'assignment'
)
if
self
.
default
is
not
None
:
env
.
control_flow
.
set_state
(
self
.
default
.
end_pos
(),
(
self
.
entry
.
name
,
'initalized'
),
True
)
env
.
control_flow
.
set_state
(
self
.
default
.
end_pos
(),
(
self
.
entry
.
name
,
'source'
),
'assignment'
)
self
.
entry
.
used
=
1
if
self
.
type
.
is_pyobject
:
self
.
entry
.
init_to_none
=
False
self
.
entry
.
init
=
0
self
.
rhs
.
analyse_types
(
env
)
self
.
rhs
=
self
.
rhs
.
coerce_to
(
self
.
type
,
env
)
self
.
rhs
.
allocate_temps
(
env
)
self
.
rhs
.
release_temp
(
env
)
self
.
default
.
analyse_types
(
env
)
self
.
default
=
self
.
default
.
coerce_to
(
self
.
type
,
env
)
self
.
default
.
allocate_temps
(
env
)
self
.
default
.
release_temp
(
env
)
def
generate_execution_code
(
self
,
code
):
if
self
.
rhs
is
not
None
:
self
.
rhs
.
generate_evaluation_code
(
code
)
if
self
.
default
is
not
None
:
self
.
default
.
generate_evaluation_code
(
code
)
if
self
.
type
.
is_pyobject
:
self
.
rhs
.
make_owned_reference
(
code
)
code
.
putln
(
'%s = %s;'
%
(
self
.
entry
.
cname
,
self
.
rhs
.
result_as
(
self
.
entry
.
type
)))
self
.
rhs
.
generate_post_assignment_code
(
code
)
self
.
default
.
make_owned_reference
(
code
)
code
.
putln
(
'%s = %s;'
%
(
self
.
entry
.
cname
,
self
.
default
.
result_as
(
self
.
entry
.
type
)))
self
.
default
.
generate_post_assignment_code
(
code
)
code
.
putln
()
class
CPtrDeclaratorNode
(
CDeclaratorNode
):
...
...
Cython/Compiler/Parsing.py
View file @
3a3a60e7
...
...
@@ -1786,7 +1786,7 @@ def p_c_simple_declarator(s, ctx, empty, is_type, cmethod_flag,
name
=
""
cname
=
None
result
=
Nodes
.
CNameDeclaratorNode
(
pos
,
name
=
name
,
cname
=
cname
,
rhs
=
rhs
)
name
=
name
,
cname
=
cname
,
default
=
rhs
)
result
.
calling_convention
=
calling_convention
return
result
...
...
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