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

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

Issue 2464103002: Introduce ClassLike, MemberLike, FieldLike and FunctionLike (Closed)
Patch Set: 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
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 '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart'; 8 import '../common/names.dart';
9 import '../compiler.dart'; 9 import '../compiler.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) { 67 ConstantValue getConstantForSymbol(ir.SymbolLiteral node) {
68 ast.Node astNode = getNode(node); 68 ast.Node astNode = getNode(node);
69 ConstantValue constantValue = _backend.constants 69 ConstantValue constantValue = _backend.constants
70 .getConstantValueForNode(astNode, _resolvedAst.elements); 70 .getConstantValueForNode(astNode, _resolvedAst.elements);
71 assert(invariant(astNode, constantValue != null, 71 assert(invariant(astNode, constantValue != null,
72 message: 'No constant computed for $node')); 72 message: 'No constant computed for $node'));
73 return constantValue; 73 return constantValue;
74 } 74 }
75 75
76 // TODO(johnniwinther): Use the more precise functions below.
76 Element getElement(ir.Node node) { 77 Element getElement(ir.Node node) {
77 Element result = _nodeToElement[node]; 78 Element result = _nodeToElement[node];
78 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null, 79 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null,
79 message: "No element found for $node.")); 80 message: "No element found for $node."));
80 return result; 81 return result;
81 } 82 }
82 83
84 MemberElement getMember(ir.Node node) => getElement(node).declaration;
85
86 MethodElement getMethod(ir.Node node) => getElement(node).declaration;
87
88 ClassElement getClass(ir.Node node) => getElement(node).declaration;
89
83 ast.Node getNode(ir.Node node) { 90 ast.Node getNode(ir.Node node) {
84 ast.Node result = _nodeToAst[node]; 91 ast.Node result = _nodeToAst[node];
85 assert(result != null); 92 assert(result != null);
86 return result; 93 return result;
87 } 94 }
88 95
89 Local getLocal(ir.VariableDeclaration variable) { 96 Local getLocal(ir.VariableDeclaration variable) {
90 // If this is a synthetic local, return the synthetic local 97 // If this is a synthetic local, return the synthetic local
91 if (variable.name == null) { 98 if (variable.name == null) {
92 return _syntheticLocals.putIfAbsent( 99 return _syntheticLocals.putIfAbsent(
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 249
243 JumpTarget getTargetDefinition(ir.Node node) => 250 JumpTarget getTargetDefinition(ir.Node node) =>
244 elements.getTargetDefinition(getNode(node)); 251 elements.getTargetDefinition(getNode(node));
245 252
246 ir.Procedure get mapLiteralConstructor => 253 ir.Procedure get mapLiteralConstructor =>
247 kernel.functions[_backend.helpers.mapLiteralConstructor]; 254 kernel.functions[_backend.helpers.mapLiteralConstructor];
248 255
249 ir.Procedure get mapLiteralConstructorEmpty => 256 ir.Procedure get mapLiteralConstructorEmpty =>
250 kernel.functions[_backend.helpers.mapLiteralConstructorEmpty]; 257 kernel.functions[_backend.helpers.mapLiteralConstructorEmpty];
251 258
252 Element get jsIndexableLength => _backend.helpers.jsIndexableLength; 259 MemberElement get jsIndexableLength => _backend.helpers.jsIndexableLength;
253 260
254 ir.Procedure get checkConcurrentModificationError => 261 ir.Procedure get checkConcurrentModificationError =>
255 kernel.functions[_backend.helpers.checkConcurrentModificationError]; 262 kernel.functions[_backend.helpers.checkConcurrentModificationError];
256 263
257 TypeMask get checkConcurrentModificationErrorReturnType => 264 TypeMask get checkConcurrentModificationErrorReturnType =>
258 TypeMaskFactory.inferredReturnTypeForElement( 265 TypeMaskFactory.inferredReturnTypeForElement(
259 _backend.helpers.checkConcurrentModificationError, _compiler); 266 _backend.helpers.checkConcurrentModificationError, _compiler);
260 267
261 ir.Procedure get assertHelper => 268 ir.Procedure get assertHelper =>
262 kernel.functions[_backend.helpers.assertHelper]; 269 kernel.functions[_backend.helpers.assertHelper];
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 @override 348 @override
342 DartType visitDynamicType(ir.DynamicType node) { 349 DartType visitDynamicType(ir.DynamicType node) {
343 return const DynamicType(); 350 return const DynamicType();
344 } 351 }
345 352
346 @override 353 @override
347 DartType visitInvalidType(ir.InvalidType node) { 354 DartType visitInvalidType(ir.InvalidType node) {
348 throw new UnimplementedError("Invalid types not currently supported"); 355 throw new UnimplementedError("Invalid types not currently supported");
349 } 356 }
350 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698