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

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

Issue 1599393003: Use WeakMap to support Expando if available. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comment Created 4 years, 11 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 | sdk/lib/_internal/js_runtime/lib/core_patch.dart » ('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 Expando<T> { 5 patch class Expando<T> {
6 /* patch */ Expando([String this.name]) 6 /* patch */ Expando([String this.name])
7 : _data = new List(_minSize), 7 : _data = new List(_minSize),
8 _used = 0; 8 _used = 0;
9 9
10 static const _minSize = 8; 10 static const _minSize = 8;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 } 125 }
126 } 126 }
127 } 127 }
128 128
129 static _checkType(object) { 129 static _checkType(object) {
130 if ((object == null) || 130 if ((object == null) ||
131 (object is bool) || 131 (object is bool) ||
132 (object is num) || 132 (object is num) ||
133 (object is String)) { 133 (object is String)) {
134 throw new ArgumentError(object); 134 throw new ArgumentError.value(object,
135 "Expandos are not allowed on strings, numbers, booleans or null");
135 } 136 }
136 } 137 }
137 138
138 get _size => _data.length; 139 get _size => _data.length;
139 get _limit => (3 * (_size ~/ 4)); 140 get _limit => (3 * (_size ~/ 4));
140 141
141 List _data; 142 List _data;
142 int _used; // Number of used (active and deleted) slots. 143 int _used; // Number of used (active and deleted) slots.
143 } 144 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698