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

Side by Side Diff: test/dart_codegen/expect/_internal/symbol.dart

Issue 963593002: Disable formatting and add new-lines to make tests faster. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 part of dart._internal; 1 part of dart._internal;
2 2 class Symbol implements core.Symbol {final String _name;
3 class Symbol implements core.Symbol { 3 static const String reservedWordRE = r'(?:assert|break|c(?:a(?:se|tch)|lass|on( ?:st|tinue))|d(?:efault|o)|' r'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fn s]|n(?:ew|ull)|' r'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' r'v(?:ar|oid)|w(?:hile|ith))';
4 final String _name; 4 static const String publicIdentifierRE = r'(?!' '$reservedWordRE' r'\b(?!\$))[a -zA-Z$][\w$]*';
5 static const String reservedWordRE = 5 static const String identifierRE = r'(?!' '$reservedWordRE' r'\b(?!\$))[a-zA-Z$ _][\w$]*';
6 r'(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' r'e (?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' r'ret(?:hrow|ur n)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' r'v(?:ar|oid)|w(?:hile|ith))'; 6 static const String operatorRE = r'(?:[\-+*/%&|^]|\[\]=?|==|~/?|<[<=]?|>[>=]?|u nary-)';
7 static const String publicIdentifierRE = 7 static final RegExp publicSymbolPattern = new RegExp('^(?:$operatorRE\$|$public IdentifierRE(?:=?\$|[.](?!\$)))+?\$');
8 r'(?!' '$reservedWordRE' r'\b(?!\$))[a-zA-Z$][\w$]*'; 8 static final RegExp symbolPattern = new RegExp('^(?:$operatorRE\$|$identifierRE (?:=?\$|[.](?!\$)))+?\$');
9 static const String identifierRE = 9 const Symbol(String name) : this._name = name;
10 r'(?!' '$reservedWordRE' r'\b(?!\$))[a-zA-Z$_][\w$]*'; 10 const Symbol.unvalidated(this._name);
11 static const String operatorRE = 11 Symbol.validated(String name) : this._name = validatePublicSymbol(name);
12 r'(?:[\-+*/%&|^]|\[\]=?|==|~/?|<[<=]?|>[>=]?|unary-)'; 12 bool operator ==(other) => other is Symbol && _name == other._name;
13 static final RegExp publicSymbolPattern = new RegExp( 13 int get hashCode {
14 '^(?:$operatorRE\$|$publicIdentifierRE(?:=?\$|[.](?!\$)))+?\$'); 14 const arbitraryPrime = 664597;
15 static final RegExp symbolPattern = 15 return 0x1fffffff & (arbitraryPrime * _name.hashCode);
16 new RegExp('^(?:$operatorRE\$|$identifierRE(?:=?\$|[.](?!\$)))+?\$');
17 const Symbol(String name) : this._name = name;
18 const Symbol.unvalidated(this._name);
19 Symbol.validated(String name) : this._name = validatePublicSymbol(name);
20 bool operator ==(other) => other is Symbol && _name == other._name;
21 int get hashCode {
22 const arbitraryPrime = 664597;
23 return 0x1fffffff & (arbitraryPrime * _name.hashCode);
24 } 16 }
25 toString() => 'Symbol("$_name")'; 17 toString() => 'Symbol("$_name")';
26 static String getName(Symbol symbol) => symbol._name; 18 static String getName(Symbol symbol) => symbol._name;
27 static String validatePublicSymbol(String name) { 19 static String validatePublicSymbol(String name) {
28 if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name; 20 if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name;
29 if (name.startsWith('_')) { 21 if (name.startsWith('_')) {
30 throw new ArgumentError('"$name" is a private identifier'); 22 throw new ArgumentError('"$name" is a private identifier');
31 } 23 }
32 throw new ArgumentError('"$name" is not a valid (qualified) symbol name'); 24 throw new ArgumentError('"$name" is not a valid (qualified) symbol name');
33 } 25 }
34 static bool isValidSymbol(String name) { 26 static bool isValidSymbol(String name) {
35 return (name.isEmpty || symbolPattern.hasMatch(name)); 27 return (name.isEmpty || symbolPattern.hasMatch(name));
36 } 28 }
37 } 29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698