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
710360fe
Commit
710360fe
authored
Aug 08, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sage compiles.
parent
ccc84a3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+3
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-2
No files found.
Cython/Compiler/Nodes.py
View file @
710360fe
...
...
@@ -771,7 +771,7 @@ class CEnumDefItemNode(StatNode):
else
:
value
=
self
.
name
entry
=
env
.
declare_const
(
self
.
name
,
enum_entry
.
type
,
value
,
self
.
pos
,
cname
=
self
.
cname
)
value
,
self
.
pos
,
cname
=
self
.
cname
,
visibility
=
enum_entry
.
visibility
)
enum_entry
.
enum_values
.
append
(
entry
)
...
...
Cython/Compiler/Optimize.py
View file @
710360fe
...
...
@@ -22,7 +22,7 @@ class SwitchTransform(Visitor.VisitorTransform):
"""
This transformation tries to turn long if statements into C switch statements.
The requirement is that every clause be an (or of) var == value, where the var
is common among all clauses and both var and value are
not Python objec
ts.
is common among all clauses and both var and value are
in
ts.
"""
def
extract_conditions
(
self
,
cond
):
...
...
@@ -66,6 +66,8 @@ class SwitchTransform(Visitor.VisitorTransform):
return
node
elif
common_var
is
not
None
and
not
is_common_value
(
var
,
common_var
):
return
node
elif
not
var
.
type
.
is_int
or
sum
([
not
cond
.
type
.
is_int
for
cond
in
conditions
]):
return
node
else
:
common_var
=
var
cases
.
append
(
Nodes
.
SwitchCaseNode
(
pos
=
if_clause
.
pos
,
...
...
Cython/Compiler/Symtab.py
View file @
710360fe
...
...
@@ -286,14 +286,14 @@ class Scope:
def qualify_name(self, name):
return "
%
s
.
%
s
" % (self.qualified_name, name)
def declare_const(self, name, type, value, pos, cname = None):
def declare_const(self, name, type, value, pos, cname = None
, visibility = 'private'
):
# Add an entry for a named constant.
if not cname:
if self.in_cinclude:
cname = name
else:
cname = self.mangle(Naming.enum_prefix, name)
entry = self.declare(name, cname, type, pos,
'private'
)
entry = self.declare(name, cname, type, pos,
visibility
)
entry.is_const = 1
entry.value = value
return entry
...
...
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