Files
VisualSapfor/src/Common/Passes/All/SPF_InlineProcedures.java

64 lines
2.6 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package Common.Passes.All;
import Common.Global;
import Common.UI.UI;
import Common.Utils.Utils;
import GlobalData.Settings.SettingName;
import ProjectData.SapforData.Functions.FuncCall;
import ProjectData.SapforData.Functions.FuncInfo;
import Common.Passes.PassCode_2021;
import Common.Passes.SapforTransformation;
import java.util.Vector;
public class SPF_InlineProcedures extends SapforTransformation {
@Override
protected PassCode_2021 necessary() {
return PassCode_2021.SPF_GetGraphFunctions;
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (super.canStart(args)) {
Vector<String> Result = new Vector<>();
for (FuncInfo fi : target.allFunctions.values()) {
Vector<FuncCall> selected_children = new Vector<>();
for (String calls_file : fi.own_calls.keySet()) {
for (FuncCall call : fi.own_calls.get(calls_file)) {
if (call.isSelected())
selected_children.add(call);
}
}
if (!selected_children.isEmpty()) {
Result.add(fi.funcName);
Result.add(String.valueOf(selected_children.size()));
for (FuncCall fc : selected_children) {
Result.add(fc.file);
Result.add(String.valueOf(fc.line));
}
}
}
if (Result.isEmpty()) {
Log.Writeln_(
(callsCount > 1) ? "Не отмечено ни одной точки вызова процедур для подстановки" :
"Для точечной подстановки следует отметить\ужные точки вызовов процедур в дереве."
);
return false;
}
Options = Utils.toU(String.join("|", Result));
System.out.println(Utils.Brackets(Options));
Global.changeSetting(SettingName.PARSE_FOR_INLINE, "1");
// Pass_2021.passes.get(PassCode_2021.UpdateSetting).Do(SettingName.PARSE_FOR_INLINE, "1");
SPF_ParseFilesWithOrder.silent = true;
return passes.get(PassCode_2021.SPF_ParseFilesWithOrder).Do(false);
}
return false;
}
@Override
protected void FocusBeforeStart() {
UI.getMainWindow().getProjectWindow().FocusPoints();
}
@Override
protected void performFinish() throws Exception {
SPF_ParseFilesWithOrder.silent = false;
super.performFinish();
}
}