mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
Merge pull request #10495 from igfoo/igfoo/traplocker
Kotlin: Tidy up TrapLocker
This commit is contained in:
@@ -266,10 +266,7 @@ public class OdasaOutput {
|
||||
* Any unique suffix needed to distinguish `sym` from other declarations with the same name.
|
||||
* For functions for example, this means its parameter signature.
|
||||
*/
|
||||
private TrapFileManager getMembersWriterForDecl(IrDeclaration sym, String signature) {
|
||||
File trap = getTrapFileForDecl(sym, signature);
|
||||
if (trap==null)
|
||||
return null;
|
||||
private TrapFileManager getMembersWriterForDecl(File trap, IrDeclaration sym, String signature) {
|
||||
TrapClassVersion currVersion = TrapClassVersion.fromSymbol(sym, log);
|
||||
String shortName = sym instanceof IrDeclarationWithName ? ((IrDeclarationWithName)sym).getName().asString() : "(name unknown)";
|
||||
if (trap.exists()) {
|
||||
@@ -424,33 +421,30 @@ public class OdasaOutput {
|
||||
private final IrDeclaration sym;
|
||||
private final File trapFile;
|
||||
private final String signature;
|
||||
private final boolean isNonSourceTrapFile;
|
||||
private TrapLocker(IrDeclaration decl, String signature) {
|
||||
this.sym = decl;
|
||||
this.signature = signature;
|
||||
if (sym==null) {
|
||||
trapFile = getTrapFileForCurrentSourceFile();
|
||||
log.error("Null symbol passed for Kotlin TRAP locker");
|
||||
trapFile = null;
|
||||
} else {
|
||||
trapFile = getTrapFileForDecl(sym, signature);
|
||||
}
|
||||
isNonSourceTrapFile = false;
|
||||
}
|
||||
private TrapLocker(File jarFile) {
|
||||
sym = null;
|
||||
signature = null;
|
||||
trapFile = getTrapFileForJarFile(jarFile);
|
||||
isNonSourceTrapFile = true;
|
||||
}
|
||||
private TrapLocker(String moduleName) {
|
||||
sym = null;
|
||||
signature = null;
|
||||
trapFile = getTrapFileForModule(moduleName);
|
||||
isNonSourceTrapFile = true;
|
||||
}
|
||||
public TrapFileManager getTrapFileManager() {
|
||||
if (trapFile!=null) {
|
||||
lockTrapFile(trapFile);
|
||||
return getMembersWriterForDecl(sym, signature);
|
||||
return getMembersWriterForDecl(trapFile, sym, signature);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user