Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
peephole
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Taddeüs Kroes
peephole
Commits
a4b6b11a
Commit
a4b6b11a
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Source code cleanup.
parent
6af97203
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils.py
+6
-6
6 additions, 6 deletions
src/utils.py
with
6 additions
and
6 deletions
src/utils.py
+
6
−
6
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
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment