Skip to content

Commit

Permalink
Fix log, capitalize constant, simplify lambda, and add a launch config (
Browse files Browse the repository at this point in the history
#181)

Trying to make #176 more readable. Thus, this PR can be merged before
#176, @msridhar. Thanks.

## Changes

- **Fix logs.**
  Module names don't include a file extension.   
- **Add launch configuration.**
  To debug Maven builds remotely.
- **Capitalize constant.**
- **Simplify lambda.**
  • Loading branch information
khatchad authored Apr 16, 2024
1 parent ceb0744 commit fc05485
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
26 changes: 26 additions & 0 deletions ML verify debug.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<intAttribute key="M2_COLORS" value="0"/>
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
<stringAttribute key="M2_GOALS" value="-Dmaven.surefire.debug -Dparallel=none verify"/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value=""/>
<listAttribute key="M2_PROPERTIES">
<listEntry value="forkCount=0"/>
</listAttribute>
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
<intAttribute key="M2_THREADS" value="1"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:ml}"/>
</launchConfiguration>
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,16 @@ public CAstNode visitImportFrom(ImportFrom importFrom) throws Exception {
Optional<String> s =
importFrom.getInternalModuleNames().stream()
.map(Name::getInternalId)
.reduce(
(a, b) -> {
return a + "/" + b;
});
.reduce((a, b) -> a + "/" + b);

if (s.isPresent()) {
String moduleName = s.get();
LOGGER.finer("Module name from " + importFrom + " is: " + moduleName + ".");

if (!isLocalModule(moduleName)) {
LOGGER.finer("Module: " + moduleName + ".py" + " isn't local.");
LOGGER.finer("Module: " + moduleName + " isn't local.");
moduleName = s.get() + "/__init__";
} else LOGGER.finer("Module: " + moduleName + ".py" + " is local.");
} else LOGGER.finer("Module: " + moduleName + " is local.");

LOGGER.finer("Module name from " + importFrom + " is: " + moduleName + ".");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

public class PythonCAstToIRTranslator extends AstTranslator {

private static final Logger logger = Logger.getLogger(PythonCAstToIRTranslator.class.getName());
private static final Logger LOGGER = Logger.getLogger(PythonCAstToIRTranslator.class.getName());

private final Map<CAstType, TypeName> walaTypeNames = HashMapFactory.make();
private final Set<Pair<Scope, String>> globalDeclSet = new HashSet<>();
Expand Down Expand Up @@ -696,7 +696,7 @@ protected void doCall(
((CAstControlFlowRecorder) context.getControlFlow()).map(call, call);

if (context.getControlFlow().getTargetLabels(call).isEmpty()) {
logger.fine(() -> "no exceptions for " + CAstPrinter.print(call));
LOGGER.fine(() -> "no exceptions for " + CAstPrinter.print(call));
context.cfg().addPreEdgeToExit(call, true);
} else {
context
Expand Down

0 comments on commit fc05485

Please sign in to comment.