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

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1583613002: Create LibraryElement.loadLibrary during resynth. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Create 'loadLibrary()' for dart:core too. Created 4 years, 11 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.generated.resolver_test; 5 library analyzer.test.generated.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 elementMap[mathSource] = mathLibrary; 400 elementMap[mathSource] = mathLibrary;
401 // 401 //
402 // Set the public and export namespaces. We don't use exports in the fake 402 // Set the public and export namespaces. We don't use exports in the fake
403 // core library so public and export namespaces are the same. 403 // core library so public and export namespaces are the same.
404 // 404 //
405 for (LibraryElementImpl library in elementMap.values) { 405 for (LibraryElementImpl library in elementMap.values) {
406 library.exportNamespace = 406 library.exportNamespace =
407 library.publicNamespace = new PublicNamespaceBuilder().build(library); 407 library.publicNamespace = new PublicNamespaceBuilder().build(library);
408 } 408 }
409 context.recordLibraryElements(elementMap); 409 context.recordLibraryElements(elementMap);
410 // Create the synthetic element for `loadLibrary`.
411 coreLibrary.createLoadLibraryFunction(context.typeProvider);
Paul Berry 2016/01/13 16:53:38 Nit: why not just loop over the libraries in eleme
412 asyncLibrary.createLoadLibraryFunction(context.typeProvider);
413 htmlLibrary.createLoadLibraryFunction(context.typeProvider);
414 mathLibrary.createLoadLibraryFunction(context.typeProvider);
410 return context; 415 return context;
411 } 416 }
412 } 417 }
413 418
414 /** 419 /**
415 * An analysis context that has a fake SDK that is much smaller and faster for 420 * An analysis context that has a fake SDK that is much smaller and faster for
416 * testing purposes. 421 * testing purposes.
417 */ 422 */
418 class AnalysisContextForTests extends AnalysisContextImpl { 423 class AnalysisContextForTests extends AnalysisContextImpl {
419 @override 424 @override
(...skipping 16266 matching lines...) Expand 10 before | Expand all | Expand 10 after
16686 16691
16687 void _resolveTestUnit(String code) { 16692 void _resolveTestUnit(String code) {
16688 testCode = code; 16693 testCode = code;
16689 testSource = addSource(testCode); 16694 testSource = addSource(testCode);
16690 LibraryElement library = resolve2(testSource); 16695 LibraryElement library = resolve2(testSource);
16691 assertNoErrors(testSource); 16696 assertNoErrors(testSource);
16692 verify([testSource]); 16697 verify([testSource]);
16693 testUnit = resolveCompilationUnit(testSource, library); 16698 testUnit = resolveCompilationUnit(testSource, library);
16694 } 16699 }
16695 } 16700 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698