| 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 import 'package:kernel/frontend/accessors.dart' | 6 import 'package:kernel/frontend/accessors.dart' |
| 7 show | 7 show |
| 8 Accessor, | 8 Accessor, |
| 9 IndexAccessor, | 9 IndexAccessor, |
| 10 NullAwarePropertyAccessor, | 10 NullAwarePropertyAccessor, |
| (...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 positionalParameters.add(variable); | 2012 positionalParameters.add(variable); |
| 2013 } | 2013 } |
| 2014 }); | 2014 }); |
| 2015 signature.forEachParameter((ParameterElement parameter) { | 2015 signature.forEachParameter((ParameterElement parameter) { |
| 2016 if (!parameter.isOptional) return; | 2016 if (!parameter.isOptional) return; |
| 2017 ir.Expression initializer = visitForValue(parameter.initializer); | 2017 ir.Expression initializer = visitForValue(parameter.initializer); |
| 2018 ir.VariableDeclaration variable = getLocal(parameter); | 2018 ir.VariableDeclaration variable = getLocal(parameter); |
| 2019 if (initializer != null) { | 2019 if (initializer != null) { |
| 2020 variable.initializer = initializer; | 2020 variable.initializer = initializer; |
| 2021 initializer.parent = variable; | 2021 initializer.parent = variable; |
| 2022 kernel.parameterInitializerNodeToConstant[initializer] = |
| 2023 parameter.constant; |
| 2022 } | 2024 } |
| 2023 }); | 2025 }); |
| 2024 if (function.isGenerativeConstructor) { | 2026 if (function.isGenerativeConstructor) { |
| 2025 returnType = const ir.VoidType(); | 2027 returnType = const ir.VoidType(); |
| 2026 } else { | 2028 } else { |
| 2027 returnType = typeToIrHack(signature.type.returnType); | 2029 returnType = typeToIrHack(signature.type.returnType); |
| 2028 } | 2030 } |
| 2029 if (function.isFactoryConstructor) { | 2031 if (function.isFactoryConstructor) { |
| 2030 InterfaceType type = function.enclosingClass.thisType; | 2032 InterfaceType type = function.enclosingClass.thisType; |
| 2031 if (type.isGeneric) { | 2033 if (type.isGeneric) { |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 : this(null, true, node, initializers); | 2817 : this(null, true, node, initializers); |
| 2816 | 2818 |
| 2817 accept(ir.Visitor v) => throw "unsupported"; | 2819 accept(ir.Visitor v) => throw "unsupported"; |
| 2818 | 2820 |
| 2819 visitChildren(ir.Visitor v) => throw "unsupported"; | 2821 visitChildren(ir.Visitor v) => throw "unsupported"; |
| 2820 | 2822 |
| 2821 String toString() { | 2823 String toString() { |
| 2822 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 2824 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
| 2823 } | 2825 } |
| 2824 } | 2826 } |
| OLD | NEW |