Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
11d8b28f
Commit
11d8b28f
authored
May 02, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix variable rename
parent
12b63712
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
MethodGen.java
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
+1
-1
SSAVar.java
...src/main/java/jadx/core/dex/instructions/args/SSAVar.java
+17
-0
TestInline2.java
...src/test/java/jadx/tests/internal/inline/TestInline2.java
+5
-1
No files found.
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
View file @
11d8b28f
...
...
@@ -200,7 +200,7 @@ public class MethodGen {
return
name
;
}
name
=
getUniqVarName
(
name
);
arg
.
getSVar
().
setName
(
name
);
arg
.
getSVar
().
set
Variable
Name
(
name
);
return
name
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/SSAVar.java
View file @
11d8b28f
...
...
@@ -107,6 +107,23 @@ public class SSAVar {
}
}
public
void
setVariableName
(
String
name
)
{
setName
(
name
);
if
(
isUsedInPhi
())
{
PhiInsn
phi
=
getUsedInPhi
();
phi
.
getResult
().
getSVar
().
setVariableName
(
name
);
for
(
InsnArg
arg
:
phi
.
getArguments
())
{
if
(
arg
.
isRegister
())
{
RegisterArg
reg
=
(
RegisterArg
)
arg
;
SSAVar
sVar
=
reg
.
getSVar
();
if
(
sVar
!=
this
&&
!
name
.
equals
(
reg
.
getName
()))
{
sVar
.
setVariableName
(
name
);
}
}
}
}
}
public
void
mergeName
(
RegisterArg
arg
)
{
if
(
arg
.
getName
()
!=
null
)
{
setName
(
arg
.
getName
());
...
...
jadx-core/src/test/java/jadx/tests/internal/inline/TestInline2.java
View file @
11d8b28f
...
...
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertThat;
public
class
TestInline2
extends
InternalJadxTest
{
public
static
class
TestCls
{
public
int
simple_loops
()
throws
InterruptedException
{
public
int
test
()
throws
InterruptedException
{
int
[]
a
=
new
int
[]{
1
,
2
,
4
,
6
,
8
};
int
b
=
0
;
for
(
int
i
=
0
;
i
<
a
.
length
;
i
++)
{
...
...
@@ -28,7 +28,11 @@ public class TestInline2 extends InternalJadxTest {
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
System
.
out
.
println
(
code
);
assertThat
(
code
,
containsString
(
"i < a.length"
));
assertThat
(
code
,
containsString
(
"long i_2 ="
));
assertThat
(
code
,
containsString
(
"+ i_2"
));
assertThat
(
code
,
containsString
(
"i_2--;"
));
}
}
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