| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |