Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| index b4fe9d99840e3a82135631e14da6c5cdccae2003..8a9cac5faeaf6d4d6884a19bbbcfbe35c05dbff7 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| @@ -2974,17 +2974,22 @@ class ResolverVisitor extends MappingVisitor<Element> { |
| compiler.backend.registerCatchStatement(world, mapping); |
| // Check that if catch part is present, then |
| // it has one or two formal parameters. |
| + VariableDefinitions exceptionDefinition; |
| + VariableDefinitions stackTraceDefinition; |
| if (node.formals != null) { |
| if (node.formals.isEmpty) { |
| error(node, MessageKind.EMPTY_CATCH_DECLARATION); |
| - } |
| - if (!node.formals.nodes.tail.isEmpty) { |
| - if (!node.formals.nodes.tail.tail.isEmpty) { |
| - for (Node extra in node.formals.nodes.tail.tail) { |
| - error(extra, MessageKind.EXTRA_CATCH_DECLARATION); |
| + } else { |
| + exceptionDefinition = node.formals.nodes.head; |
|
karlklose
2013/05/27 08:45:22
Store node.formals.nodes in a local.
Johnni Winther
2013/05/27 11:01:23
Done.
|
| + if (!node.formals.nodes.tail.isEmpty) { |
| + stackTraceDefinition = node.formals.nodes.tail.head; |
| + if (!node.formals.nodes.tail.tail.isEmpty) { |
|
karlklose
2013/05/27 08:45:22
Also for node.formals.nodes.tail.tail.
Johnni Winther
2013/05/27 11:01:23
Done.
|
| + for (Node extra in node.formals.nodes.tail.tail) { |
| + error(extra, MessageKind.EXTRA_CATCH_DECLARATION); |
| + } |
| } |
| + compiler.backend.registerStackTraceInCatch(mapping); |
| } |
| - compiler.backend.registerStackTraceInCatch(mapping); |
| } |
| // Check that the formals aren't optional and that they have no |
| @@ -3020,6 +3025,20 @@ class ResolverVisitor extends MappingVisitor<Element> { |
| inCatchBlock = true; |
| visitIn(node.block, blockScope); |
| inCatchBlock = oldInCatchBlock; |
| + |
| + if (node.type != null && exceptionDefinition != null) { |
| + DartType exceptionType = mapping.getType(node.type); |
| + Node exceptionVariable = exceptionDefinition.definitions.nodes.head; |
| + VariableElementX exceptionElement = mapping[exceptionVariable]; |
| + exceptionElement.variables.type = exceptionType; |
| + } |
| + if (stackTraceDefinition != null) { |
| + Node stackTraceVariable = stackTraceDefinition.definitions.nodes.head; |
| + VariableElementX stackTraceElement = mapping[stackTraceVariable]; |
| + world.registerInstantiatedClass(compiler.stackTraceClass, mapping); |
| + stackTraceElement.variables.type = |
| + compiler.stackTraceClass.computeType(compiler); |
|
karlklose
2013/05/27 08:45:22
Use rawType instead of computeType. I'd like to ge
Johnni Winther
2013/05/27 11:01:23
Done.
|
| + } |
| } |
| visitTypedef(Typedef node) { |