| 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: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 '../constants/constructors.dart'; | 9 import '../constants/constructors.dart'; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 | 187 |
| 188 Selector getSetterSelector(ir.Name irName) { | 188 Selector getSetterSelector(ir.Name irName) { |
| 189 Name name = new Name( | 189 Name name = new Name( |
| 190 irName.name, irName.isPrivate ? getLibrary(irName.library) : null); | 190 irName.name, irName.isPrivate ? getLibrary(irName.library) : null); |
| 191 return new Selector.setter(name); | 191 return new Selector.setter(name); |
| 192 } | 192 } |
| 193 | 193 |
| 194 /// Converts [annotations] into a list of [ConstantExpression]s. | 194 /// Converts [annotations] into a list of [ConstantExpression]s. |
| 195 List<ConstantExpression> getMetadata(List<ir.Expression> annotations) { | 195 List<ConstantExpression> getMetadata(List<ir.Expression> annotations) { |
| 196 if (annotations.isEmpty) return const <ConstantExpression>[]; |
| 196 List<ConstantExpression> metadata = <ConstantExpression>[]; | 197 List<ConstantExpression> metadata = <ConstantExpression>[]; |
| 197 annotations.forEach((ir.Expression node) { | 198 annotations.forEach((ir.Expression node) { |
| 198 ConstantExpression constant = new Constantifier(this).visit(node); | 199 ConstantExpression constant = new Constantifier(this).visit(node); |
| 199 if (constant == null) { | 200 if (constant == null) { |
| 200 throw new UnsupportedError( | 201 throw new UnsupportedError( |
| 201 'No constant for ${DebugPrinter.prettyPrint(node)}'); | 202 'No constant for ${DebugPrinter.prettyPrint(node)}'); |
| 202 } | 203 } |
| 203 metadata.add(constant); | 204 metadata.add(constant); |
| 204 }); | 205 }); |
| 205 return metadata; | 206 return metadata; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 } | 606 } |
| 606 if (isRedirecting) { | 607 if (isRedirecting) { |
| 607 return new RedirectingGenerativeConstantConstructor( | 608 return new RedirectingGenerativeConstantConstructor( |
| 608 defaultValues, superConstructorInvocation); | 609 defaultValues, superConstructorInvocation); |
| 609 } else { | 610 } else { |
| 610 return new GenerativeConstantConstructor( | 611 return new GenerativeConstantConstructor( |
| 611 type, defaultValues, fieldMap, superConstructorInvocation); | 612 type, defaultValues, fieldMap, superConstructorInvocation); |
| 612 } | 613 } |
| 613 } | 614 } |
| 614 } | 615 } |
| OLD | NEW |