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

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

Issue 2464103002: Introduce ClassLike, MemberLike, FieldLike and FunctionLike (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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/ssa/codegen_helpers.dart ('k') | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart'; 9 import '../common/names.dart';
10 import '../compiler.dart'; 10 import '../compiler.dart';
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { 70 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) {
71 ast.Node astNode = getNode(node); 71 ast.Node astNode = getNode(node);
72 ConstantValue constantValue = _backend.constants 72 ConstantValue constantValue = _backend.constants
73 .getConstantValueForNode(astNode, _resolvedAst.elements); 73 .getConstantValueForNode(astNode, _resolvedAst.elements);
74 assert(invariant(astNode, constantValue != null, 74 assert(invariant(astNode, constantValue != null,
75 message: 'No constant computed for $node')); 75 message: 'No constant computed for $node'));
76 return constantValue; 76 return constantValue;
77 } 77 }
78 78
79 // TODO(johnniwinther): Use the more precise functions below.
79 Element getElement(ir.Node node) { 80 Element getElement(ir.Node node) {
80 Element result = _nodeToElement[node]; 81 Element result = _nodeToElement[node];
81 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null, 82 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null,
82 message: "No element found for $node.")); 83 message: "No element found for $node."));
83 return result; 84 return result;
84 } 85 }
85 86
87 MemberElement getMember(ir.Node node) => getElement(node).declaration;
88
89 MethodElement getMethod(ir.Node node) => getElement(node).declaration;
90
91 ClassElement getClass(ir.Node node) => getElement(node).declaration;
92
86 ast.Node getNode(ir.Node node) { 93 ast.Node getNode(ir.Node node) {
87 ast.Node result = _nodeToAst[node]; 94 ast.Node result = _nodeToAst[node];
88 assert(result != null); 95 assert(result != null);
89 return result; 96 return result;
90 } 97 }
91 98
92 Local getLocal(ir.VariableDeclaration variable) { 99 Local getLocal(ir.VariableDeclaration variable) {
93 // If this is a synthetic local, return the synthetic local 100 // If this is a synthetic local, return the synthetic local
94 if (variable.name == null) { 101 if (variable.name == null) {
95 return _syntheticLocals.putIfAbsent( 102 return _syntheticLocals.putIfAbsent(
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 252
246 JumpTarget getTargetDefinition(ir.Node node) => 253 JumpTarget getTargetDefinition(ir.Node node) =>
247 elements.getTargetDefinition(getNode(node)); 254 elements.getTargetDefinition(getNode(node));
248 255
249 ir.Procedure get mapLiteralConstructor => 256 ir.Procedure get mapLiteralConstructor =>
250 kernel.functions[_backend.helpers.mapLiteralConstructor]; 257 kernel.functions[_backend.helpers.mapLiteralConstructor];
251 258
252 ir.Procedure get mapLiteralConstructorEmpty => 259 ir.Procedure get mapLiteralConstructorEmpty =>
253 kernel.functions[_backend.helpers.mapLiteralConstructorEmpty]; 260 kernel.functions[_backend.helpers.mapLiteralConstructorEmpty];
254 261
255 Element get jsIndexableLength => _backend.helpers.jsIndexableLength; 262 MemberElement get jsIndexableLength => _backend.helpers.jsIndexableLength;
256 263
257 ir.Procedure get checkConcurrentModificationError => 264 ir.Procedure get checkConcurrentModificationError =>
258 kernel.functions[_backend.helpers.checkConcurrentModificationError]; 265 kernel.functions[_backend.helpers.checkConcurrentModificationError];
259 266
260 TypeMask get checkConcurrentModificationErrorReturnType => 267 TypeMask get checkConcurrentModificationErrorReturnType =>
261 TypeMaskFactory.inferredReturnTypeForElement( 268 TypeMaskFactory.inferredReturnTypeForElement(
262 _backend.helpers.checkConcurrentModificationError, _compiler); 269 _backend.helpers.checkConcurrentModificationError, _compiler);
263 270
264 ir.Procedure get assertHelper => 271 ir.Procedure get assertHelper =>
265 kernel.functions[_backend.helpers.assertHelper]; 272 kernel.functions[_backend.helpers.assertHelper];
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 node.arguments.positional.length + argumentNames.length, 636 node.arguments.positional.length + argumentNames.length,
630 argumentNames), 637 argumentNames),
631 arguments); 638 arguments);
632 } 639 }
633 640
634 @override 641 @override
635 ConstantExpression visitStringLiteral(ir.StringLiteral node) { 642 ConstantExpression visitStringLiteral(ir.StringLiteral node) {
636 return new StringConstantExpression(node.value); 643 return new StringConstantExpression(node.value);
637 } 644 }
638 } 645 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen_helpers.dart ('k') | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698