Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tool/input_sdk/patch/core_patch.dart

Issue 2026133002: Throw TypeError instead of CastError for type coercions. (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Patch file for dart:core classes. 5 // Patch file for dart:core classes.
6 import "dart:_internal" as _symbol_dev; 6 import "dart:_internal" as _symbol_dev;
7 import 'dart:_interceptors'; 7 import 'dart:_interceptors';
8 import 'dart:_js_helper' show patch, 8 import 'dart:_js_helper' show patch,
9 checkInt, 9 checkInt,
10 getRuntimeType, 10 getRuntimeType,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 @patch 143 @patch
144 static String _stringToSafeString(String string) { 144 static String _stringToSafeString(String string) {
145 return jsonEncodeNative(string); 145 return jsonEncodeNative(string);
146 } 146 }
147 147
148 @patch 148 @patch
149 StackTrace get stackTrace => Primitives.extractStackTrace(this); 149 StackTrace get stackTrace => Primitives.extractStackTrace(this);
150 } 150 }
151 151
152 /// An interface type for all Strong-mode errors.
153 class StrongModeError extends Error {}
154
152 // Patch for DateTime implementation. 155 // Patch for DateTime implementation.
153 @patch 156 @patch
154 class DateTime { 157 class DateTime {
155 @patch 158 @patch
156 DateTime.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch, 159 DateTime.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch,
157 {bool isUtc: false}) 160 {bool isUtc: false})
158 : this._withValue(millisecondsSinceEpoch, isUtc: isUtc); 161 : this._withValue(millisecondsSinceEpoch, isUtc: isUtc);
159 162
160 @patch 163 @patch
161 DateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch, 164 DateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch,
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 return getTraceFromException(error); 616 return getTraceFromException(error);
614 } 617 }
615 // Fallback if Error.captureStackTrace does not exist. 618 // Fallback if Error.captureStackTrace does not exist.
616 try { 619 try {
617 throw ''; 620 throw '';
618 } catch (_, stackTrace) { 621 } catch (_, stackTrace) {
619 return stackTrace; 622 return stackTrace;
620 } 623 }
621 } 624 }
622 } 625 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698