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 library rasta.kernel_visitor; | 5 library rasta.kernel_visitor; |
6 | 6 |
7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
8 | 8 |
9 import 'package:kernel/accessors.dart' show | 9 import 'package:kernel/accessors.dart' show |
10 Accessor, | 10 Accessor, |
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 requiredParameterCount = signature.requiredParameterCount; | 2077 requiredParameterCount = signature.requiredParameterCount; |
2078 signature.forEachParameter((ParameterElement parameter) { | 2078 signature.forEachParameter((ParameterElement parameter) { |
2079 ir.VariableDeclaration variable = getLocal(parameter); | 2079 ir.VariableDeclaration variable = getLocal(parameter); |
2080 if (parameter.isNamed) { | 2080 if (parameter.isNamed) { |
2081 namedParameters.add(variable); | 2081 namedParameters.add(variable); |
2082 } else { | 2082 } else { |
2083 positionalParameters.add(variable); | 2083 positionalParameters.add(variable); |
2084 } | 2084 } |
2085 }); | 2085 }); |
2086 signature.forEachParameter((ParameterElement parameter) { | 2086 signature.forEachParameter((ParameterElement parameter) { |
| 2087 if (!parameter.isOptional) return; |
2087 ir.Expression initializer = parameter.initializer?.accept(this); | 2088 ir.Expression initializer = parameter.initializer?.accept(this); |
2088 ir.VariableDeclaration variable = getLocal(parameter); | 2089 ir.VariableDeclaration variable = getLocal(parameter); |
2089 if (initializer != null) { | 2090 if (initializer != null) { |
2090 variable.initializer = initializer; | 2091 variable.initializer = initializer; |
2091 initializer.parent = variable; | 2092 initializer.parent = variable; |
2092 } | 2093 } |
2093 }); | 2094 }); |
2094 returnType = typeToIrHack(signature.type.returnType); | 2095 returnType = typeToIrHack(signature.type.returnType); |
2095 } | 2096 } |
2096 ir.AsyncMarker asyncMarker = ir.AsyncMarker.Sync; | 2097 ir.AsyncMarker asyncMarker = ir.AsyncMarker.Sync; |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 : this(null, true, node, initializers); | 3036 : this(null, true, node, initializers); |
3036 | 3037 |
3037 accept(ir.Visitor v) => throw "unsupported"; | 3038 accept(ir.Visitor v) => throw "unsupported"; |
3038 | 3039 |
3039 visitChildren(ir.Visitor v) => throw "unsupported"; | 3040 visitChildren(ir.Visitor v) => throw "unsupported"; |
3040 | 3041 |
3041 String toString() { | 3042 String toString() { |
3042 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 3043 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
3043 } | 3044 } |
3044 } | 3045 } |
OLD | NEW |