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

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

Issue 1148283010: Remove dart backend (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 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 | « test/dart_codegen/expect/_internal/sort.dart ('k') | test/dart_codegen/expect/a/a.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 part of dart._internal;
2 class Symbol implements core.Symbol {final String _name;
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 static const String publicIdentifierRE = r'(?!' '$reservedWordRE' r'\b(?!\$))[a -zA-Z$][\w$]*';
5 static const String identifierRE = r'(?!' '$reservedWordRE' r'\b(?!\$))[a-zA-Z$ _][\w$]*';
6 static const String operatorRE = r'(?:[\-+*/%&|^]|\[\]=?|==|~/?|<[<=]?|>[>=]?|u nary-)';
7 static final RegExp publicSymbolPattern = new RegExp('^(?:$operatorRE\$|$public IdentifierRE(?:=?\$|[.](?!\$)))+?\$');
8 static final RegExp symbolPattern = new RegExp('^(?:$operatorRE\$|$identifierRE (?:=?\$|[.](?!\$)))+?\$');
9 external const Symbol(String name);
10 const Symbol.unvalidated(this._name);
11 Symbol.validated(String name) : this._name = validatePublicSymbol(name);
12 bool operator ==(Object other) => other is Symbol && _name == other._name;
13 int get hashCode {
14 const arbitraryPrime = 664597;
15 return 0x1fffffff & (arbitraryPrime * _name.hashCode);
16 }
17 toString() => 'Symbol("$_name")';
18 static String getName(Symbol symbol) => symbol._name;
19 static String validatePublicSymbol(String name) {
20 if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name;
21 if (name.startsWith('_')) {
22 throw new ArgumentError('"$name" is a private identifier');
23 }
24 throw new ArgumentError('"$name" is not a valid (qualified) symbol name');
25 }
26 static bool isValidSymbol(String name) {
27 return (name.isEmpty || symbolPattern.hasMatch(name));
28 }
29 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/_internal/sort.dart ('k') | test/dart_codegen/expect/a/a.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698