| 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_task; | 5 library dart2js.ir_builder_task; |
| 6 | 6 |
| 7 import '../closure.dart' as closure; | 7 import '../closure.dart' as closure; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Names, | 10 Names, |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 // t1 = setRuntimeTypeInfo(allocation, TypeExpression($E)); | 911 // t1 = setRuntimeTypeInfo(allocation, TypeExpression($E)); |
| 912 // return Refinement(t1, <JSArray>); | 912 // return Refinement(t1, <JSArray>); |
| 913 // | 913 // |
| 914 assert(parameters.length == 1 || parameters.length == 2); | 914 assert(parameters.length == 1 || parameters.length == 2); |
| 915 ir.Primitive allocation = irBuilder.buildLocalGet(parameters[0]); | 915 ir.Primitive allocation = irBuilder.buildLocalGet(parameters[0]); |
| 916 ClassElement classElement = element.enclosingElement; | 916 ClassElement classElement = element.enclosingElement; |
| 917 | 917 |
| 918 // Only call setRuntimeTypeInfo if JSArray requires the type parameter. | 918 // Only call setRuntimeTypeInfo if JSArray requires the type parameter. |
| 919 if (requiresRuntimeTypes) { | 919 if (requiresRuntimeTypes) { |
| 920 assert(parameters.length == 2); | 920 assert(parameters.length == 2); |
| 921 closure.TypeVariableLocal typeParameter = parameters[1]; |
| 921 ir.Primitive typeArgument = | 922 ir.Primitive typeArgument = |
| 922 irBuilder.buildTypeVariableAccess(parameters[1].typeVariable); | 923 irBuilder.buildTypeVariableAccess(typeParameter.typeVariable); |
| 923 | 924 |
| 924 ir.Primitive typeInformation = irBuilder.addPrimitive( | 925 ir.Primitive typeInformation = irBuilder.addPrimitive( |
| 925 new ir.TypeExpression(ir.TypeExpressionKind.INSTANCE, | 926 new ir.TypeExpression(ir.TypeExpressionKind.INSTANCE, |
| 926 element.enclosingClass.thisType, | 927 element.enclosingClass.thisType, |
| 927 <ir.Primitive>[typeArgument])); | 928 <ir.Primitive>[typeArgument])); |
| 928 | 929 |
| 929 Element helper = helpers.setRuntimeTypeInfo; | 930 MethodElement helper = helpers.setRuntimeTypeInfo; |
| 930 CallStructure callStructure = CallStructure.TWO_ARGS; | 931 CallStructure callStructure = CallStructure.TWO_ARGS; |
| 931 Selector selector = new Selector.call(helper.memberName, callStructure); | 932 Selector selector = new Selector.call(helper.memberName, callStructure); |
| 932 allocation = irBuilder.buildInvokeStatic( | 933 allocation = irBuilder.buildInvokeStatic( |
| 933 helper, selector, <ir.Primitive>[allocation, typeInformation], | 934 helper, selector, <ir.Primitive>[allocation, typeInformation], |
| 934 sourceInformationBuilder.buildGeneric(node)); | 935 sourceInformationBuilder.buildGeneric(node)); |
| 935 } | 936 } |
| 936 | 937 |
| 937 ir.Primitive refinement = irBuilder.addPrimitive( | 938 ir.Primitive refinement = irBuilder.addPrimitive( |
| 938 new ir.Refinement(allocation, typeMaskSystem.arrayType)); | 939 new ir.Refinement(allocation, typeMaskSystem.arrayType)); |
| 939 | 940 |
| (...skipping 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3889 } | 3890 } |
| 3890 | 3891 |
| 3891 Element get closureConverter { | 3892 Element get closureConverter { |
| 3892 return _backend.helpers.closureConverter; | 3893 return _backend.helpers.closureConverter; |
| 3893 } | 3894 } |
| 3894 | 3895 |
| 3895 void addNativeMethod(FunctionElement function) { | 3896 void addNativeMethod(FunctionElement function) { |
| 3896 _backend.emitter.nativeEmitter.nativeMethods.add(function); | 3897 _backend.emitter.nativeEmitter.nativeMethods.add(function); |
| 3897 } | 3898 } |
| 3898 } | 3899 } |
| OLD | NEW |