aboutsummaryrefslogtreecommitdiff
path: root/src/jdk/nashorn/internal/ir/CatchNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jdk/nashorn/internal/ir/CatchNode.java')
-rw-r--r--src/jdk/nashorn/internal/ir/CatchNode.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/jdk/nashorn/internal/ir/CatchNode.java b/src/jdk/nashorn/internal/ir/CatchNode.java
index ba640a52..80ca3a50 100644
--- a/src/jdk/nashorn/internal/ir/CatchNode.java
+++ b/src/jdk/nashorn/internal/ir/CatchNode.java
@@ -33,6 +33,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
*/
@Immutable
public final class CatchNode extends Statement {
+ private static final long serialVersionUID = 1L;
+
/** Exception identifier. */
private final IdentNode exception;
@@ -42,10 +44,7 @@ public final class CatchNode extends Statement {
/** Catch body. */
private final Block body;
- private final int flags;
-
- /** Is this block a synthethic rethrow created by finally inlining? */
- public static final int IS_SYNTHETIC_RETHROW = 1;
+ private final boolean isSyntheticRethrow;
/**
* Constructors
@@ -56,22 +55,24 @@ public final class CatchNode extends Statement {
* @param exception variable name of exception
* @param exceptionCondition exception condition
* @param body catch body
- * @param flags flags
+ * @param isSyntheticRethrow true if this node is a synthetically generated rethrow node.
*/
- public CatchNode(final int lineNumber, final long token, final int finish, final IdentNode exception, final Expression exceptionCondition, final Block body, final int flags) {
+ public CatchNode(final int lineNumber, final long token, final int finish, final IdentNode exception,
+ final Expression exceptionCondition, final Block body, final boolean isSyntheticRethrow) {
super(lineNumber, token, finish);
- this.exception = exception;
+ this.exception = exception == null ? null : exception.setIsInitializedHere();
this.exceptionCondition = exceptionCondition;
this.body = body;
- this.flags = flags;
+ this.isSyntheticRethrow = isSyntheticRethrow;
}
- private CatchNode(final CatchNode catchNode, final IdentNode exception, final Expression exceptionCondition, final Block body, final int flags) {
+ private CatchNode(final CatchNode catchNode, final IdentNode exception, final Expression exceptionCondition,
+ final Block body, final boolean isSyntheticRethrow) {
super(catchNode);
this.exception = exception;
this.exceptionCondition = exceptionCondition;
this.body = body;
- this.flags = flags;
+ this.isSyntheticRethrow = isSyntheticRethrow;
}
/**
@@ -96,13 +97,13 @@ public final class CatchNode extends Statement {
}
@Override
- public void toString(final StringBuilder sb) {
+ public void toString(final StringBuilder sb, final boolean printTypes) {
sb.append(" catch (");
- exception.toString(sb);
+ exception.toString(sb, printTypes);
if (exceptionCondition != null) {
sb.append(" if ");
- exceptionCondition.toString(sb);
+ exceptionCondition.toString(sb, printTypes);
}
sb.append(')');
}
@@ -132,7 +133,7 @@ public final class CatchNode extends Statement {
if (this.exceptionCondition == exceptionCondition) {
return this;
}
- return new CatchNode(this, exception, exceptionCondition, body, flags);
+ return new CatchNode(this, exception, exceptionCondition, body, isSyntheticRethrow);
}
/**
@@ -152,14 +153,14 @@ public final class CatchNode extends Statement {
if (this.exception == exception) {
return this;
}
- return new CatchNode(this, exception, exceptionCondition, body, flags);
+ return new CatchNode(this, exception, exceptionCondition, body, isSyntheticRethrow);
}
private CatchNode setBody(final Block body) {
if (this.body == body) {
return this;
}
- return new CatchNode(this, exception, exceptionCondition, body, flags);
+ return new CatchNode(this, exception, exceptionCondition, body, isSyntheticRethrow);
}
/**
@@ -170,7 +171,6 @@ public final class CatchNode extends Statement {
* @return true if a finally synthetic rethrow
*/
public boolean isSyntheticRethrow() {
- return (flags & IS_SYNTHETIC_RETHROW) == IS_SYNTHETIC_RETHROW;
+ return isSyntheticRethrow;
}
-
}