| Index: pkg/fletchc/lib/src/fletch_compiler.dart
|
| diff --git a/pkg/fletchc/lib/src/fletch_compiler.dart b/pkg/fletchc/lib/src/fletch_compiler.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e5b7b424cb537f384a71a2e5577a5fcc022dac59
|
| --- /dev/null
|
| +++ b/pkg/fletchc/lib/src/fletch_compiler.dart
|
| @@ -0,0 +1,56 @@
|
| +// Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE.md file.
|
| +
|
| +library fletchc.fletch_compiler;
|
| +
|
| +import 'package:compiler/compiler.dart' as api;
|
| +
|
| +import 'package:compiler/src/apiimpl.dart' as apiimpl;
|
| +
|
| +import 'package:sharedfrontend/elements.dart' as elements;
|
| +
|
| +import 'fletch_context.dart';
|
| +
|
| +part 'fletch_compiler_hack.dart';
|
| +
|
| +const EXTRA_DART2JS_OPTIONS = const <String>[
|
| + // TODO(ahe): This doesn't completely disable type inference. Investigate.
|
| + '--disable-type-inference',
|
| + '--output-type=dart',
|
| +];
|
| +
|
| +class FletchCompiler extends FletchCompilerHack {
|
| + FletchContext internalContext;
|
| +
|
| + FletchCompiler(
|
| + api.CompilerInputProvider provider,
|
| + api.CompilerOutputProvider outputProvider,
|
| + api.DiagnosticHandler handler,
|
| + Uri libraryRoot,
|
| + Uri packageRoot,
|
| + List<String> options,
|
| + Map<String, dynamic> environment)
|
| + : super(
|
| + provider, outputProvider, handler, libraryRoot, packageRoot,
|
| + EXTRA_DART2JS_OPTIONS.toList()..addAll(options), environment);
|
| +
|
| + FletchContext get context {
|
| + if (internalContext == null) {
|
| + internalContext = new FletchContext(this);
|
| + }
|
| + return internalContext;
|
| + }
|
| +
|
| + void computeMain() {
|
| + if (mainApp == null) return;
|
| +
|
| + mainFunction = mainApp.findLocal("_entry");
|
| + }
|
| +
|
| + void onLibraryCreated(elements.LibraryElement library) {
|
| + // TODO(ahe): Remove this.
|
| + library.canUseNative = true;
|
| + super.onLibraryCreated(library);
|
| + }
|
| +}
|
|
|