| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Static implementation of smoke services using code-generated data. | 5 /// Static implementation of smoke services using code-generated data. |
| 6 library smoke.static; | 6 library smoke.static; |
| 7 | 7 |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:smoke/smoke.dart'; | 10 import 'package:smoke/smoke.dart'; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 var max = maxArgs(method); | 138 var max = maxArgs(method); |
| 139 args = adjustList(args, min, max >= 0 ? max : args.length); | 139 args = adjustList(args, min, max >= 0 ? max : args.length); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 if (namedArgs != null) { | 142 if (namedArgs != null) { |
| 143 throw new UnsupportedError( | 143 throw new UnsupportedError( |
| 144 'smoke.static doesn\'t support namedArguments in invoke'); | 144 'smoke.static doesn\'t support namedArguments in invoke'); |
| 145 } | 145 } |
| 146 try { | 146 try { |
| 147 return Function.apply(method, args); | 147 return Function.apply(method, args); |
| 148 } on NoSuchMethodError catch (e) { | 148 } on NoSuchMethodError catch (_) { |
| 149 // TODO(sigmund): consider whether this should just be in a logger or if | 149 // TODO(sigmund): consider whether this should just be in a logger or if |
| 150 // we should wrap `e` as a new exception (what's the best way to let users | 150 // we should wrap `e` as a new exception (what's the best way to let users |
| 151 // know about this tentativeError?) | 151 // know about this tentativeError?) |
| 152 if (tentativeError != null) print(tentativeError); | 152 if (tentativeError != null) print(tentativeError); |
| 153 rethrow; | 153 rethrow; |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 /// Implements [TypeInspectorService] using a static configuration. | 158 /// Implements [TypeInspectorService] using a static configuration. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 /// Exception thrown when trynig to access something that should be there, but | 284 /// Exception thrown when trynig to access something that should be there, but |
| 285 /// the code generator didn't include it. | 285 /// the code generator didn't include it. |
| 286 class MissingCodeException implements Exception { | 286 class MissingCodeException implements Exception { |
| 287 final String description; | 287 final String description; |
| 288 MissingCodeException(this.description); | 288 MissingCodeException(this.description); |
| 289 | 289 |
| 290 String toString() => 'Missing $description. ' | 290 String toString() => 'Missing $description. ' |
| 291 'Code generation for the smoke package seems incomplete.'; | 291 'Code generation for the smoke package seems incomplete.'; |
| 292 } | 292 } |
| OLD | NEW |