| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 Script script = currentScript(); | 100 Script script = currentScript(); |
| 101 if (node !== null) { | 101 if (node !== null) { |
| 102 print(spanFromNode(node, script).toMessageString("cancel leg: $reason")); | 102 print(spanFromNode(node, script).toMessageString("cancel leg: $reason")); |
| 103 } else if (token !== null) { | 103 } else if (token !== null) { |
| 104 String tokenString = token.toString(); | 104 String tokenString = token.toString(); |
| 105 int begin = token.charOffset; | 105 int begin = token.charOffset; |
| 106 int end = begin + tokenString.length; | 106 int end = begin + tokenString.length; |
| 107 print(script.file.getLocationMessage("cancel leg: $reason", | 107 print(script.file.getLocationMessage("cancel leg: $reason", |
| 108 begin, end, true)); | 108 begin, end, true)); |
| 109 } else if (element !== null) { | 109 } else if (element !== null) { |
| 110 currentElement = element; | 110 withCurrentElement(element, |
| 111 cancel(reason: reason, token: element.position()); | 111 () => cancel(reason: reason, token: element.position())); |
| 112 } | 112 } |
| 113 if (throwOnError) { | 113 if (throwOnError) { |
| 114 throw new AbortLeg(reason); | 114 throw new AbortLeg(reason); |
| 115 } | 115 } |
| 116 super.cancel(reason, node, token, instruction); | 116 super.cancel(reason, node, token, instruction); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 class AbortLeg { | 120 class AbortLeg { |
| 121 final message; | 121 final message; |
| 122 AbortLeg(this.message); | 122 AbortLeg(this.message); |
| 123 toString() => 'Aborted due to --throw-on-error: $message'; | 123 toString() => 'Aborted due to --throw-on-error: $message'; |
| 124 } | 124 } |
| OLD | NEW |