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

Side by Side Diff: pkg/compiler/lib/src/js_backend/kernel_task.dart

Issue 2442503004: make kerneltask an actual task (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/kernel/task.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import '../compiler.dart';
6 import '../common/names.dart';
7 import '../elements/elements.dart';
8 import '../kernel/kernel.dart';
9 import 'package:kernel/ast.dart' as ir;
10
11 import 'backend.dart';
12
13 /// Visits the compiler main function and builds the kernel representation.
14 ///
15 /// This creates a mapping from kernel nodes to AST nodes to be used later.
16 class KernelTask {
17 final Compiler _compiler;
18 final Kernel kernel;
19
20 KernelTask(JavaScriptBackend backend)
21 : this._compiler = backend.compiler,
22 this.kernel = new Kernel(backend.compiler);
23
24 ir.Program program;
25
26 /// Builds the kernel IR for the main function.
27 ///
28 /// May enqueue more elements to the resolution queue.
29 void buildKernelIr() {
30 program = buildProgram(_compiler.mainApp);
31 }
32
33 /// Builds the kernel IR program for the main function exported from
34 /// [library].
35 ///
36 /// May enqueue more elements to the resolution queue.
37 ir.Program buildProgram(LibraryElement library) {
38 return new ir.Program(kernel.libraryDependencies(library.canonicalUri))
39 ..mainMethod =
40 kernel.functionToIr(library.findExported(Identifiers.main));
41 }
42 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/kernel/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698