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

Side by Side Diff: pkg/fletchc/lib/src/fletch_compiler.dart

Issue 918613002: Refactor implementation to address review comments and API design suggestions from Luke. (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 10 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
(Empty)
1 // Copyright (c) 2015, the Fletch 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.md file.
4
5 library fletchc.fletch_compiler;
6
7 import 'package:compiler/compiler.dart' as api;
8
9 import 'package:compiler/src/apiimpl.dart' as apiimpl;
10
11 import 'package:sharedfrontend/elements.dart' as elements;
12
13 import 'fletch_context.dart';
14
15 part 'fletch_compiler_hack.dart';
16
17 const EXTRA_DART2JS_OPTIONS = const <String>[
18 // TODO(ahe): This doesn't completely disable type inference. Investigate.
19 '--disable-type-inference',
20 '--output-type=dart',
21 ];
22
23 class FletchCompiler extends FletchCompilerHack {
24 FletchContext internalContext;
25
26 FletchCompiler(
27 api.CompilerInputProvider provider,
28 api.CompilerOutputProvider outputProvider,
29 api.DiagnosticHandler handler,
30 Uri libraryRoot,
31 Uri packageRoot,
32 List<String> options,
33 Map<String, dynamic> environment)
34 : super(
35 provider, outputProvider, handler, libraryRoot, packageRoot,
36 EXTRA_DART2JS_OPTIONS.toList()..addAll(options), environment);
37
38 FletchContext get context {
39 if (internalContext == null) {
40 internalContext = new FletchContext(this);
41 }
42 return internalContext;
43 }
44
45 void computeMain() {
46 if (mainApp == null) return;
47
48 mainFunction = mainApp.findLocal("_entry");
49 }
50
51 void onLibraryCreated(elements.LibraryElement library) {
52 // TODO(ahe): Remove this.
53 library.canUseNative = true;
54 super.onLibraryCreated(library);
55 }
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698