create less trash objects
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,8 +27,11 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine;
|
||||
import org.jetbrains.java.decompiler.struct.match.MatchNode;
|
||||
import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class Exprent implements IMatchable {
|
||||
public static final int MULTIPLE_USES = 1;
|
||||
@@ -72,19 +75,19 @@ public class Exprent implements IMatchable {
|
||||
}
|
||||
|
||||
public CheckTypesResult checkExprTypeBounds() {
|
||||
return new CheckTypesResult();
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean containsExprent(Exprent exprent) {
|
||||
List<Exprent> listTemp = new ArrayList<>(getAllExprents(true));
|
||||
listTemp.add(this);
|
||||
|
||||
for (Exprent lstExpr : listTemp) {
|
||||
if (lstExpr.equals(exprent)) {
|
||||
if (equals(exprent)) {
|
||||
return true;
|
||||
}
|
||||
List<Exprent> lst = getAllExprents();
|
||||
for (int i = lst.size() - 1; i >= 0; i--) {
|
||||
if (lst.get(i).containsExprent(exprent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -155,15 +155,17 @@ public class VarTypeProcessor {
|
||||
|
||||
CheckTypesResult result = exprent.checkExprTypeBounds();
|
||||
|
||||
for (CheckTypesResult.ExprentTypePair entry : result.getLstMaxTypeExprents()) {
|
||||
if (entry.type.typeFamily != CodeConstants.TYPE_FAMILY_OBJECT) {
|
||||
changeExprentType(entry.exprent, entry.type, 1);
|
||||
}
|
||||
}
|
||||
|
||||
boolean res = true;
|
||||
for (CheckTypesResult.ExprentTypePair entry : result.getLstMinTypeExprents()) {
|
||||
res &= changeExprentType(entry.exprent, entry.type, 0);
|
||||
if (result != null) {
|
||||
for (CheckTypesResult.ExprentTypePair entry : result.getLstMaxTypeExprents()) {
|
||||
if (entry.type.typeFamily != CodeConstants.TYPE_FAMILY_OBJECT) {
|
||||
changeExprentType(entry.exprent, entry.type, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (CheckTypesResult.ExprentTypePair entry : result.getLstMinTypeExprents()) {
|
||||
res &= changeExprentType(entry.exprent, entry.type, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user