Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library('frog_leg'); | 5 #library('frog_leg'); |
| 6 | 6 |
| 7 #import('../../lib/uri/uri.dart'); | 7 #import('../../lib/uri/uri.dart'); |
| 8 #import('../lang.dart', prefix: 'frog'); | 8 #import('../lang.dart', prefix: 'frog'); |
| 9 #import('elements/elements.dart'); | 9 #import('elements/elements.dart'); |
| 10 #import('io/io.dart', prefix: 'io'); | 10 #import('io/io.dart', prefix: 'io'); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 } else if (element !== null) { | 110 } else if (element !== null) { |
| 111 if (element.position() === null) { | 111 if (element.position() === null) { |
| 112 // Sometimes, the backend fakes up elements that have no | 112 // Sometimes, the backend fakes up elements that have no |
| 113 // position. So we use the enclosing element instead. It is | 113 // position. So we use the enclosing element instead. It is |
| 114 // not a good error location, but cancel really is "internal | 114 // not a good error location, but cancel really is "internal |
| 115 // error" or "not implemented yet", so the vicinity is good | 115 // error" or "not implemented yet", so the vicinity is good |
| 116 // enough for now. | 116 // enough for now. |
| 117 element = element.enclosingElement; | 117 element = element.enclosingElement; |
| 118 // TODO(ahe): I plan to overhaul this infrastructure anyways. | 118 // TODO(ahe): I plan to overhaul this infrastructure anyways. |
| 119 } | 119 } |
| 120 withCurrentElement(element, | 120 if (element !== null) { |
| 121 () => cancel(reason: reason, token: element.position())); | 121 withCurrentElement(element, |
| 122 () => cancel(reason: reason, token: element.position())); | |
| 123 } | |
| 124 } else if (currentElement !== null) { | |
| 125 cancel(reason, element: currentElement); | |
| 126 return; | |
|
kasperl
2012/02/21 07:23:30
We usually do not return after a cancel.
| |
| 122 } | 127 } |
| 123 if (throwOnError) { | 128 if (throwOnError) { |
| 124 throw new AbortLeg(reason); | 129 throw new AbortLeg(reason); |
| 125 } | 130 } |
| 126 super.cancel(reason, node, token, instruction); | 131 super.cancel(reason, node, token, instruction); |
| 127 } | 132 } |
| 128 } | 133 } |
| 129 | 134 |
| 130 class AbortLeg { | 135 class AbortLeg { |
| 131 final message; | 136 final message; |
| 132 AbortLeg(this.message); | 137 AbortLeg(this.message); |
| 133 toString() => 'Aborted due to --throw-on-error: $message'; | 138 toString() => 'Aborted due to --throw-on-error: $message'; |
| 134 } | 139 } |
| OLD | NEW |