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 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 ConstructorElement current = constructor; | 1898 ConstructorElement current = constructor; |
1899 while (current.isRedirectingFactory) { | 1899 while (current.isRedirectingFactory) { |
1900 var prefix = current.redirectionDeferredPrefix; | 1900 var prefix = current.redirectionDeferredPrefix; |
1901 if (prefix != null) buildCheckDeferredIsLoaded(prefix, send); | 1901 if (prefix != null) buildCheckDeferredIsLoaded(prefix, send); |
1902 current = current.immediateRedirectionTarget; | 1902 current = current.immediateRedirectionTarget; |
1903 } | 1903 } |
1904 } | 1904 } |
1905 | 1905 |
1906 List<ir.Primitive> arguments = argumentsNode.nodes.mapToList(visit); | 1906 List<ir.Primitive> arguments = argumentsNode.nodes.mapToList(visit); |
1907 // Use default values from the effective target, not the immediate target. | 1907 // Use default values from the effective target, not the immediate target. |
1908 ConstructorElement target = constructor.effectiveTarget; | 1908 ConstructorElement target = constructor.implementation; |
| 1909 while (target.isRedirectingFactory && !target.isCyclicRedirection) { |
| 1910 target = target.effectiveTarget.implementation; |
| 1911 } |
1909 | 1912 |
1910 callStructure = normalizeStaticArguments(callStructure, target, arguments); | 1913 callStructure = normalizeStaticArguments(callStructure, target, arguments); |
1911 TypeMask allocationSiteType; | 1914 TypeMask allocationSiteType; |
1912 | 1915 |
1913 if (Elements.isFixedListConstructorCall(constructor, send, compiler) || | 1916 if (Elements.isFixedListConstructorCall(constructor, send, compiler) || |
1914 Elements.isGrowableListConstructorCall(constructor, send, compiler) || | 1917 Elements.isGrowableListConstructorCall(constructor, send, compiler) || |
1915 Elements.isFilledListConstructorCall(constructor, send, compiler) || | 1918 Elements.isFilledListConstructorCall(constructor, send, compiler) || |
1916 Elements.isConstructorOfTypedArraySubclass(constructor, compiler)) { | 1919 Elements.isConstructorOfTypedArraySubclass(constructor, compiler)) { |
1917 allocationSiteType = getAllocationSiteType(send); | 1920 allocationSiteType = getAllocationSiteType(send); |
1918 } | 1921 } |
| 1922 ConstructorElement constructorImplementation = constructor.implementation; |
1919 return irBuilder.buildConstructorInvocation( | 1923 return irBuilder.buildConstructorInvocation( |
1920 target, | 1924 target, |
1921 callStructure, | 1925 callStructure, |
1922 constructor.computeEffectiveTargetType(type), | 1926 constructorImplementation.computeEffectiveTargetType(type), |
1923 arguments, | 1927 arguments, |
1924 sourceInformationBuilder.buildNew(node), | 1928 sourceInformationBuilder.buildNew(node), |
1925 allocationSiteType: allocationSiteType); | 1929 allocationSiteType: allocationSiteType); |
1926 } | 1930 } |
1927 | 1931 |
1928 @override | 1932 @override |
1929 ir.Primitive handleDynamicInvoke( | 1933 ir.Primitive handleDynamicInvoke( |
1930 ast.Send node, | 1934 ast.Send node, |
1931 ast.Node receiver, | 1935 ast.Node receiver, |
1932 ast.NodeList argumentsNode, | 1936 ast.NodeList argumentsNode, |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3589 } | 3593 } |
3590 | 3594 |
3591 Element get closureConverter { | 3595 Element get closureConverter { |
3592 return _backend.helpers.closureConverter; | 3596 return _backend.helpers.closureConverter; |
3593 } | 3597 } |
3594 | 3598 |
3595 void addNativeMethod(FunctionElement function) { | 3599 void addNativeMethod(FunctionElement function) { |
3596 _backend.emitter.nativeEmitter.nativeMethods.add(function); | 3600 _backend.emitter.nativeEmitter.nativeMethods.add(function); |
3597 } | 3601 } |
3598 } | 3602 } |
OLD | NEW |