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

Side by Side Diff: dart/sdk/lib/_collection_dev/symbol.dart

Issue 14173005: Update dart:mirrors to use Symbol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix various issues discovered during own review. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 part of dart._collection.dev;
6
7 /**
8 * Implementation of [core.Symbol]. This class uses the same name as
9 * a core class so a user can't tell the difference.
10 *
11 * The purpose of this class is to hide [_name] from user code, but
12 * make it accessible to Dart platform code via the static method
13 * [getName].
14 */
15 class Symbol implements core.Symbol {
16 final String _name;
17
18 external const Symbol(String name);
19
20 /**
21 * Platform-private method used by the mirror system to create
22 * otherwise invalid names.
23 */
24 const Symbol.unvalidated(this._name);
25
26 bool operator ==(other) => other is Symbol && _name == other._name;
27
28 int get hashCode {
29 const arbitraryPrime = 664597;
30 return 0x1fffffff & (arbitraryPrime * _name.hashCode);
31 }
32
33 /// Platform-private accessor which cannot be called from user libraries.
34 static String getName(Symbol symbol) => symbol._name;
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698