Fix incorrect package replacement: should check that current occurrence is not a part of identifier
This commit is contained in:
committed by
Pavel Punegov
parent
91868e7200
commit
5579449cdc
@@ -444,11 +444,10 @@ class RunExternalTestGroup extends OldKonanTest {
|
|||||||
if (line.contains("$pkg.") && ! (line =~ packagePattern || line =~ importRegex)
|
if (line.contains("$pkg.") && ! (line =~ packagePattern || line =~ importRegex)
|
||||||
&& ! vars.contains(pkg)) {
|
&& ! vars.contains(pkg)) {
|
||||||
def idx = 0
|
def idx = 0
|
||||||
while ((idx = line.indexOf(pkg, idx)) >= 0) {
|
while ((idx = line.indexOf(pkg, idx)) >= 0 &&
|
||||||
if (!Character.isJavaIdentifierPart(line.charAt(idx - 1))) {
|
!Character.isJavaIdentifierPart(line.charAt(idx - 1))) {
|
||||||
line = line.substring(0, idx) + "$sourceName.$pkg" + line.substring(idx + pkg.length())
|
line = line.substring(0, idx) + "$sourceName.$pkg" + line.substring(idx + pkg.length())
|
||||||
idx += sourceName.length() + pkg.length() + 1
|
idx += sourceName.length() + pkg.length() + 1
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user