Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 } | |
| OLD | NEW |