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 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // We also use HCreate to instantiate closure classes that belong to | 1940 // We also use HCreate to instantiate closure classes that belong to |
1941 // function expressions. We have to register their use here, as otherwise | 1941 // function expressions. We have to register their use here, as otherwise |
1942 // code for them might not be emitted. | 1942 // code for them might not be emitted. |
1943 if (node.element.isClosure) { | 1943 if (node.element.isClosure) { |
1944 registry.registerInstantiatedClass(node.element); | 1944 registry.registerInstantiatedClass(node.element); |
1945 } | 1945 } |
1946 if (node.instantiatedTypes == null) { | 1946 node.instantiatedTypes?.forEach(registry.registerInstantiation); |
1947 return; | |
1948 } | |
1949 node.instantiatedTypes.forEach((type) { | |
1950 registry.registerInstantiation(type); | |
1951 }); | |
1952 } | 1947 } |
1953 | 1948 |
1954 js.Expression newLiteralBool( | 1949 js.Expression newLiteralBool( |
1955 bool value, SourceInformation sourceInformation) { | 1950 bool value, SourceInformation sourceInformation) { |
1956 if (compiler.options.enableMinification) { | 1951 if (compiler.options.enableMinification) { |
1957 // Use !0 for true, !1 for false. | 1952 // Use !0 for true, !1 for false. |
1958 return new js.Prefix("!", new js.LiteralNumber(value ? "0" : "1")) | 1953 return new js.Prefix("!", new js.LiteralNumber(value ? "0" : "1")) |
1959 .withSourceInformation(sourceInformation); | 1954 .withSourceInformation(sourceInformation); |
1960 } else { | 1955 } else { |
1961 return new js.LiteralBool(value).withSourceInformation(sourceInformation); | 1956 return new js.LiteralBool(value).withSourceInformation(sourceInformation); |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2989 registry.registerStaticUse(new StaticUse.staticInvoke( | 2984 registry.registerStaticUse(new StaticUse.staticInvoke( |
2990 helper, new CallStructure.unnamed(argumentCount))); | 2985 helper, new CallStructure.unnamed(argumentCount))); |
2991 return backend.emitter.staticFunctionAccess(helper); | 2986 return backend.emitter.staticFunctionAccess(helper); |
2992 } | 2987 } |
2993 | 2988 |
2994 @override | 2989 @override |
2995 void visitRef(HRef node) { | 2990 void visitRef(HRef node) { |
2996 visit(node.value); | 2991 visit(node.value); |
2997 } | 2992 } |
2998 } | 2993 } |
OLD | NEW |