OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library backend_ast_emitter; | 5 library backend_ast_emitter; |
6 | 6 |
7 import '../tree_ir/tree_ir_nodes.dart' as tree; | 7 import '../tree_ir/tree_ir_nodes.dart' as tree; |
8 import 'backend_ast_nodes.dart'; | 8 import 'backend_ast_nodes.dart'; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 visit(exp.values[i], context))); | 1154 visit(exp.values[i], context))); |
1155 List<TypeAnnotation> typeArguments = exp.type.treatAsRaw | 1155 List<TypeAnnotation> typeArguments = exp.type.treatAsRaw |
1156 ? null | 1156 ? null |
1157 : exp.type.typeArguments.map(TypeGenerator.createType).toList(); | 1157 : exp.type.typeArguments.map(TypeGenerator.createType).toList(); |
1158 return new LiteralMap(entries, isConst: true, typeArguments: typeArguments); | 1158 return new LiteralMap(entries, isConst: true, typeArguments: typeArguments); |
1159 } | 1159 } |
1160 | 1160 |
1161 @override | 1161 @override |
1162 Expression visitConstructed(ConstructedConstantExpression exp, | 1162 Expression visitConstructed(ConstructedConstantExpression exp, |
1163 BuilderContext<Statement> context) { | 1163 BuilderContext<Statement> context) { |
1164 int positionalArgumentCount = exp.selector.positionalArgumentCount; | 1164 int positionalArgumentCount = exp.callStructure.positionalArgumentCount; |
1165 List<Argument> args = new List<Argument>.generate( | 1165 List<Argument> args = new List<Argument>.generate( |
1166 positionalArgumentCount, | 1166 positionalArgumentCount, |
1167 (i) => visit(exp.arguments[i], context)); | 1167 (i) => visit(exp.arguments[i], context)); |
1168 for (int i = 0; i < exp.selector.namedArgumentCount; ++i) { | 1168 for (int i = 0; i < exp.callStructure.namedArgumentCount; ++i) { |
1169 args.add(new NamedArgument(exp.selector.namedArguments[i], | 1169 args.add(new NamedArgument(exp.callStructure.namedArguments[i], |
1170 visit(exp.arguments[positionalArgumentCount + i], context))); | 1170 visit(exp.arguments[positionalArgumentCount + i], context))); |
1171 } | 1171 } |
1172 | 1172 |
1173 FunctionElement constructor = exp.target; | 1173 FunctionElement constructor = exp.target; |
1174 String name = constructor.name.isEmpty ? null : constructor.name; | 1174 String name = constructor.name.isEmpty ? null : constructor.name; |
1175 return new CallNew(TypeGenerator.createType(exp.type), | 1175 return new CallNew(TypeGenerator.createType(exp.type), |
1176 args, | 1176 args, |
1177 constructorName: name, | 1177 constructorName: name, |
1178 isConst: true) | 1178 isConst: true) |
1179 ..constructor = constructor | 1179 ..constructor = constructor |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null); | 1314 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null); |
1315 | 1315 |
1316 ExecutableElement get executableContext => enclosingElement; | 1316 ExecutableElement get executableContext => enclosingElement; |
1317 | 1317 |
1318 ExecutableElement get memberContext => executableContext.memberContext; | 1318 ExecutableElement get memberContext => executableContext.memberContext; |
1319 | 1319 |
1320 bool get isLocal => true; | 1320 bool get isLocal => true; |
1321 | 1321 |
1322 LibraryElement get implementationLibrary => enclosingElement.library; | 1322 LibraryElement get implementationLibrary => enclosingElement.library; |
1323 } | 1323 } |
OLD | NEW |