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

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

Issue 1971193002: Patches to support Dart VM patch files in dart2js. (Closed) Base URL: sso://user/ahe/dart-sdk@master
Patch Set: Created 4 years, 6 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 | « sdk/lib/internal/internal.dart ('k') | sdk/lib/io/file_system_entity.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) 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 Symbol.validated(String name) 110 Symbol.validated(String name)
111 : this._name = validatePublicSymbol(name); 111 : this._name = validatePublicSymbol(name);
112 112
113 bool operator ==(other) => other is Symbol && _name == other._name; 113 bool operator ==(other) => other is Symbol && _name == other._name;
114 114
115 int get hashCode { 115 int get hashCode {
116 const arbitraryPrime = 664597; 116 const arbitraryPrime = 664597;
117 return 0x1fffffff & (arbitraryPrime * _name.hashCode); 117 return 0x1fffffff & (arbitraryPrime * _name.hashCode);
118 } 118 }
119 119
120 toString() => 'Symbol("$_name")'; 120 external String toString();
121 121
122 /// Platform-private accessor which cannot be called from user libraries. 122 /// Platform-private accessor which cannot be called from user libraries.
123 static String getName(Symbol symbol) => symbol._name; 123 static String getName(Symbol symbol) => symbol._name;
124 124
125 static String validatePublicSymbol(String name) { 125 static String validatePublicSymbol(String name) {
126 if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name; 126 if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name;
127 if (name.startsWith('_')) { 127 if (name.startsWith('_')) {
128 // There may be other private parts in a qualified name than the first 128 // There may be other private parts in a qualified name than the first
129 // one, but this is a common case that deserves a specific error 129 // one, but this is a common case that deserves a specific error
130 // message. 130 // message.
131 throw new ArgumentError('"$name" is a private identifier'); 131 throw new ArgumentError('"$name" is a private identifier');
132 } 132 }
133 throw new ArgumentError( 133 throw new ArgumentError(
134 '"$name" is not a valid (qualified) symbol name'); 134 '"$name" is not a valid (qualified) symbol name');
135 } 135 }
136 136
137 /** 137 /**
138 * Checks whether name is a valid symbol name. 138 * Checks whether name is a valid symbol name.
139 * 139 *
140 * This test allows both private and non-private symbols. 140 * This test allows both private and non-private symbols.
141 */ 141 */
142 static bool isValidSymbol(String name) { 142 static bool isValidSymbol(String name) {
143 return (name.isEmpty || symbolPattern.hasMatch(name)); 143 return (name.isEmpty || symbolPattern.hasMatch(name));
144 } 144 }
145
146 external static getUnmangledName(Symbol symbol);
145 } 147 }
OLDNEW
« no previous file with comments | « sdk/lib/internal/internal.dart ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698