Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
peephole
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
peephole
Commits
a4b6b11a
Commit
a4b6b11a
authored
Dec 19, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Source code cleanup.
parent
6af97203
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/utils.py
src/utils.py
+6
-6
No files found.
src/utils.py
View file @
a4b6b11a
...
...
@@ -19,7 +19,7 @@ class Statement:
"""Check if two statements are equal by comparing their type, name and
arguments."""
return
self
.
stype
==
other
.
stype
and
self
.
name
==
other
.
name
\
and
self
.
args
==
other
.
args
and
self
.
args
==
other
.
args
def
__str__
(
self
):
# pragma: nocover
return
'<Statement type=%s name=%s args=%s>'
\
...
...
@@ -39,11 +39,11 @@ class Statement:
def
is_label
(
self
,
name
=
None
):
return
self
.
stype
==
'label'
if
name
==
None
\
else
self
.
stype
==
'label'
and
self
.
name
==
name
else
self
.
stype
==
'label'
and
self
.
name
==
name
def
is_command
(
self
,
name
=
None
):
return
self
.
stype
==
'command'
if
name
==
None
\
else
self
.
stype
==
'command'
and
self
.
name
==
name
else
self
.
stype
==
'command'
and
self
.
name
==
name
def
is_jump
(
self
):
"""Check if the statement is a jump."""
...
...
@@ -66,11 +66,11 @@ class Statement:
def jump_target(self):
"""Get the jump target of this statement."""
if self.is_jump():
return self[-1]
else:
if not self.is_jump():
raise Exception('
Command
"%s"
has
no
jump
target
' % self.name)
return self[-1]
def get_def(self):
"""Get the def[S] of this statement."""
if not self.is_command():
...
...
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