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

Side by Side Diff: pkg/template_binding/lib/src/mustache_tokens.dart

Issue 335943003: merge to trunk all changes from 36817 until 37378 under the packages: polymer, (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library template_binding.src.mustache_tokens; 5 library template_binding.src.mustache_tokens;
6 6
7 import 'package:observe/observe.dart'; 7 import 'package:observe/observe.dart';
8 8
9 // Dart note: this was added to decouple the parse function below from the rest 9 // Dart note: this was added to decouple the parse function below from the rest
10 // of template_binding. This allows using this code in command-line tools as 10 // of template_binding. This allows using this code in command-line tools as
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 tokens.add(s.substring(lastIndex)); // TEXT 109 tokens.add(s.substring(lastIndex)); // TEXT
110 break; 110 break;
111 } 111 }
112 112
113 if (tokens == null) tokens = []; 113 if (tokens == null) tokens = [];
114 tokens.add(s.substring(lastIndex, startIndex)); // TEXT 114 tokens.add(s.substring(lastIndex, startIndex)); // TEXT
115 var pathString = s.substring(startIndex + 2, endIndex).trim(); 115 var pathString = s.substring(startIndex + 2, endIndex).trim();
116 tokens.add(oneTime); // ONETIME? 116 tokens.add(oneTime); // ONETIME?
117 onlyOneTime = onlyOneTime && oneTime; 117 onlyOneTime = onlyOneTime && oneTime;
118 var delegateFn = fnFactory == null ? null : fnFactory(pathString); 118 var delegateFn = fnFactory == null ? null : fnFactory(pathString);
119 // Don't try to parse the expression if there's a prepareBinding function
119 if (delegateFn == null) { 120 if (delegateFn == null) {
120 tokens.add(new PropertyPath(pathString)); // PATH 121 tokens.add(new PropertyPath(pathString)); // PATH
121 } else { 122 } else {
122 tokens.add(null); 123 tokens.add(null);
123 } 124 }
124 tokens.add(delegateFn); // DELEGATE_FN 125 tokens.add(delegateFn); // DELEGATE_FN
125 126
126 lastIndex = endIndex + 2; 127 lastIndex = endIndex + 2;
127 } 128 }
128 129
(...skipping 14 matching lines...) Expand all
143 var newValue = new StringBuffer(getText(0)); 144 var newValue = new StringBuffer(getText(0));
144 int len = this.length; 145 int len = this.length;
145 for (var i = 0; i < len; i++) { 146 for (var i = 0; i < len; i++) {
146 var value = values[i]; 147 var value = values[i];
147 if (value != null) newValue.write(value); 148 if (value != null) newValue.write(value);
148 newValue.write(getText(i + 1)); 149 newValue.write(getText(i + 1));
149 } 150 }
150 return newValue.toString(); 151 return newValue.toString();
151 } 152 }
152 } 153 }
OLDNEW
« no previous file with comments | « pkg/template_binding/lib/src/instance_binding_map.dart ('k') | pkg/template_binding/lib/src/node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698