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
e8a2a0bd
Commit
e8a2a0bd
authored
Dec 07, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code simplification
parent
57e40836
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+31
-31
No files found.
Cython/Compiler/Optimize.py
View file @
e8a2a0bd
...
@@ -314,41 +314,41 @@ class FlattenInListTransform(Visitor.VisitorTransform, SkipDeclarations):
...
@@ -314,41 +314,41 @@ class FlattenInListTransform(Visitor.VisitorTransform, SkipDeclarations):
else
:
else
:
return
node
return
node
if
isinstance
(
node
.
operand2
,
ExprNodes
.
TupleNode
)
or
isinstance
(
node
.
operand2
,
ExprNodes
.
ListNode
):
if
not
isinstance
(
node
.
operand2
,
(
ExprNodes
.
TupleNode
,
ExprNodes
.
ListNode
)):
args
=
node
.
operand2
.
args
return
node
if
len
(
args
)
==
0
:
return
ExprNodes
.
BoolNode
(
pos
=
node
.
pos
,
value
=
node
.
operator
==
'not_in'
)
if
node
.
operand1
.
is_simple
():
args
=
node
.
operand2
.
args
lhs
=
node
.
operand1
if
len
(
args
)
==
0
:
else
:
return
ExprNodes
.
BoolNode
(
pos
=
node
.
pos
,
value
=
node
.
operator
==
'not_in'
)
# FIXME: allocate temp for evaluated node.operand1
return
node
conds
=
[]
if
True
or
node
.
operand1
.
is_simple
():
for
arg
in
args
:
lhs
=
node
.
operand1
cond
=
ExprNodes
.
PrimaryCmpNode
(
pos
=
node
.
pos
,
operand1
=
lhs
,
operator
=
eq_or_neq
,
operand2
=
arg
,
cascade
=
None
)
conds
.
append
(
ExprNodes
.
TypecastNode
(
pos
=
node
.
pos
,
operand
=
cond
,
type
=
PyrexTypes
.
c_bint_type
))
if
type
(
lhs
)
is
not
ExprNodes
.
CloneNode
:
lhs
=
ExprNodes
.
CloneNode
(
lhs
)
def
concat
(
left
,
right
):
return
ExprNodes
.
BoolBinopNode
(
pos
=
node
.
pos
,
operator
=
conjunction
,
operand1
=
left
,
operand2
=
right
)
return
reduce
(
concat
,
conds
)
else
:
else
:
# FIXME: allocate temp for evaluated node.operand1
return
node
return
node
conds
=
[]
for
arg
in
args
:
cond
=
ExprNodes
.
PrimaryCmpNode
(
pos
=
node
.
pos
,
operand1
=
lhs
,
operator
=
eq_or_neq
,
operand2
=
arg
,
cascade
=
None
)
conds
.
append
(
ExprNodes
.
TypecastNode
(
pos
=
node
.
pos
,
operand
=
cond
,
type
=
PyrexTypes
.
c_bint_type
))
if
type
(
lhs
)
is
not
ExprNodes
.
CloneNode
:
lhs
=
ExprNodes
.
CloneNode
(
lhs
)
def
concat
(
left
,
right
):
return
ExprNodes
.
BoolBinopNode
(
pos
=
node
.
pos
,
operator
=
conjunction
,
operand1
=
left
,
operand2
=
right
)
return
reduce
(
concat
,
conds
)
def
visit_Node
(
self
,
node
):
def
visit_Node
(
self
,
node
):
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
...
...
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