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

Side by Side Diff: pkg/kernel/lib/analyzer/loader.dart

Issue 2624193003: Work in progress: front end hot reload API (Closed)
Patch Set: First steel thread of functionality. Created 3 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) 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 library kernel.analyzer.loader; 4 library kernel.analyzer.loader;
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 /// Classes that have been referenced, and must be promoted to type level 102 /// Classes that have been referenced, and must be promoted to type level
103 /// so as not to expose partially initialized classes. 103 /// so as not to expose partially initialized classes.
104 final List<ast.Class> temporaryClassWorklist = []; 104 final List<ast.Class> temporaryClassWorklist = [];
105 105
106 LibraryElement _libraryBeingLoaded = null; 106 LibraryElement _libraryBeingLoaded = null;
107 107
108 bool get strongMode => context.analysisOptions.strongMode; 108 bool get strongMode => context.analysisOptions.strongMode;
109 109
110 DartLoader(this.repository, DartOptions options, Packages packages, 110 DartLoader(this.repository, DartOptions options, Packages packages,
111 {DartSdk dartSdk}) 111 {DartSdk dartSdk, AnalysisContext context})
112 : this.context = createContext(options, packages, dartSdk: dartSdk), 112 : this.context = context ?? createContext(options, packages, dartSdk: dart Sdk),
113 this.applicationRoot = options.applicationRoot; 113 this.applicationRoot = options.applicationRoot;
114 114
115 String getLibraryName(LibraryElement element) { 115 String getLibraryName(LibraryElement element) {
116 return element.name.isEmpty ? null : element.name; 116 return element.name.isEmpty ? null : element.name;
117 } 117 }
118 118
119 ast.Library getLibraryReference(LibraryElement element) { 119 ast.Library getLibraryReference(LibraryElement element) {
120 var uri = applicationRoot.relativeUri(element.source.uri); 120 var uri = applicationRoot.relativeUri(element.source.uri);
121 return repository.getLibraryReference(uri) 121 return repository.getLibraryReference(uri)
122 ..name ??= getLibraryName(element) 122 ..name ??= getLibraryName(element)
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext() 867 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext()
868 ..sourceFactory = new SourceFactory(resolvers) 868 ..sourceFactory = new SourceFactory(resolvers)
869 ..analysisOptions = createAnalysisOptions(options.strongMode); 869 ..analysisOptions = createAnalysisOptions(options.strongMode);
870 870
871 options.declaredVariables.forEach((String name, String value) { 871 options.declaredVariables.forEach((String name, String value) {
872 context.declaredVariables.define(name, value); 872 context.declaredVariables.define(name, value);
873 }); 873 });
874 874
875 return context; 875 return context;
876 } 876 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698