OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |