| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.ir_builder; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../constants/values.dart' show PrimitiveConstantValue; | 8 import '../constants/values.dart' show PrimitiveConstantValue; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../dart2jslib.dart'; | 10 import '../dart2jslib.dart'; |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 _buildInvokeStatic( | 822 _buildInvokeStatic( |
| 823 element, selector, <ir.Primitive>[value], sourceInformation); | 823 element, selector, <ir.Primitive>[value], sourceInformation); |
| 824 return value; | 824 return value; |
| 825 } | 825 } |
| 826 | 826 |
| 827 /// Create a constructor invocation of [element] on [type] where the | 827 /// Create a constructor invocation of [element] on [type] where the |
| 828 /// constructor name and argument structure are defined by [selector] and the | 828 /// constructor name and argument structure are defined by [selector] and the |
| 829 /// argument values are defined by [arguments]. | 829 /// argument values are defined by [arguments]. |
| 830 ir.Primitive buildConstructorInvocation(FunctionElement element, | 830 ir.Primitive buildConstructorInvocation(FunctionElement element, |
| 831 Selector selector, | 831 Selector selector, |
| 832 InterfaceType type, | 832 DartType type, |
| 833 List<ir.Primitive> arguments); | 833 List<ir.Primitive> arguments); |
| 834 | 834 |
| 835 /// Create a string concatenation of the [arguments]. | 835 /// Create a string concatenation of the [arguments]. |
| 836 ir.Primitive buildStringConcatenation(List<ir.Primitive> arguments) { | 836 ir.Primitive buildStringConcatenation(List<ir.Primitive> arguments) { |
| 837 assert(isOpen); | 837 assert(isOpen); |
| 838 return _continueWithExpression( | 838 return _continueWithExpression( |
| 839 (k) => new ir.ConcatenateStrings(k, arguments)); | 839 (k) => new ir.ConcatenateStrings(k, arguments)); |
| 840 } | 840 } |
| 841 | 841 |
| 842 /// Create an invocation of the `call` method of [functionExpression], where | 842 /// Create an invocation of the `call` method of [functionExpression], where |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 | 2162 |
| 2163 ir.Primitive buildSuperInvocation(Element target, | 2163 ir.Primitive buildSuperInvocation(Element target, |
| 2164 Selector selector, | 2164 Selector selector, |
| 2165 List<ir.Primitive> arguments) { | 2165 List<ir.Primitive> arguments) { |
| 2166 return _buildInvokeSuper(target, selector, arguments); | 2166 return _buildInvokeSuper(target, selector, arguments); |
| 2167 } | 2167 } |
| 2168 | 2168 |
| 2169 @override | 2169 @override |
| 2170 ir.Primitive buildConstructorInvocation(FunctionElement element, | 2170 ir.Primitive buildConstructorInvocation(FunctionElement element, |
| 2171 Selector selector, | 2171 Selector selector, |
| 2172 InterfaceType type, | 2172 DartType type, |
| 2173 List<ir.Primitive> arguments) { | 2173 List<ir.Primitive> arguments) { |
| 2174 assert(isOpen); | 2174 assert(isOpen); |
| 2175 return _continueWithExpression( | 2175 return _continueWithExpression( |
| 2176 (k) => new ir.InvokeConstructor(type, element, selector, k, | 2176 (k) => new ir.InvokeConstructor(type, element, selector, k, |
| 2177 arguments)); | 2177 arguments)); |
| 2178 } | 2178 } |
| 2179 } | 2179 } |
| 2180 | 2180 |
| 2181 /// State shared between JsIrBuilders within the same function. | 2181 /// State shared between JsIrBuilders within the same function. |
| 2182 /// | 2182 /// |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 state.functionParameters.add(parameter); | 2451 state.functionParameters.add(parameter); |
| 2452 } | 2452 } |
| 2453 if (closureScope != null) { | 2453 if (closureScope != null) { |
| 2454 jsState.boxedVariables.addAll(closureScope.capturedVariables); | 2454 jsState.boxedVariables.addAll(closureScope.capturedVariables); |
| 2455 } | 2455 } |
| 2456 } | 2456 } |
| 2457 | 2457 |
| 2458 @override | 2458 @override |
| 2459 ir.Primitive buildConstructorInvocation(ConstructorElement element, | 2459 ir.Primitive buildConstructorInvocation(ConstructorElement element, |
| 2460 Selector selector, | 2460 Selector selector, |
| 2461 InterfaceType type, | 2461 DartType type, |
| 2462 List<ir.Primitive> arguments) { | 2462 List<ir.Primitive> arguments) { |
| 2463 assert(isOpen); | 2463 assert(isOpen); |
| 2464 | 2464 |
| 2465 ClassElement cls = element.enclosingClass; | 2465 ClassElement cls = element.enclosingClass; |
| 2466 if (program.requiresRuntimeTypesFor(cls)) { | 2466 if (program.requiresRuntimeTypesFor(cls)) { |
| 2467 InterfaceType interface = type; |
| 2467 Iterable<ir.Primitive> typeArguments = | 2468 Iterable<ir.Primitive> typeArguments = |
| 2468 type.typeArguments.map((DartType argument) { | 2469 interface.typeArguments.map((DartType argument) { |
| 2469 return type.treatAsRaw | 2470 return type.treatAsRaw |
| 2470 ? buildNullLiteral() | 2471 ? buildNullLiteral() |
| 2471 : buildTypeExpression(argument); | 2472 : buildTypeExpression(argument); |
| 2472 }); | 2473 }); |
| 2473 arguments = new List<ir.Primitive>.from(arguments) | 2474 arguments = new List<ir.Primitive>.from(arguments) |
| 2474 ..addAll(typeArguments); | 2475 ..addAll(typeArguments); |
| 2475 } | 2476 } |
| 2476 return _continueWithExpression( | 2477 return _continueWithExpression( |
| 2477 (k) => new ir.InvokeConstructor(type, element, selector, k, | 2478 (k) => new ir.InvokeConstructor(type, element, selector, k, |
| 2478 arguments)); | 2479 arguments)); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2584 } | 2585 } |
| 2585 | 2586 |
| 2586 /// Synthetic parameter to a JavaScript factory method that takes the type | 2587 /// Synthetic parameter to a JavaScript factory method that takes the type |
| 2587 /// argument given for the type variable [variable]. | 2588 /// argument given for the type variable [variable]. |
| 2588 class TypeInformationParameter implements Local { | 2589 class TypeInformationParameter implements Local { |
| 2589 final TypeVariableElement variable; | 2590 final TypeVariableElement variable; |
| 2590 final ExecutableElement executableContext; | 2591 final ExecutableElement executableContext; |
| 2591 TypeInformationParameter(this.variable, this.executableContext); | 2592 TypeInformationParameter(this.variable, this.executableContext); |
| 2592 String get name => variable.name; | 2593 String get name => variable.name; |
| 2593 } | 2594 } |
| OLD | NEW |