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

Side by Side Diff: runtime/lib/errors_patch.dart

Issue 2805903004: Working implementation of #29153 range check in as-casts. (Closed)
Patch Set: Incorporate @rmacnak's feedback: ZoneHandle, position, symbol null. Created 3 years, 8 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
« no previous file with comments | « no previous file | runtime/vm/aot_optimizer.cc » ('j') | runtime/vm/aot_optimizer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5 @patch
6 class Error { 6 class Error {
7 @patch 7 @patch
8 static String _objectToString(Object object) { 8 static String _objectToString(Object object) {
9 return Object._toString(object); 9 return Object._toString(object);
10 } 10 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 return msg_buf.toString(); 389 return msg_buf.toString();
390 } 390 }
391 } 391 }
392 392
393 class _CompileTimeError extends Error { 393 class _CompileTimeError extends Error {
394 final String _errorMsg; 394 final String _errorMsg;
395 _CompileTimeError(this._errorMsg); 395 _CompileTimeError(this._errorMsg);
396 String toString() => _errorMsg; 396 String toString() => _errorMsg;
397 } 397 }
398
399 dynamic _classRangeAssert(int position, dynamic instance, _Type type, int cid,
400 int lowerLimit, int upperLimit) {
401 if ((cid < lowerLimit || cid > upperLimit) && instance != null) {
402 _TypeError._throwNew(position, instance, type, " in type cast", null);
403 }
404
405 return instance;
406 }
407
408 dynamic _classIdEqualsAssert(
409 int position, dynamic instance, _Type type, int cid, int otherCid) {
410 if (cid != otherCid && instance != null) {
411 _TypeError._throwNew(position, instance, type, " in type cast", null);
412 }
413
414 return instance;
415 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/aot_optimizer.cc » ('j') | runtime/vm/aot_optimizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698