MCPcopy Create free account
hub / github.com/dynjs/dynjs / interpret

Method interpret

src/main/java/org/dynjs/parser/ast/TryStatement.java:55–119  ·  view source on GitHub ↗
(ExecutionContext context)

Source from the content-addressed store, hash-verified

53 }
54
55 @Override
56 public Completion interpret(ExecutionContext context) {
57 Completion b = null;
58 boolean finallyExecuted = false;
59 try {
60 b = invokeCompiledBlockStatement(context, "Try", getTryBlock());
61 } catch (ThrowException e) {
62 if (getCatchClause() != null) {
63 // BasicBlock catchBlock = new InterpretedStatement(statement.getCatchClause().getBlock(), strict);
64 BasicBlock catchBlock = compiledBlockStatement(context, "Catch", getCatchClause().getBlock());
65 try {
66 b = ((ExecutionContext) context).executeCatch(catchBlock, getCatchClause().getIdentifier(), e.getValue());
67 } catch (ThrowException e2) {
68 if (getFinallyBlock() != null) {
69 Completion f = invokeCompiledBlockStatement(context, "Finally", getFinallyBlock());
70 if (f.type == Completion.Type.NORMAL) {
71 if (b != null) {
72 return(b);
73 } else {
74 throw e2;
75 }
76 } else {
77 return(f);
78
79 }
80 } else {
81 throw e2;
82 }
83 }
84 }
85
86 if (getFinallyBlock() != null) {
87 finallyExecuted = true;
88 Completion f = invokeCompiledBlockStatement(context, "Finally", getFinallyBlock());
89 if (f.type == Completion.Type.NORMAL) {
90 if (b != null) {
91 return(b);
92 } else {
93 throw e;
94 }
95 } else {
96 return(f);
97
98 }
99 } else {
100 if (b != null) {
101 return(b);
102 } else {
103 throw e;
104 }
105 }
106 }
107
108 if (!finallyExecuted && getFinallyBlock() != null) {
109 Completion f = invokeCompiledBlockStatement(context, "Finally", getFinallyBlock());
110 if (f.type == Completion.Type.NORMAL) {
111 return(b);
112 } else {

Callers

nothing calls this directly

Calls 9

getTryBlockMethod · 0.95
getCatchClauseMethod · 0.95
getFinallyBlockMethod · 0.95
executeCatchMethod · 0.80
getBlockMethod · 0.45
getIdentifierMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected