OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import '../common.dart'; | 5 import '../common.dart'; |
6 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 6 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 } | 1924 } |
1925 push(node.codeTemplate | 1925 push(node.codeTemplate |
1926 .instantiate(interpolatedExpressions) | 1926 .instantiate(interpolatedExpressions) |
1927 .withSourceInformation(node.sourceInformation)); | 1927 .withSourceInformation(node.sourceInformation)); |
1928 } | 1928 } |
1929 | 1929 |
1930 // TODO(sra): Tell world.nativeEnqueuer about the types created here. | 1930 // TODO(sra): Tell world.nativeEnqueuer about the types created here. |
1931 registerForeignTypes(node); | 1931 registerForeignTypes(node); |
1932 } | 1932 } |
1933 | 1933 |
1934 visitForeignNew(HForeignNew node) { | 1934 visitCreate(HCreate node) { |
1935 js.Expression jsClassReference = | 1935 js.Expression jsClassReference = |
1936 backend.emitter.constructorAccess(node.element); | 1936 backend.emitter.constructorAccess(node.element); |
1937 List<js.Expression> arguments = visitArguments(node.inputs, start: 0); | 1937 List<js.Expression> arguments = visitArguments(node.inputs, start: 0); |
1938 push(new js.New(jsClassReference, arguments) | 1938 push(new js.New(jsClassReference, arguments) |
1939 .withSourceInformation(node.sourceInformation)); | 1939 .withSourceInformation(node.sourceInformation)); |
1940 registerForeignTypes(node); | 1940 // We also use HCreate to instantiate closure classes that belong to |
1941 // We also use ForeignNew to instantiate closure classes that belong to | |
1942 // function expressions. We have to register their use here, as otherwise | 1941 // function expressions. We have to register their use here, as otherwise |
1943 // code for them might not be emitted. | 1942 // code for them might not be emitted. |
1944 if (node.element.isClosure) { | 1943 if (node.element.isClosure) { |
1945 registry.registerInstantiatedClass(node.element); | 1944 registry.registerInstantiatedClass(node.element); |
1946 } | 1945 } |
1947 if (node.instantiatedTypes == null) { | 1946 if (node.instantiatedTypes == null) { |
1948 return; | 1947 return; |
1949 } | 1948 } |
1950 node.instantiatedTypes.forEach((type) { | 1949 node.instantiatedTypes.forEach((type) { |
1951 registry.registerInstantiation(type); | 1950 registry.registerInstantiation(type); |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2990 registry.registerStaticUse(new StaticUse.staticInvoke( | 2989 registry.registerStaticUse(new StaticUse.staticInvoke( |
2991 helper, new CallStructure.unnamed(argumentCount))); | 2990 helper, new CallStructure.unnamed(argumentCount))); |
2992 return backend.emitter.staticFunctionAccess(helper); | 2991 return backend.emitter.staticFunctionAccess(helper); |
2993 } | 2992 } |
2994 | 2993 |
2995 @override | 2994 @override |
2996 void visitRef(HRef node) { | 2995 void visitRef(HRef node) { |
2997 visit(node.value); | 2996 visit(node.value); |
2998 } | 2997 } |
2999 } | 2998 } |
OLD | NEW |