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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map_mixins.dart

Issue 2982783003: Use failedAt in more places (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | pkg/compiler/lib/src/kernel/env.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart'; 9 import '../common/names.dart';
10 import '../constants/constructors.dart'; 10 import '../constants/constructors.dart';
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 if (node is ir.PropertySet) { 59 if (node is ir.PropertySet) {
60 return getSetterSelector(node.name); 60 return getSetterSelector(node.name);
61 } 61 }
62 if (node is ir.SuperPropertySet) { 62 if (node is ir.SuperPropertySet) {
63 return getSetterSelector(node.name); 63 return getSetterSelector(node.name);
64 } 64 }
65 if (node is ir.InvocationExpression) { 65 if (node is ir.InvocationExpression) {
66 return getInvocationSelector(node); 66 return getInvocationSelector(node);
67 } 67 }
68 throw new SpannableAssertionFailure( 68 throw failedAt(
69 CURRENT_ELEMENT_SPANNABLE, 69 CURRENT_ELEMENT_SPANNABLE,
70 "Can only get the selector for a property get or an invocation: " 70 "Can only get the selector for a property get or an invocation: "
71 "${node}"); 71 "${node}");
72 } 72 }
73 73
74 Selector getInvocationSelector(ir.InvocationExpression invocation) { 74 Selector getInvocationSelector(ir.InvocationExpression invocation) {
75 Name name = getName(invocation.name); 75 Name name = getName(invocation.name);
76 SelectorKind kind; 76 SelectorKind kind;
77 if (Selector.isOperatorName(name.text)) { 77 if (Selector.isOperatorName(name.text)) {
78 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { 78 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 } 274 }
275 return null; 275 return null;
276 } 276 }
277 277
278 ConstantValue getConstantValue(ir.Expression node, 278 ConstantValue getConstantValue(ir.Expression node,
279 {bool requireConstant: true, bool implicitNull: false}) { 279 {bool requireConstant: true, bool implicitNull: false}) {
280 ConstantExpression constant; 280 ConstantExpression constant;
281 if (node == null) { 281 if (node == null) {
282 if (!implicitNull) { 282 if (!implicitNull) {
283 throw new SpannableAssertionFailure( 283 throw failedAt(
284 CURRENT_ELEMENT_SPANNABLE, 'No expression for constant.'); 284 CURRENT_ELEMENT_SPANNABLE, 'No expression for constant.');
285 } 285 }
286 constant = new NullConstantExpression(); 286 constant = new NullConstantExpression();
287 } else { 287 } else {
288 constant = 288 constant =
289 new Constantifier(this, requireConstant: requireConstant).visit(node); 289 new Constantifier(this, requireConstant: requireConstant).visit(node);
290 } 290 }
291 if (constant == null) { 291 if (constant == null) {
292 if (requireConstant) { 292 if (requireConstant) {
293 throw new UnsupportedError( 293 throw new UnsupportedError(
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 } 843 }
844 if (isRedirecting) { 844 if (isRedirecting) {
845 return new RedirectingGenerativeConstantConstructor( 845 return new RedirectingGenerativeConstantConstructor(
846 defaultValues, superConstructorInvocation); 846 defaultValues, superConstructorInvocation);
847 } else { 847 } else {
848 return new GenerativeConstantConstructor( 848 return new GenerativeConstantConstructor(
849 type, defaultValues, fieldMap, superConstructorInvocation); 849 type, defaultValues, fieldMap, superConstructorInvocation);
850 } 850 }
851 } 851 }
852 } 852 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | pkg/compiler/lib/src/kernel/env.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698