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

Side by Side Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2280133002: implement kernel -> ssa for literals (Closed)
Patch Set: put ast accesses in separate class Created 4 years, 3 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) 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 'package:kernel/ast.dart' as ir;
6
7 import '../constants/values.dart';
8 import '../diagnostics/invariant.dart';
9 import '../elements/elements.dart';
10 import '../js_backend/js_backend.dart';
11 import '../tree/tree.dart' as ast;
12
13 /// A helper class that abstracts all accesses of the AST from Kernel nodes.
14 ///
15 /// The goal is to remove all need for the AST from the Kernel SSA builder.
16 class KernelAstAdapter {
17 final JavaScriptBackend backend;
18 final ResolvedAst resolvedAst;
19 final Map<ir.Node, ast.Node> nodeToAst;
20
21 KernelAstAdapter(this.backend, this.resolvedAst, this.nodeToAst);
22
23 ConstantValue getConstantFor(ir.Node node) {
Siggi Cherem (dart-lang) 2016/08/26 20:27:11 it seems to me like you only use this for Symbol,
24 ast.Node astNode = nodeToAst[node];
25 ConstantValue constantValue = backend.constants
26 .getConstantValueForNode(astNode, resolvedAst.elements);
27 assert(invariant(astNode, constantValue != null,
28 message: 'No constant computed for $node'));
29 return constantValue;
30 }
31 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698