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

Side by Side Diff: pkg/analyzer/test/src/summary/summarize_ast_test.dart

Issue 1859493002: Replace 'length' with more generic 'extractProperty' operation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analyzer.test.src.summary.summarize_ast_test; 5 library analyzer.test.src.summary.summarize_ast_test;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 @override 166 @override
167 bool get checkAstDerivedData => true; 167 bool get checkAstDerivedData => true;
168 168
169 @override 169 @override
170 bool get expectAbsoluteUrisInDependencies => false; 170 bool get expectAbsoluteUrisInDependencies => false;
171 171
172 @override 172 @override
173 bool get skipFullyLinkedData => false; 173 bool get skipFullyLinkedData => false;
174 174
175 @override 175 @override
176 bool get skipNonConstInitializers => false;
177
178 @override
176 addNamedSource(String filePath, String contents) { 179 addNamedSource(String filePath, String contents) {
177 CompilationUnit unit = _parseText(contents); 180 CompilationUnit unit = _parseText(contents);
178 UnlinkedUnit unlinkedUnit = 181 UnlinkedUnit unlinkedUnit =
179 new UnlinkedUnit.fromBuffer(serializeAstUnlinked(unit).toBuffer()); 182 new UnlinkedUnit.fromBuffer(serializeAstUnlinked(unit).toBuffer());
180 uriToUnit[absUri(filePath)] = unlinkedUnit; 183 uriToUnit[absUri(filePath)] = unlinkedUnit;
181 } 184 }
182 185
183 @override 186 @override
184 void serializeLibraryText(String text, {bool allowErrors: false}) { 187 void serializeLibraryText(String text, {bool allowErrors: false}) {
185 Uri testDartUri = Uri.parse(absUri('/test.dart')); 188 Uri testDartUri = Uri.parse(absUri('/test.dart'));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 CompilationUnit _parseText(String text) { 236 CompilationUnit _parseText(String text) {
234 CharSequenceReader reader = new CharSequenceReader(text); 237 CharSequenceReader reader = new CharSequenceReader(text);
235 Scanner scanner = 238 Scanner scanner =
236 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER); 239 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER);
237 Token token = scanner.tokenize(); 240 Token token = scanner.tokenize();
238 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER); 241 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER);
239 parser.parseGenericMethods = true; 242 parser.parseGenericMethods = true;
240 return parser.parseCompilationUnit(token); 243 return parser.parseCompilationUnit(token);
241 } 244 }
242 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698