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

Side by Side Diff: test/generated_sdk/lib/internal/symbol.dart

Issue 1112403004: SDK fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Formatting fix Created 5 years, 7 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) 2013, the Dart project authors. Please see the AUTHORS file 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 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._internal; 5 part of dart._internal;
6 6
7 /** 7 /**
8 * Implementation of [core.Symbol]. This class uses the same name as 8 * Implementation of [core.Symbol]. This class uses the same name as
9 * a core class so a user can't tell the difference. 9 * a core class so a user can't tell the difference.
10 * 10 *
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 /** 104 /**
105 * Platform-private method used by the mirror system to create 105 * Platform-private method used by the mirror system to create
106 * otherwise invalid names. 106 * otherwise invalid names.
107 */ 107 */
108 const Symbol.unvalidated(this._name); 108 const Symbol.unvalidated(this._name);
109 109
110 // This is called by dart2js. 110 // This is called by dart2js.
111 Symbol.validated(String name) 111 Symbol.validated(String name)
112 : this._name = validatePublicSymbol(name); 112 : this._name = validatePublicSymbol(name);
113 113
114 bool operator ==(other) => other is Symbol && _name == other._name; 114 bool operator ==(Object other) => other is Symbol && _name == other._name;
115 115
116 int get hashCode { 116 int get hashCode {
117 const arbitraryPrime = 664597; 117 const arbitraryPrime = 664597;
118 return 0x1fffffff & (arbitraryPrime * _name.hashCode); 118 return 0x1fffffff & (arbitraryPrime * _name.hashCode);
119 } 119 }
120 120
121 toString() => 'Symbol("$_name")'; 121 toString() => 'Symbol("$_name")';
122 122
123 /// Platform-private accessor which cannot be called from user libraries. 123 /// Platform-private accessor which cannot be called from user libraries.
124 static String getName(Symbol symbol) => symbol._name; 124 static String getName(Symbol symbol) => symbol._name;
(...skipping 12 matching lines...) Expand all
137 137
138 /** 138 /**
139 * Checks whether name is a valid symbol name. 139 * Checks whether name is a valid symbol name.
140 * 140 *
141 * This test allows both private and non-private symbols. 141 * This test allows both private and non-private symbols.
142 */ 142 */
143 static bool isValidSymbol(String name) { 143 static bool isValidSymbol(String name) {
144 return (name.isEmpty || symbolPattern.hasMatch(name)); 144 return (name.isEmpty || symbolPattern.hasMatch(name));
145 } 145 }
146 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698