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

Side by Side Diff: pkg/compiler/lib/src/backend_strategy.dart

Issue 2858513002: Add BackendStrategy (Closed)
Patch Set: Updated cf. comments Created 3 years, 7 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 | « no previous file | pkg/compiler/lib/src/compiler.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) 2017, 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.backend_strategy;
6
7 import 'compiler.dart';
8 import 'js_emitter/sorter.dart';
9 import 'world.dart';
10
11 /// Strategy pattern that defines the element model used in type inference
12 /// and code generation.
13 abstract class BackendStrategy {
14 /// Create the [ClosedWorldRefiner] for [closedWorld].
15 ClosedWorldRefiner createClosedWorldRefiner(ClosedWorld closedWorld);
16
17 /// Create closure classes for local functions.
18 void convertClosures(ClosedWorldRefiner closedWorldRefiner);
19
20 /// The [Sorter] used for sorting elements in the generated code.
21 Sorter get sorter;
22 }
23
24 /// Strategy for using the [Element] model from the resolver as the backend
25 /// model.
26 class ElementBackendStrategy implements BackendStrategy {
27 final Compiler _compiler;
28
29 ElementBackendStrategy(this._compiler);
30
31 ClosedWorldRefiner createClosedWorldRefiner(ClosedWorldImpl closedWorld) =>
32 closedWorld;
33
34 Sorter get sorter => const ElementSorter();
35
36 void convertClosures(ClosedWorldRefiner closedWorldRefiner) {
37 _compiler.closureToClassMapper.createClosureClasses(closedWorldRefiner);
38 }
39 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698