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

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

Issue 13963007: Remove redundant type check. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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 patch class Symbol { 5 patch class Symbol {
6 /* patch */ const Symbol(String name) 6 /* patch */ const Symbol(String name)
7 : this._name = _validate(name); 7 : this._name = _validate(name);
8 8
9 static final RegExp _validationPattern = 9 static final RegExp _validationPattern =
10 new RegExp(r'^(?:[a-zA-Z$][a-zA-Z$0-9_]*\.)*(?:[a-zA-Z$][a-zA-Z$0-9_]*=?|' 10 new RegExp(r'^(?:[a-zA-Z$][a-zA-Z$0-9_]*\.)*(?:[a-zA-Z$][a-zA-Z$0-9_]*=?|'
(...skipping 13 matching lines...) Expand all
24 r'>=|' 24 r'>=|'
25 r'>|' 25 r'>|'
26 r'<=|' 26 r'<=|'
27 r'<|' 27 r'<|'
28 r'&|' 28 r'&|'
29 r'\^|' 29 r'\^|'
30 r'\|' 30 r'\|'
31 r')$'); 31 r')$');
32 32
33 static _validate(String name) { 33 static _validate(String name) {
34 if (name is! String) throw new ArgumentError('name must be a String');
35 if (name.isEmpty) return name; 34 if (name.isEmpty) return name;
36 if (name.startsWith('_')) { 35 if (name.startsWith('_')) {
37 throw new ArgumentError('"$name" is a private identifier'); 36 throw new ArgumentError('"$name" is a private identifier');
38 } 37 }
39 if (!_validationPattern.hasMatch(name)) { 38 if (!_validationPattern.hasMatch(name)) {
40 throw new ArgumentError( 39 throw new ArgumentError(
41 '"$name" is not an identifier or an empty String'); 40 '"$name" is not an identifier or an empty String');
42 } 41 }
43 return name; 42 return name;
44 } 43 }
45 } 44 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698