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

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

Issue 11231074: Change signature of noSuchMethod to take an InvocationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more test expectation Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »
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 class Object { 5 patch class Object {
6 6
7 // Helpers used to implement hashCode. If a hashCode is used we remember it 7 // Helpers used to implement hashCode. If a hashCode is used we remember it
8 // using an Expando object. A new hashCode value is calculated using a Random 8 // using an Expando object. A new hashCode value is calculated using a Random
9 // number generator. 9 // number generator.
10 static Expando _hashCodeExp = new Expando("Object.hashCode"); 10 static Expando _hashCodeExp = new Expando("Object.hashCode");
11 static Random _hashCodeRnd = new Random(); 11 static Random _hashCodeRnd = new Random();
12 12
13 /* patch */ int get hashCode { 13 /* patch */ int get hashCode {
14 var result = _hashCodeExp[this]; 14 var result = _hashCodeExp[this];
15 if (result == null) { 15 if (result == null) {
16 result = _hashCodeRnd.nextInt(0x40000000); // Stay in Smi range. 16 result = _hashCodeRnd.nextInt(0x40000000); // Stay in Smi range.
17 _hashCodeExp[this] = result; 17 _hashCodeExp[this] = result;
18 } 18 }
19 return result; 19 return result;
20 } 20 }
21 21
22 /* patch */ String toString() native "Object_toString"; 22 /* patch */ String toString() native "Object_toString";
23 // A statically dispatched version of Object.toString. 23 // A statically dispatched version of Object.toString.
24 static String _toString(obj) native "Object_toString"; 24 static String _toString(obj) native "Object_toString";
25 25
26 /* patch */ Dynamic noSuchMethod(String functionName, List args) 26 dynamic _noSuchMethod(String functionName, List args)
27 native "Object_noSuchMethod"; 27 native "Object_noSuchMethod";
28 28
29 /* patch */ dynamic noSuchMethod(InvocationMirror invocation) {
30 var methodName = invocation.memberName;
31 var args = invocation.positionalArguments;
32 return _noSuchMethod(methodName, args);
33 }
34
29 /* patch */ Type get runtimeType native "Object_runtimeType"; 35 /* patch */ Type get runtimeType native "Object_runtimeType";
30 } 36 }
OLDNEW
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698