Commit e9b127b9 authored by Lukáš Marek's avatar Lukáš Marek
Browse files

Added option to not include the snippet exception handler

parent 8da953e4
......@@ -47,6 +47,11 @@ public class DiSL implements Instrumentation {
final String PROP_DYNAMIC_BYPASS = "disl.dynbypass";
final boolean allDynamicBypass = Boolean.getBoolean(PROP_DYNAMIC_BYPASS);
// default is that exception handler is inserted
// this is the reason for double negation in assignment
final String PROP_NO_EXCEPT_HANDLER = "disl.noexcepthandler";
final boolean exceptHandler = ! Boolean.getBoolean(PROP_NO_EXCEPT_HANDLER);
final String PROP_DEBUG = "disl.debug";
final boolean debug = Boolean.getBoolean(PROP_DEBUG);
......@@ -103,7 +108,7 @@ public class DiSL implements Instrumentation {
// initialize snippets
for (Snippet snippet : parsedSnippets) {
snippet.init(parser.getAllLocalVars(), processors,
allDynamicBypass);
exceptHandler, allDynamicBypass);
}
// initialize snippets variable
......
......@@ -77,11 +77,12 @@ public class Snippet implements Comparable<Snippet> {
}
public void init(LocalVars allLVs, Map<Type, Proc> processors,
boolean allDynamicBypass) throws StaticContextGenException,
ReflectionException, ProcessorException {
boolean exceptHandler, boolean allDynamicBypass)
throws StaticContextGenException, ReflectionException,
ProcessorException {
code = unprocessedCode.process(allLVs, processors, marker,
allDynamicBypass);
exceptHandler, allDynamicBypass);
unprocessedCode = null;
}
}
......@@ -51,8 +51,8 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
this.usesProcessorContext = usesProcessorContext;
}
public SnippetCode process(LocalVars allLVs,
Map<Type, Proc> processors, Marker marker, boolean allDynamicBypass)
public SnippetCode process(LocalVars allLVs, Map<Type, Proc> processors,
Marker marker, boolean exceptHandler, boolean allDynamicBypass)
throws StaticContextGenException, ReflectionException,
ProcessorException {
......@@ -74,9 +74,11 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
insertDynamicBypass(instructions);
}
// catch all exceptions
// it is forbidden to throw an exception in a snippet
insertExceptionHandler(instructions, tryCatchBlocks);
if (exceptHandler) {
// catch all exceptions
// it is forbidden to throw an exception in a snippet
insertExceptionHandler(instructions, tryCatchBlocks);
}
// *** CODE ANALYSIS ***
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment