| OLD | NEW |
| 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import "../elements/resolution_types.dart" show DartType, InterfaceType; | 7 import "../elements/resolution_types.dart" |
| 8 show ResolutionDartType, ResolutionInterfaceType; |
| 8 import "../elements/elements.dart" | 9 import "../elements/elements.dart" |
| 9 show | 10 show |
| 10 AstElement, | 11 AstElement, |
| 11 ConstructorElement, | 12 ConstructorElement, |
| 12 Element, | 13 Element, |
| 13 ErroneousElement, | 14 ErroneousElement, |
| 14 FunctionElement, | 15 FunctionElement, |
| 15 MethodElement; | 16 MethodElement; |
| 16 import "../resolution/operators.dart" | 17 import "../resolution/operators.dart" |
| 17 show AssignmentOperator, BinaryOperator, IncDecOperator, UnaryOperator; | 18 show AssignmentOperator, BinaryOperator, IncDecOperator, UnaryOperator; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 151 |
| 151 SuperPropertyAccessor buildUnresolvedSuperPropertyAccessor( | 152 SuperPropertyAccessor buildUnresolvedSuperPropertyAccessor( |
| 152 String name, Element getter) { | 153 String name, Element getter) { |
| 153 return new SuperPropertyAccessor(this, kernel.irName(name, currentElement), | 154 return new SuperPropertyAccessor(this, kernel.irName(name, currentElement), |
| 154 getter == null ? null : possiblyErroneousFunctionToIr(getter), null); | 155 getter == null ? null : possiblyErroneousFunctionToIr(getter), null); |
| 155 } | 156 } |
| 156 | 157 |
| 157 ir.Expression visitUnresolvedClassConstructorInvoke( | 158 ir.Expression visitUnresolvedClassConstructorInvoke( |
| 158 NewExpression node, | 159 NewExpression node, |
| 159 ErroneousElement element, | 160 ErroneousElement element, |
| 160 DartType type, | 161 ResolutionDartType type, |
| 161 NodeList arguments, | 162 NodeList arguments, |
| 162 Selector selector, | 163 Selector selector, |
| 163 _) { | 164 _) { |
| 164 // TODO(asgerf): The VM includes source information as part of the error | 165 // TODO(asgerf): The VM includes source information as part of the error |
| 165 // message. We could do the same when we add source maps. | 166 // message. We could do the same when we add source maps. |
| 166 return buildThrowSingleArgumentError( | 167 return buildThrowSingleArgumentError( |
| 167 kernel.getMalformedTypeErrorBuilder(), element.message); | 168 kernel.getMalformedTypeErrorBuilder(), element.message); |
| 168 } | 169 } |
| 169 | 170 |
| 170 ir.Expression visitUnresolvedConstructorInvoke( | 171 ir.Expression visitUnresolvedConstructorInvoke( |
| 171 NewExpression node, | 172 NewExpression node, |
| 172 Element constructor, | 173 Element constructor, |
| 173 DartType type, | 174 ResolutionDartType type, |
| 174 NodeList arguments, | 175 NodeList arguments, |
| 175 Selector selector, | 176 Selector selector, |
| 176 _) { | 177 _) { |
| 177 ir.Expression receiver = new ir.TypeLiteral(kernel.interfaceTypeToIr(type)); | 178 ir.Expression receiver = new ir.TypeLiteral(kernel.interfaceTypeToIr(type)); |
| 178 String methodName = | 179 String methodName = |
| 179 node.send.selector != null ? '${node.send.selector}' : type.name; | 180 node.send.selector != null ? '${node.send.selector}' : type.name; |
| 180 return buildThrowNoSuchMethodError(kernel.getUnresolvedConstructorBuilder(), | 181 return buildThrowNoSuchMethodError(kernel.getUnresolvedConstructorBuilder(), |
| 181 receiver, methodName, buildArguments(arguments), constructor); | 182 receiver, methodName, buildArguments(arguments), constructor); |
| 182 } | 183 } |
| 183 | 184 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 204 } | 205 } |
| 205 | 206 |
| 206 ir.Expression visitUnresolvedPrefix( | 207 ir.Expression visitUnresolvedPrefix( |
| 207 Send node, Element element, IncDecOperator operator, _) { | 208 Send node, Element element, IncDecOperator operator, _) { |
| 208 return buildThrowUnresolvedGetter('${node.selector}'); | 209 return buildThrowUnresolvedGetter('${node.selector}'); |
| 209 } | 210 } |
| 210 | 211 |
| 211 ir.Expression visitUnresolvedRedirectingFactoryConstructorInvoke( | 212 ir.Expression visitUnresolvedRedirectingFactoryConstructorInvoke( |
| 212 NewExpression node, | 213 NewExpression node, |
| 213 ConstructorElement constructor, | 214 ConstructorElement constructor, |
| 214 InterfaceType type, | 215 ResolutionInterfaceType type, |
| 215 NodeList arguments, | 216 NodeList arguments, |
| 216 CallStructure callStructure, | 217 CallStructure callStructure, |
| 217 _) { | 218 _) { |
| 218 // The body of the factory will throw an error. | 219 // The body of the factory will throw an error. |
| 219 return new ir.StaticInvocation( | 220 return new ir.StaticInvocation( |
| 220 possiblyErroneousFunctionToIr(constructor), buildArguments(arguments)); | 221 possiblyErroneousFunctionToIr(constructor), buildArguments(arguments)); |
| 221 } | 222 } |
| 222 | 223 |
| 223 ir.Expression visitUnresolvedSet(Send node, Element element, Node rhs, _) { | 224 ir.Expression visitUnresolvedSet(Send node, Element element, Node rhs, _) { |
| 224 return buildThrowUnresolvedSetter('${node.selector}', visitForValue(rhs)); | 225 return buildThrowUnresolvedSetter('${node.selector}', visitForValue(rhs)); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 return buildUnresolvedSuperIndexAccessor(index, element) | 567 return buildUnresolvedSuperIndexAccessor(index, element) |
| 567 .buildNullAwareAssignment(visitForValue(rhs), null); | 568 .buildNullAwareAssignment(visitForValue(rhs), null); |
| 568 } | 569 } |
| 569 | 570 |
| 570 ir.Expression visitUnresolvedSuperSet( | 571 ir.Expression visitUnresolvedSuperSet( |
| 571 Send node, Element element, Node rhs, _) { | 572 Send node, Element element, Node rhs, _) { |
| 572 return buildThrowUnresolvedSuperSetter( | 573 return buildThrowUnresolvedSuperSetter( |
| 573 '${node.selector}', visitForValue(rhs)); | 574 '${node.selector}', visitForValue(rhs)); |
| 574 } | 575 } |
| 575 } | 576 } |
| OLD | NEW |