1439 }
1440
1441 // Resolve all breaks.
1442 code.resolve(exitChain);
1443
1444 code.endScopes(limit);
1445 }
1446
1447 /** Generate code for a catch clause.
1448 * @param tree The catch clause.
1449 * @param env The environment current in the enclosing try.
1450 * @param startpc Start pc of try-block.
1451 * @param endpc End pc of try-block.
1452 */
1453 void genCatch(JCCatch tree,
1454 Env<GenContext> env,
1455 int startpc, int endpc,
1456 List<Integer> gaps) {
1457 if (startpc != endpc) {
1458 List<JCExpression> subClauses = TreeInfo.isMultiCatch(tree) ?
1459 ((JCTypeDisjunction)tree.param.vartype).alternatives :
1460 List.of(tree.param.vartype);
1461 while (gaps.nonEmpty()) {
1462 for (JCExpression subCatch : subClauses) {
1463 int catchType = makeRef(tree.pos(), subCatch.type);
1464 int end = gaps.head.intValue();
1465 registerCatch(tree.pos(),
1466 startpc, end, code.curPc(),
1467 catchType);
1468 }
1469 gaps = gaps.tail;
1470 startpc = gaps.head.intValue();
1471 gaps = gaps.tail;
1472 }
1473 if (startpc < endpc) {
1474 for (JCExpression subCatch : subClauses) {
1475 int catchType = makeRef(tree.pos(), subCatch.type);
1476 registerCatch(tree.pos(),
1477 startpc, endpc, code.curPc(),
1478 catchType);
1479 }
|
1439 }
1440
1441 // Resolve all breaks.
1442 code.resolve(exitChain);
1443
1444 code.endScopes(limit);
1445 }
1446
1447 /** Generate code for a catch clause.
1448 * @param tree The catch clause.
1449 * @param env The environment current in the enclosing try.
1450 * @param startpc Start pc of try-block.
1451 * @param endpc End pc of try-block.
1452 */
1453 void genCatch(JCCatch tree,
1454 Env<GenContext> env,
1455 int startpc, int endpc,
1456 List<Integer> gaps) {
1457 if (startpc != endpc) {
1458 List<JCExpression> subClauses = TreeInfo.isMultiCatch(tree) ?
1459 ((JCTypeUnion)tree.param.vartype).alternatives :
1460 List.of(tree.param.vartype);
1461 while (gaps.nonEmpty()) {
1462 for (JCExpression subCatch : subClauses) {
1463 int catchType = makeRef(tree.pos(), subCatch.type);
1464 int end = gaps.head.intValue();
1465 registerCatch(tree.pos(),
1466 startpc, end, code.curPc(),
1467 catchType);
1468 }
1469 gaps = gaps.tail;
1470 startpc = gaps.head.intValue();
1471 gaps = gaps.tail;
1472 }
1473 if (startpc < endpc) {
1474 for (JCExpression subCatch : subClauses) {
1475 int catchType = makeRef(tree.pos(), subCatch.type);
1476 registerCatch(tree.pos(),
1477 startpc, endpc, code.curPc(),
1478 catchType);
1479 }
|