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

Side by Side Diff: test/generated_sdk/lib/core/expando.dart

Issue 955513007: merge class extensions from patch files (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An [Expando] allows adding new properties to objects. 8 * An [Expando] allows adding new properties to objects.
9 * 9 *
10 * Does not work on numbers, strings, booleans or null. 10 * Does not work on numbers, strings, booleans or null.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 */ 64 */
65 void operator[]=(Object object, T value) { 65 void operator[]=(Object object, T value) {
66 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME); 66 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME);
67 if (values == null) { 67 if (values == null) {
68 values = new Object(); 68 values = new Object();
69 Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, values); 69 Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, values);
70 } 70 }
71 Primitives.setProperty(values, _getKey(), value); 71 Primitives.setProperty(values, _getKey(), value);
72 } 72 }
73 73
74 String _getKey() {
75 String key = Primitives.getProperty(this, _KEY_PROPERTY_NAME);
76 if (key == null) {
77 key = "expando\$key\$${_keyCount++}";
78 Primitives.setProperty(this, _KEY_PROPERTY_NAME, key);
79 }
80 return key;
81 }
82
83 static const String _KEY_PROPERTY_NAME = 'expando\$key';
84
85 static const String _EXPANDO_PROPERTY_NAME = 'expando\$values';
86
87 static int _keyCount = 0;
88
74 } 89 }
OLDNEW
« no previous file with comments | « test/generated_sdk/lib/collection/linked_hash_map.dart ('k') | test/generated_sdk/lib/core/function.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698