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

Side by Side Diff: pkg/observe/lib/transform.dart

Issue 51483002: fix PathObserver to avoid try+catch (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « pkg/observe/lib/src/to_observable.dart ('k') | pkg/observe/pubspec.yaml » ('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) 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 /** 5 /**
6 * Code transform for @observable. The core transformation is relatively 6 * Code transform for @observable. The core transformation is relatively
7 * straightforward, and essentially like an editor refactoring. 7 * straightforward, and essentially like an editor refactoring.
8 */ 8 */
9 library observe.transform; 9 library observe.transform;
10 10
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 var pos = cls.extendsClause.end; 249 var pos = cls.extendsClause.end;
250 code.edit(pos, pos, ' with ChangeNotifier '); 250 code.edit(pos, pos, ' with ChangeNotifier ');
251 } else { 251 } else {
252 var params = cls.typeParameters; 252 var params = cls.typeParameters;
253 var pos = params != null ? params.end : cls.name.end; 253 var pos = params != null ? params.end : cls.name.end;
254 code.edit(pos, pos, ' extends ChangeNotifier '); 254 code.edit(pos, pos, ' extends ChangeNotifier ');
255 } 255 }
256 } 256 }
257 257
258 SimpleIdentifier _getSimpleIdentifier(Identifier id) => 258 SimpleIdentifier _getSimpleIdentifier(Identifier id) =>
259 id is PrefixedIdentifier ? (id as PrefixedIdentifier).identifier : id; 259 id is PrefixedIdentifier ? id.identifier : id;
260 260
261 261
262 bool _hasKeyword(Token token, Keyword keyword) => 262 bool _hasKeyword(Token token, Keyword keyword) =>
263 token is KeywordToken && (token as KeywordToken).keyword == keyword; 263 token is KeywordToken && token.keyword == keyword;
264 264
265 String _getOriginalCode(TextEditTransaction code, ASTNode node) => 265 String _getOriginalCode(TextEditTransaction code, ASTNode node) =>
266 code.original.substring(node.offset, node.end); 266 code.original.substring(node.offset, node.end);
267 267
268 void _fixConstructor(ConstructorDeclaration ctor, TextEditTransaction code, 268 void _fixConstructor(ConstructorDeclaration ctor, TextEditTransaction code,
269 Set<String> changedFields) { 269 Set<String> changedFields) {
270 270
271 // Fix normal initializers 271 // Fix normal initializers
272 for (var initializer in ctor.initializers) { 272 for (var initializer in ctor.initializers) {
273 if (initializer is ConstructorFieldInitializer) { 273 if (initializer is ConstructorFieldInitializer) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 406
407 Token _findFieldSeperator(Token token) { 407 Token _findFieldSeperator(Token token) {
408 while (token != null) { 408 while (token != null) {
409 if (token.type == TokenType.COMMA || token.type == TokenType.SEMICOLON) { 409 if (token.type == TokenType.COMMA || token.type == TokenType.SEMICOLON) {
410 break; 410 break;
411 } 411 }
412 token = token.next; 412 token = token.next;
413 } 413 }
414 return token; 414 return token;
415 } 415 }
OLDNEW
« no previous file with comments | « pkg/observe/lib/src/to_observable.dart ('k') | pkg/observe/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698