| Index: lib/compiler/implementation/resolver.dart
|
| diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
|
| index b1c3710b52f9b888f69b25ceccbc9ef1fd3c1fa7..3f982af889d169fbf52283738f7eb36f1010c77a 100644
|
| --- a/lib/compiler/implementation/resolver.dart
|
| +++ b/lib/compiler/implementation/resolver.dart
|
| @@ -1907,34 +1907,38 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
|
| }
|
|
|
| visitCatchBlock(CatchBlock node) {
|
| - // Check that the catch has one or two formal parameters.
|
| - if (node.formals.isEmpty()) {
|
| - error(node, MessageKind.EMPTY_CATCH_DECLARATION);
|
| - } else if (!node.formals.nodes.tail.isEmpty()
|
| - && !node.formals.nodes.tail.tail.isEmpty()) {
|
| - for (Node extra in node.formals.nodes.tail.tail) {
|
| - error(extra, MessageKind.EXTRA_CATCH_DECLARATION);
|
| + // Check that if catch part is present, then
|
| + // it has one or two formal parameters.
|
| + if (node.formals !== null) {
|
| + if (node.formals.isEmpty()) {
|
| + error(node, MessageKind.EMPTY_CATCH_DECLARATION);
|
| + }
|
| + if (!node.formals.nodes.tail.isEmpty() &&
|
| + !node.formals.nodes.tail.tail.isEmpty()) {
|
| + for (Node extra in node.formals.nodes.tail.tail) {
|
| + error(extra, MessageKind.EXTRA_CATCH_DECLARATION);
|
| + }
|
| }
|
| - }
|
|
|
| - // Check that the formals aren't optional and that they have no
|
| - // modifiers or type.
|
| - for (Link<Node> link = node.formals.nodes;
|
| - !link.isEmpty();
|
| - link = link.tail) {
|
| - // If the formal parameter is a node list, it means that it is a
|
| - // sequence of optional parameters.
|
| - NodeList nodeList = link.head.asNodeList();
|
| - if (nodeList !== null) {
|
| - error(nodeList, MessageKind.OPTIONAL_PARAMETER_IN_CATCH);
|
| - } else {
|
| + // Check that the formals aren't optional and that they have no
|
| + // modifiers or type.
|
| + for (Link<Node> link = node.formals.nodes;
|
| + !link.isEmpty();
|
| + link = link.tail) {
|
| + // If the formal parameter is a node list, it means that it is a
|
| + // sequence of optional parameters.
|
| + NodeList nodeList = link.head.asNodeList();
|
| + if (nodeList !== null) {
|
| + error(nodeList, MessageKind.OPTIONAL_PARAMETER_IN_CATCH);
|
| + } else {
|
| VariableDefinitions declaration = link.head;
|
| - for (Node modifier in declaration.modifiers.nodes) {
|
| - error(modifier, MessageKind.PARAMETER_WITH_MODIFIER_IN_CATCH);
|
| - }
|
| - TypeAnnotation type = declaration.type;
|
| - if (type !== null) {
|
| - error(type, MessageKind.PARAMETER_WITH_TYPE_IN_CATCH);
|
| + for (Node modifier in declaration.modifiers.nodes) {
|
| + error(modifier, MessageKind.PARAMETER_WITH_MODIFIER_IN_CATCH);
|
| + }
|
| + TypeAnnotation type = declaration.type;
|
| + if (type !== null) {
|
| + error(type, MessageKind.PARAMETER_WITH_TYPE_IN_CATCH);
|
| + }
|
| }
|
| }
|
| }
|
|
|