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

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

Issue 1058283006: Update pubspecs and dependencies to get pkgbuild tests working. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
deleted file mode 100644
index 28d09bee75654eba941bd4a4d44b4ebab811408a..0000000000000000000000000000000000000000
--- a/third_party/pkg/angular/lib/core/interpolate.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-part of angular.core;
-
-class Interpolation {
- final String template;
- final List<String> seperators;
- final List<String> expressions;
- Function setter = (_) => _;
-
- Interpolation(this.template, this.seperators, this.expressions);
-
- String call(List parts, [_]) {
- if (parts == null) return seperators.join('');
- var str = [];
- for (var i = 0; i < parts.length; i++) {
- str.add(seperators[i]);
- var value = parts[i];
- str.add(value == null ? '' : '$value');
- }
- str.add(seperators.last);
- return setter(str.join(''));
- }
-}
-
-/**
- * Compiles a string with markup into an interpolation function. This service
- * is used by the HTML [Compiler] service for data binding.
- *
- *
- * var $interpolate = ...; // injected
- * var exp = $interpolate('Hello {{name}}!');
- * expect(exp({name:'Angular'}).toEqual('Hello Angular!');
- */
-@NgInjectableService()
-class Interpolate {
- final Parser _parse;
-
- Interpolate(this._parse);
-
- /**
- * 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
- * have embedded expression in order to return an interpolation function.
- * Strings with no embedded expression will return null for the
- * interpolation function.
- * - `startSymbol`: The symbol to start interpolation. '{{' by default.
- * - `endSymbol`: The symbol to end interpolation. '}}' by default.
- */
- Interpolation call(String template, [bool mustHaveExpression = false,
- String startSymbol = '{{', String endSymbol = '}}']) {
- int startSymbolLength = startSymbol.length;
- int endSymbolLength = endSymbol.length;
- int startIndex;
- int endIndex;
- int index = 0;
- int length = template.length;
- bool hasInterpolation = false;
- bool shouldAddSeparator = true;
- String exp;
- List<String> separators = [];
- List<String> expressions = [];
-
- 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);
- expressions.add(exp);
- 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));
- shouldAddSeparator = false;
- break;
- }
- }
- if (shouldAddSeparator) {
- separators.add('');
- }
- return (!mustHaveExpression || hasInterpolation)
- ? new Interpolation(template, separators, expressions)
- : null;
- }
-}
« 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