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

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

Issue 1839663003: More fixes to summary linking. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Test corner cases involving undefined names 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return linkedLibrary; 80 return linkedLibrary;
81 } 81 }
82 UnlinkedUnit getUnit(String absoluteUri) { 82 UnlinkedUnit getUnit(String absoluteUri) {
83 UnlinkedUnit unit = uriToUnit[absoluteUri] ?? 83 UnlinkedUnit unit = uriToUnit[absoluteUri] ??
84 SerializedMockSdk.instance.uriToUnlinkedUnit[absoluteUri]; 84 SerializedMockSdk.instance.uriToUnlinkedUnit[absoluteUri];
85 if (unit == null && !allowMissingFiles) { 85 if (unit == null && !allowMissingFiles) {
86 fail('Linker unexpectedly requested unit for "$absoluteUri".'); 86 fail('Linker unexpectedly requested unit for "$absoluteUri".');
87 } 87 }
88 return unit; 88 return unit;
89 } 89 }
90 linked = 90 linked = link(uriToUnit.keys.toSet(), getDependency, getUnit)[
91 link(<String>[testDartUri.toString()].toSet(), getDependency, getUnit)[ 91 testDartUri.toString()];
92 testDartUri.toString()];
93 expect(linked, isNotNull); 92 expect(linked, isNotNull);
94 validateLinkedLibrary(linked); 93 validateLinkedLibrary(linked);
95 unlinkedUnits = <UnlinkedUnit>[definingUnit]; 94 unlinkedUnits = <UnlinkedUnit>[definingUnit];
96 for (String relativeUri in definingUnit.publicNamespace.parts) { 95 for (String relativeUri in definingUnit.publicNamespace.parts) {
97 UnlinkedUnit unit = uriToUnit[ 96 UnlinkedUnit unit = uriToUnit[
98 resolveRelativeUri(testDartUri, Uri.parse(relativeUri)).toString()]; 97 resolveRelativeUri(testDartUri, Uri.parse(relativeUri)).toString()];
99 if (unit == null) { 98 if (unit == null) {
100 if (!allowMissingFiles) { 99 if (!allowMissingFiles) {
101 fail('Test referred to unknown unit $relativeUri'); 100 fail('Test referred to unknown unit $relativeUri');
102 } 101 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 CompilationUnit _parseText(String text) { 235 CompilationUnit _parseText(String text) {
237 CharSequenceReader reader = new CharSequenceReader(text); 236 CharSequenceReader reader = new CharSequenceReader(text);
238 Scanner scanner = 237 Scanner scanner =
239 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER); 238 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER);
240 Token token = scanner.tokenize(); 239 Token token = scanner.tokenize();
241 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER); 240 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER);
242 parser.parseGenericMethods = true; 241 parser.parseGenericMethods = true;
243 return parser.parseCompilationUnit(token); 242 return parser.parseCompilationUnit(token);
244 } 243 }
245 } 244 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698