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

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

Issue 2925443002: Use failedAt in more places (ssa) (Closed)
Patch Set: Created 3 years, 6 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
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:js_runtime/shared/embedded_names.dart'; 5 import 'package:js_runtime/shared/embedded_names.dart';
6 import 'package:kernel/ast.dart' as ir; 6 import 'package:kernel/ast.dart' as ir;
7 7
8 import '../closure.dart'; 8 import '../closure.dart';
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart'; 10 import '../compiler.dart';
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 _resolvedAst = _resolvedAstStack.removeLast(); 150 _resolvedAst = _resolvedAstStack.removeLast();
151 } 151 }
152 152
153 Compiler get _compiler => _backend.compiler; 153 Compiler get _compiler => _backend.compiler;
154 TreeElements get elements => _resolvedAst.elements; 154 TreeElements get elements => _resolvedAst.elements;
155 DiagnosticReporter get reporter => _compiler.reporter; 155 DiagnosticReporter get reporter => _compiler.reporter;
156 156
157 // TODO(johnniwinther): Use the more precise functions below. 157 // TODO(johnniwinther): Use the more precise functions below.
158 Element getElement(ir.Node node) { 158 Element getElement(ir.Node node) {
159 Element result = _nodeToElement[node]; 159 Element result = _nodeToElement[node];
160 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null, 160 assert(result != null,
161 message: "No element found for $node.")); 161 failedAt(CURRENT_ELEMENT_SPANNABLE, "No element found for $node."));
162 return result; 162 return result;
163 } 163 }
164 164
165 ConstructorElement getConstructor(ir.Member node) => 165 ConstructorElement getConstructor(ir.Member node) =>
166 getElement(node).declaration; 166 getElement(node).declaration;
167 167
168 @override 168 @override
169 ConstructorEntity getSuperConstructor( 169 ConstructorEntity getSuperConstructor(
170 ir.Constructor constructor, ir.Member target) { 170 ir.Constructor constructor, ir.Member target) {
171 assert(target != null); 171 assert(target != null);
(...skipping 14 matching lines...) Expand all
186 FieldElement getField(ir.Field node) => getElement(node).declaration; 186 FieldElement getField(ir.Field node) => getElement(node).declaration;
187 187
188 ClassElement getClass(ir.Class node) => getElement(node).declaration; 188 ClassElement getClass(ir.Class node) => getElement(node).declaration;
189 189
190 LibraryElement getLibrary(ir.Library node) => getElement(node).declaration; 190 LibraryElement getLibrary(ir.Library node) => getElement(node).declaration;
191 191
192 LocalFunctionElement getLocalFunction(ir.TreeNode node) => getElement(node); 192 LocalFunctionElement getLocalFunction(ir.TreeNode node) => getElement(node);
193 193
194 ast.Node getNode(ir.Node node) { 194 ast.Node getNode(ir.Node node) {
195 ast.Node result = _nodeToAst[node]; 195 ast.Node result = _nodeToAst[node];
196 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null, 196 assert(result != null,
197 message: "No node found for $node")); 197 failedAt(CURRENT_ELEMENT_SPANNABLE, "No node found for $node"));
198 return result; 198 return result;
199 } 199 }
200 200
201 ast.Node getNodeOrNull(ir.Node node) { 201 ast.Node getNodeOrNull(ir.Node node) {
202 return _nodeToAst[node]; 202 return _nodeToAst[node];
203 } 203 }
204 204
205 void assertNodeIsSynthetic(ir.Node node) { 205 void assertNodeIsSynthetic(ir.Node node) {
206 assert(invariant( 206 assert(
207 CURRENT_ELEMENT_SPANNABLE, kernel.syntheticNodes.contains(node), 207 kernel.syntheticNodes.contains(node),
208 message: "No synthetic marker found for $node")); 208 failedAt(
209 CURRENT_ELEMENT_SPANNABLE, "No synthetic marker found for $node"));
209 } 210 }
210 211
211 @override 212 @override
212 Local getLocal(ir.VariableDeclaration variable) { 213 Local getLocal(ir.VariableDeclaration variable) {
213 // If this is a synthetic local, return the synthetic local 214 // If this is a synthetic local, return the synthetic local
214 if (variable.name == null) { 215 if (variable.name == null) {
215 return _syntheticLocals.putIfAbsent( 216 return _syntheticLocals.putIfAbsent(
216 variable, () => new SyntheticLocal("x", null, null)); 217 variable, () => new SyntheticLocal("x", null, null));
217 } 218 }
218 return getElement(variable) as LocalElement; 219 return getElement(variable) as LocalElement;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 TypeMask selectorTypeOf(Selector selector, TypeMask mask) { 632 TypeMask selectorTypeOf(Selector selector, TypeMask mask) {
632 return TypeMaskFactory.inferredTypeForSelector( 633 return TypeMaskFactory.inferredTypeForSelector(
633 selector, mask, _globalInferenceResults); 634 selector, mask, _globalInferenceResults);
634 } 635 }
635 636
636 TypeMask typeFromNativeBehavior( 637 TypeMask typeFromNativeBehavior(
637 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) { 638 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) {
638 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld); 639 return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
639 } 640 }
640 } 641 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698