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

Unified 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: Also use _symbol_dev.Symbol.getName in dart2js 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 side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_collection_dev/symbol.dart
diff --git a/dart/sdk/lib/_collection_dev/symbol.dart b/dart/sdk/lib/_collection_dev/symbol.dart
new file mode 100644
index 0000000000000000000000000000000000000000..1a81f4767fd1c08d18f34cc543d27bb04ea114f1
--- /dev/null
+++ b/dart/sdk/lib/_collection_dev/symbol.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of dart._collection.dev;
+
+/**
+ * Implementation of [core.Symbol]. This class uses the same name as
+ * a core class so a user can't tell the difference.
+ *
+ * The purpose of this class is to hide [_name] from user code, but
+ * make it accessible to Dart platform code via the static method
+ * [getName].
+ */
+class Symbol implements core.Symbol {
+ final String _name;
+
+ external const Symbol(String name);
+
+ /**
+ * Platform-private method used by the mirror system to create
+ * otherwise invalid names.
+ */
+ const Symbol.unvalidated(this._name);
+
+ bool operator ==(other) => other is Symbol && _name == other._name;
+
+ int get hashCode {
+ const arbitraryPrime = 664597;
+ return 0x1fffffff & (arbitraryPrime * _name.hashCode);
+ }
+
+ /// Platform-private accessor which cannot be called from user libraries.
+ static String getName(Symbol symbol) => symbol._name;
+}

Powered by Google App Engine
This is Rietveld 408576698