| 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 // 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' | 8 import 'dart:_js_helper' |
| 9 show | 9 show |
| 10 patch, | 10 patch, |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 List positionalArguments, Map<Symbol, dynamic> namedArguments, | 546 List positionalArguments, Map<Symbol, dynamic> namedArguments, |
| 547 [List existingArgumentNames = null]) | 547 [List existingArgumentNames = null]) |
| 548 : _receiver = receiver, | 548 : _receiver = receiver, |
| 549 _memberName = memberName, | 549 _memberName = memberName, |
| 550 _arguments = positionalArguments, | 550 _arguments = positionalArguments, |
| 551 _namedArguments = namedArguments, | 551 _namedArguments = namedArguments, |
| 552 _existingArgumentNames = existingArgumentNames; | 552 _existingArgumentNames = existingArgumentNames; |
| 553 | 553 |
| 554 @patch | 554 @patch |
| 555 String toString() { | 555 String toString() { |
| 556 StringBuffer sb = new StringBuffer(); | 556 StringBuffer sb = new StringBuffer(''); |
| 557 int i = 0; | 557 String comma = ''; |
| 558 if (_arguments != null) { | 558 if (_arguments != null) { |
| 559 for (; i < _arguments.length; i++) { | 559 for (var argument in _arguments) { |
| 560 if (i > 0) { | 560 sb.write(comma); |
| 561 sb.write(", "); | 561 sb.write(Error.safeToString(argument)); |
| 562 } | 562 comma = ', '; |
| 563 sb.write(Error.safeToString(_arguments[i])); | |
| 564 } | 563 } |
| 565 } | 564 } |
| 566 if (_namedArguments != null) { | 565 if (_namedArguments != null) { |
| 567 _namedArguments.forEach((Symbol key, var value) { | 566 _namedArguments.forEach((Symbol key, var value) { |
| 568 if (i > 0) { | 567 sb.write(comma); |
| 569 sb.write(", "); | |
| 570 } | |
| 571 sb.write(_symbolToString(key)); | 568 sb.write(_symbolToString(key)); |
| 572 sb.write(": "); | 569 sb.write(": "); |
| 573 sb.write(Error.safeToString(value)); | 570 sb.write(Error.safeToString(value)); |
| 574 i++; | 571 comma = ', '; |
| 575 }); | 572 }); |
| 576 } | 573 } |
| 574 String memberName = _symbolToString(_memberName); |
| 575 String receiverText = Error.safeToString(_receiver); |
| 576 String actualParameters = '$sb'; |
| 577 if (_existingArgumentNames == null) { | 577 if (_existingArgumentNames == null) { |
| 578 return "NoSuchMethodError : method not found: '$_memberName'\n" | 578 return "NoSuchMethodError: method not found: '$memberName'\n" |
| 579 "Receiver: ${Error.safeToString(_receiver)}\n" | 579 "Receiver: ${receiverText}\n" |
| 580 "Arguments: [$sb]"; | 580 "Arguments: [$actualParameters]"; |
| 581 } else { | 581 } else { |
| 582 String actualParameters = sb.toString(); | 582 String formalParameters = _existingArgumentNames.join(', '); |
| 583 sb = new StringBuffer(); | |
| 584 for (int i = 0; i < _existingArgumentNames.length; i++) { | |
| 585 if (i > 0) { | |
| 586 sb.write(", "); | |
| 587 } | |
| 588 sb.write(_existingArgumentNames[i]); | |
| 589 } | |
| 590 String formalParameters = sb.toString(); | |
| 591 return "NoSuchMethodError: incorrect number of arguments passed to " | 583 return "NoSuchMethodError: incorrect number of arguments passed to " |
| 592 "method named '$_memberName'\n" | 584 "method named '$memberName'\n" |
| 593 "Receiver: ${Error.safeToString(_receiver)}\n" | 585 "Receiver: ${receiverText}\n" |
| 594 "Tried calling: $_memberName($actualParameters)\n" | 586 "Tried calling: $memberName($actualParameters)\n" |
| 595 "Found: $_memberName($formalParameters)"; | 587 "Found: $memberName($formalParameters)"; |
| 596 } | 588 } |
| 597 } | 589 } |
| 598 } | 590 } |
| 599 | 591 |
| 600 @patch | 592 @patch |
| 601 class Uri { | 593 class Uri { |
| 602 @patch | 594 @patch |
| 603 static Uri get base { | 595 static Uri get base { |
| 604 String uri = Primitives.currentUri(); | 596 String uri = Primitives.currentUri(); |
| 605 if (uri != null) return Uri.parse(uri); | 597 if (uri != null) return Uri.parse(uri); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 static StackTrace get current { | 650 static StackTrace get current { |
| 659 return getTraceFromException(JS('', 'new Error()')); | 651 return getTraceFromException(JS('', 'new Error()')); |
| 660 } | 652 } |
| 661 } | 653 } |
| 662 | 654 |
| 663 @patch | 655 @patch |
| 664 class _ConstantExpressionError { | 656 class _ConstantExpressionError { |
| 665 @patch | 657 @patch |
| 666 _throw(error) => throw error; | 658 _throw(error) => throw error; |
| 667 } | 659 } |
| OLD | NEW |