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

Unified Diff: third_party/pkg/angular/lib/core/interpolate.dart

Issue 148453003: Updating Angular version (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pkg/angular/lib/core/filter.dart ('k') | third_party/pkg/angular/lib/core/module.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/angular/lib/core/interpolate.dart
diff --git a/third_party/pkg/angular/lib/core/interpolate.dart b/third_party/pkg/angular/lib/core/interpolate.dart
index 27b43053fb397243ff07c6be9fb92eeee8b1cfb4..1d6e7bd11d3bc2b1defcf8347f2ffeea454bc829 100644
--- a/third_party/pkg/angular/lib/core/interpolate.dart
+++ b/third_party/pkg/angular/lib/core/interpolate.dart
@@ -2,13 +2,13 @@ part of angular.core;
String _startSymbol = '{{';
String _endSymbol = '}}';
-num _startSymbolLength = _startSymbol.length;
-num _endSymbolLength = _endSymbol.length;
+int _startSymbolLength = _startSymbol.length;
+int _endSymbolLength = _endSymbol.length;
class Interpolation {
final String template;
final List<String> seperators;
- final List<ParsedGetter> watchExpressions;
+ final List<Getter> watchExpressions;
Function setter = (_) => _;
Interpolation(this.template, this.seperators, this.watchExpressions);
@@ -41,7 +41,7 @@ class Interpolate {
Interpolate(this._parse);
/**
- * Compile markup text into interpolation function.
+ * Compiles markup text into interpolation function.
*
* - `text`: The markup text to interpolate in form `foo {{expr}} bar`.
* - `mustHaveExpression`: if set to true then the interpolation string must
@@ -55,25 +55,28 @@ class Interpolate {
int index = 0;
int length = template.length;
bool hasInterpolation = false;
+ bool shouldAddSeparator = true;
String exp;
List<String> separators = [];
- List<ParsedGetter> watchExpressions = [];
+ List<Getter> watchExpressions = [];
while(index < length) {
if ( ((startIndex = template.indexOf(_startSymbol, index)) != -1) &&
((endIndex = template.indexOf(_endSymbol, startIndex + _startSymbolLength)) != -1) ) {
separators.add(template.substring(index, startIndex));
exp = template.substring(startIndex + _startSymbolLength, endIndex);
- watchExpressions.add((_parse(exp)..exp = exp).eval);
+ Expression expression = _parse(exp);
+ watchExpressions.add(expression.eval);
index = endIndex + _endSymbolLength;
hasInterpolation = true;
} else {
// we did not find anything, so we have to add the remainder to the chunks array
separators.add(template.substring(index));
- index = length;
+ shouldAddSeparator = false;
+ break;
}
}
- if (separators.length == watchExpressions.length) {
+ if (shouldAddSeparator) {
separators.add('');
}
if (!mustHaveExpression || hasInterpolation) {
« no previous file with comments | « third_party/pkg/angular/lib/core/filter.dart ('k') | third_party/pkg/angular/lib/core/module.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698