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

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

Issue 156763002: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 /** 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.transformer; 9 library observe.transformer;
10 10
11 import 'dart:async'; 11 import 'dart:async';
12 12
13 import 'package:analyzer/src/generated/java_core.dart' show CharSequence;
14 import 'package:analyzer/src/generated/ast.dart'; 13 import 'package:analyzer/src/generated/ast.dart';
15 import 'package:analyzer/src/generated/error.dart'; 14 import 'package:analyzer/src/generated/error.dart';
16 import 'package:analyzer/src/generated/parser.dart'; 15 import 'package:analyzer/src/generated/parser.dart';
17 import 'package:analyzer/src/generated/scanner.dart'; 16 import 'package:analyzer/src/generated/scanner.dart';
18 import 'package:barback/barback.dart'; 17 import 'package:barback/barback.dart';
19 import 'package:source_maps/refactor.dart'; 18 import 'package:source_maps/refactor.dart';
20 import 'package:source_maps/span.dart' show SourceFile; 19 import 'package:source_maps/span.dart' show SourceFile;
21 20
22 /** 21 /**
23 * A [Transformer] that replaces observables based on dirty-checking with an 22 * A [Transformer] that replaces observables based on dirty-checking with an
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 span: _getSpan(sourceFile, declaration)); 108 span: _getSpan(sourceFile, declaration));
110 } 109 }
111 } 110 }
112 } 111 }
113 return code; 112 return code;
114 } 113 }
115 114
116 /** Parse [code] using analyzer. */ 115 /** Parse [code] using analyzer. */
117 CompilationUnit _parseCompilationUnit(String code) { 116 CompilationUnit _parseCompilationUnit(String code) {
118 var errorListener = new _ErrorCollector(); 117 var errorListener = new _ErrorCollector();
119 var reader = new CharSequenceReader(new CharSequence(code)); 118 var reader = new CharSequenceReader(code);
blois 2014/02/13 01:08:41 Note that the pubspec.yaml for observe is still <0
Siggi Cherem (dart-lang) 2014/02/13 01:25:22 Good catch Pete. Yeah, this should bump up the ver
120 var scanner = new Scanner(null, reader, errorListener); 119 var scanner = new Scanner(null, reader, errorListener);
121 var token = scanner.tokenize(); 120 var token = scanner.tokenize();
122 var parser = new Parser(null, errorListener); 121 var parser = new Parser(null, errorListener);
123 return parser.parseCompilationUnit(token); 122 return parser.parseCompilationUnit(token);
124 } 123 }
125 124
126 class _ErrorCollector extends AnalysisErrorListener { 125 class _ErrorCollector extends AnalysisErrorListener {
127 final errors = <AnalysisError>[]; 126 final errors = <AnalysisError>[];
128 onError(error) => errors.add(error); 127 onError(error) => errors.add(error);
129 } 128 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 430
432 Token _findFieldSeperator(Token token) { 431 Token _findFieldSeperator(Token token) {
433 while (token != null) { 432 while (token != null) {
434 if (token.type == TokenType.COMMA || token.type == TokenType.SEMICOLON) { 433 if (token.type == TokenType.COMMA || token.type == TokenType.SEMICOLON) {
435 break; 434 break;
436 } 435 }
437 token = token.next; 436 token = token.next;
438 } 437 }
439 return token; 438 return token;
440 } 439 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/services/test_utils.dart ('k') | pkg/polymer/lib/src/build/code_extractor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698