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

Side by Side Diff: pkg/dart2js_incremental/lib/dart2js_incremental.dart

Issue 1409803006: Rename apiimpl.Compiler to CompilerImpl. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix long lines Created 5 years, 1 month 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 dart2js_incremental; 5 library dart2js_incremental;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 EventSink, 8 EventSink,
9 Future; 9 Future;
10 10
11 import 'dart:developer' show 11 import 'dart:developer' show
12 UserTag; 12 UserTag;
13 13
14 import 'package:compiler/src/apiimpl.dart' show 14 import 'package:compiler/src/apiimpl.dart' show
15 Compiler; 15 CompilerImpl;
16 16
17 import 'package:compiler/compiler_new.dart' show 17 import 'package:compiler/compiler_new.dart' show
18 CompilerDiagnostics, 18 CompilerDiagnostics,
19 CompilerInput, 19 CompilerInput,
20 CompilerOutput, 20 CompilerOutput,
21 Diagnostic; 21 Diagnostic;
22 22
23 import 'package:compiler/src/null_compiler_output.dart' show 23 import 'package:compiler/src/null_compiler_output.dart' show
24 NullCompilerOutput; 24 NullCompilerOutput;
25 25
(...skipping 26 matching lines...) Expand all
52 final Uri libraryRoot; 52 final Uri libraryRoot;
53 final Uri packageRoot; 53 final Uri packageRoot;
54 final CompilerInput inputProvider; 54 final CompilerInput inputProvider;
55 final CompilerDiagnostics diagnosticHandler; 55 final CompilerDiagnostics diagnosticHandler;
56 final List<String> options; 56 final List<String> options;
57 final CompilerOutput outputProvider; 57 final CompilerOutput outputProvider;
58 final Map<String, dynamic> environment; 58 final Map<String, dynamic> environment;
59 final List<String> _updates = <String>[]; 59 final List<String> _updates = <String>[];
60 final IncrementalCompilerContext _context = new IncrementalCompilerContext(); 60 final IncrementalCompilerContext _context = new IncrementalCompilerContext();
61 61
62 Compiler _compiler; 62 CompilerImpl _compiler;
63 63
64 IncrementalCompiler({ 64 IncrementalCompiler({
65 this.libraryRoot, 65 this.libraryRoot,
66 this.packageRoot, 66 this.packageRoot,
67 this.inputProvider, 67 this.inputProvider,
68 this.diagnosticHandler, 68 this.diagnosticHandler,
69 this.options, 69 this.options,
70 this.outputProvider, 70 this.outputProvider,
71 this.environment}) { 71 this.environment}) {
72 if (libraryRoot == null) { 72 if (libraryRoot == null) {
73 throw new ArgumentError('libraryRoot is null.'); 73 throw new ArgumentError('libraryRoot is null.');
74 } 74 }
75 if (inputProvider == null) { 75 if (inputProvider == null) {
76 throw new ArgumentError('inputProvider is null.'); 76 throw new ArgumentError('inputProvider is null.');
77 } 77 }
78 if (outputProvider == null) { 78 if (outputProvider == null) {
79 throw new ArgumentError('outputProvider is null.'); 79 throw new ArgumentError('outputProvider is null.');
80 } 80 }
81 if (diagnosticHandler == null) { 81 if (diagnosticHandler == null) {
82 throw new ArgumentError('diagnosticHandler is null.'); 82 throw new ArgumentError('diagnosticHandler is null.');
83 } 83 }
84 _context.incrementalCompiler = this; 84 _context.incrementalCompiler = this;
85 } 85 }
86 86
87 LibraryElement get mainApp => _compiler.mainApp; 87 LibraryElement get mainApp => _compiler.mainApp;
88 88
89 Compiler get compiler => _compiler; 89 CompilerImpl get compiler => _compiler;
90 90
91 Future<bool> compile(Uri script) { 91 Future<bool> compile(Uri script) {
92 return _reuseCompiler(null).then((Compiler compiler) { 92 return _reuseCompiler(null).then((CompilerImpl compiler) {
93 _compiler = compiler; 93 _compiler = compiler;
94 return compiler.run(script); 94 return compiler.run(script);
95 }); 95 });
96 } 96 }
97 97
98 Future<Compiler> _reuseCompiler( 98 Future<CompilerImpl> _reuseCompiler(
99 Future<bool> reuseLibrary(LibraryElement library)) { 99 Future<bool> reuseLibrary(LibraryElement library)) {
100 List<String> options = this.options == null 100 List<String> options = this.options == null
101 ? <String> [] : new List<String>.from(this.options); 101 ? <String> [] : new List<String>.from(this.options);
102 options.addAll(INCREMENTAL_OPTIONS); 102 options.addAll(INCREMENTAL_OPTIONS);
103 return reuseCompiler( 103 return reuseCompiler(
104 cachedCompiler: _compiler, 104 cachedCompiler: _compiler,
105 libraryRoot: libraryRoot, 105 libraryRoot: libraryRoot,
106 packageRoot: packageRoot, 106 packageRoot: packageRoot,
107 inputProvider: inputProvider, 107 inputProvider: inputProvider,
108 diagnosticHandler: diagnosticHandler, 108 diagnosticHandler: diagnosticHandler,
(...skipping 17 matching lines...) Expand all
126 Uri updatedFile = updatedFiles[uri]; 126 Uri updatedFile = updatedFiles[uri];
127 return inputProvider(updatedFile == null ? uri : updatedFile); 127 return inputProvider(updatedFile == null ? uri : updatedFile);
128 } 128 }
129 LibraryUpdater updater = new LibraryUpdater( 129 LibraryUpdater updater = new LibraryUpdater(
130 _compiler, 130 _compiler,
131 mappingInputProvider, 131 mappingInputProvider,
132 logTime, 132 logTime,
133 logVerbose, 133 logVerbose,
134 _context); 134 _context);
135 _context.registerUriWithUpdates(updatedFiles.keys); 135 _context.registerUriWithUpdates(updatedFiles.keys);
136 Future<Compiler> future = _reuseCompiler(updater.reuseLibrary); 136 Future<CompilerImpl> future = _reuseCompiler(updater.reuseLibrary);
137 return future.then((Compiler compiler) { 137 return future.then((Compiler compiler) {
138 _compiler = compiler; 138 _compiler = compiler;
139 if (compiler.compilationFailed) { 139 if (compiler.compilationFailed) {
140 return null; 140 return null;
141 } else { 141 } else {
142 String update = updater.computeUpdateJs(); 142 String update = updater.computeUpdateJs();
143 _updates.add(update); 143 _updates.add(update);
144 return update; 144 return update;
145 } 145 }
146 }); 146 });
(...skipping 16 matching lines...) Expand all
163 } 163 }
164 } 164 }
165 165
166 class IncrementalCompilationFailed { 166 class IncrementalCompilationFailed {
167 final String reason; 167 final String reason;
168 168
169 const IncrementalCompilationFailed(this.reason); 169 const IncrementalCompilationFailed(this.reason);
170 170
171 String toString() => "Can't incrementally compile program.\n\n$reason"; 171 String toString() => "Can't incrementally compile program.\n\n$reason";
172 } 172 }
OLDNEW
« no previous file with comments | « pkg/dart2js_incremental/lib/caching_compiler.dart ('k') | tests/compiler/dart2js/analyze_dart2js_helpers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698