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

Side by Side Diff: utils/template/codegen.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 10 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 | « utils/pub/utils.dart ('k') | utils/template/tokenizer.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class CGBlock { 5 class CGBlock {
6 int _blockType; // Code type of this block 6 int _blockType; // Code type of this block
7 int _indent; // Number of spaces to prefix for each statement 7 int _indent; // Number of spaces to prefix for each statement
8 bool _inEach; // This block or any currently active blocks is a 8 bool _inEach; // This block or any currently active blocks is a
9 // #each. If so then any element marked with a 9 // #each. If so then any element marked with a
10 // var attribute is repeated therefore the var 10 // var attribute is repeated therefore the var
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 Iterable<Match> matches = identRe.allMatches(expr); 750 Iterable<Match> matches = identRe.allMatches(expr);
751 751
752 int lastIdx = 0; 752 int lastIdx = 0;
753 for (Match m in matches) { 753 for (Match m in matches) {
754 if (m.start > lastIdx) { 754 if (m.start > lastIdx) {
755 newExpr.add(expr.substring(lastIdx, m.start)); 755 newExpr.add(expr.substring(lastIdx, m.start));
756 } 756 }
757 757
758 bool identifier = true; 758 bool identifier = true;
759 if (m.start > 0) { 759 if (m.start > 0) {
760 int charCode = expr.charCodeAt(m.start - 1); 760 int charCode = expr.codeUnitAt(m.start - 1);
761 // Starts with ' or " then it's not an identifier. 761 // Starts with ' or " then it's not an identifier.
762 identifier = charCode != 34 /* " */ && charCode != 39 /* ' */; 762 identifier = charCode != 34 /* " */ && charCode != 39 /* ' */;
763 } 763 }
764 764
765 String strMatch = expr.substring(m.start, m.end); 765 String strMatch = expr.substring(m.start, m.end);
766 if (identifier) { 766 if (identifier) {
767 newExpr.add("${prefixPart}.${strMatch}"); 767 newExpr.add("${prefixPart}.${strMatch}");
768 } else { 768 } else {
769 // Quoted string don't touch. 769 // Quoted string don't touch.
770 newExpr.add("${strMatch}"); 770 newExpr.add("${strMatch}");
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 for (String name in names) { 1004 for (String name in names) {
1005 buff.add(" var ${name} = _scopes[\"${name}\"];\n"); 1005 buff.add(" var ${name} = _scopes[\"${name}\"];\n");
1006 } 1006 }
1007 buff.add("\n"); 1007 buff.add("\n");
1008 } 1008 }
1009 1009
1010 return buff.toString(); 1010 return buff.toString();
1011 } 1011 }
1012 1012
1013 } 1013 }
OLDNEW
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/template/tokenizer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698