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

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

Issue 355563004: Create package for incremental compilation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library dart2js_incremental;
6
7 import 'dart:async' show
8 Future;
9
10 import 'dart:profiler' show
11 UserTag;
12
13 import 'package:compiler/implementation/apiimpl.dart' show
14 Compiler;
15
16 import 'package:compiler/compiler.dart' show
17 CompilerInputProvider,
18 CompilerOutputProvider,
19 Diagnostic,
20 DiagnosticHandler;
21
22 import 'package:compiler/implementation/dart2jslib.dart' show
23 NullSink;
24
25 import 'package:compiler/implementation/js_backend/js_backend.dart' show
26 JavaScriptBackend;
27
28 import 'package:compiler/implementation/elements/elements.dart' show
29 LibraryElement;
30
31 part 'caching_compiler.dart';
32
33 const List<String> INCREMENTAL_OPTIONS = const <String>[
34 '--disable-type-inference',
35 '--incremental-support',
36 '--no-source-maps', // TODO(ahe): Remove this.
37 ];
38
39 class IncrementalCompiler {
40 final Uri libraryRoot;
41 final Uri packageRoot;
42 final CompilerInputProvider inputProvider;
43 final DiagnosticHandler diagnosticHandler;
44 final List<String> options;
45 final CompilerOutputProvider outputProvider;
46 final Map<String, dynamic> environment;
47
48 Compiler _compiler;
49
50 IncrementalCompiler({
51 this.libraryRoot,
52 this.packageRoot,
53 this.inputProvider,
54 this.diagnosticHandler,
55 this.options,
56 this.outputProvider,
57 this.environment}) {
58 if (libraryRoot == null) {
59 throw new ArgumentError('libraryRoot is null.');
60 }
61 if (inputProvider == null) {
62 throw new ArgumentError('inputProvider is null.');
63 }
64 if (diagnosticHandler == null) {
65 throw new ArgumentError('diagnosticHandler is null.');
66 }
67 }
68
69 Future<bool> compile(Uri script) {
70 List<String> options = new List<String>.from(this.options);
71 options.addAll(INCREMENTAL_OPTIONS);
72 _compiler = reuseCompiler(
73 cachedCompiler: _compiler,
74 libraryRoot: libraryRoot,
75 packageRoot: packageRoot,
76 inputProvider: inputProvider,
77 diagnosticHandler: diagnosticHandler,
78 options: options,
79 outputProvider: outputProvider,
80 environment: environment);
81 return _compiler.run(script);
82 }
83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698