| 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 | 6 import '../common/codegen.dart' show |
| 7 CodegenRegistry, | 7 CodegenRegistry, |
| 8 CodegenWorkItem; | 8 CodegenWorkItem; |
| 9 import '../common/tasks.dart' show | 9 import '../common/tasks.dart' show |
| 10 CompilerTask; | 10 CompilerTask; |
| (...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 if (node.instantiatedTypes == null) { | 1953 if (node.instantiatedTypes == null) { |
| 1954 return; | 1954 return; |
| 1955 } | 1955 } |
| 1956 node.instantiatedTypes.forEach((type) { | 1956 node.instantiatedTypes.forEach((type) { |
| 1957 registry.registerInstantiation(type); | 1957 registry.registerInstantiation(type); |
| 1958 }); | 1958 }); |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 js.Expression newLiteralBool(bool value, | 1961 js.Expression newLiteralBool(bool value, |
| 1962 SourceInformation sourceInformation) { | 1962 SourceInformation sourceInformation) { |
| 1963 if (compiler.enableMinification) { | 1963 if (compiler.options.enableMinification) { |
| 1964 // Use !0 for true, !1 for false. | 1964 // Use !0 for true, !1 for false. |
| 1965 return new js.Prefix("!", new js.LiteralNumber(value ? "0" : "1")) | 1965 return new js.Prefix("!", new js.LiteralNumber(value ? "0" : "1")) |
| 1966 .withSourceInformation(sourceInformation); | 1966 .withSourceInformation(sourceInformation); |
| 1967 } else { | 1967 } else { |
| 1968 return new js.LiteralBool(value) | 1968 return new js.LiteralBool(value) |
| 1969 .withSourceInformation(sourceInformation); | 1969 .withSourceInformation(sourceInformation); |
| 1970 } | 1970 } |
| 1971 } | 1971 } |
| 1972 | 1972 |
| 1973 void generateConstant(ConstantValue constant, | 1973 void generateConstant(ConstantValue constant, |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 } | 2780 } |
| 2781 reporter.internalError(input, 'Unexpected check: $checkedType.'); | 2781 reporter.internalError(input, 'Unexpected check: $checkedType.'); |
| 2782 return null; | 2782 return null; |
| 2783 } | 2783 } |
| 2784 | 2784 |
| 2785 void visitTypeConversion(HTypeConversion node) { | 2785 void visitTypeConversion(HTypeConversion node) { |
| 2786 if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) { | 2786 if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) { |
| 2787 ClassWorld classWorld = compiler.world; | 2787 ClassWorld classWorld = compiler.world; |
| 2788 // An int check if the input is not int or null, is not | 2788 // An int check if the input is not int or null, is not |
| 2789 // sufficient for doing an argument or receiver check. | 2789 // sufficient for doing an argument or receiver check. |
| 2790 assert(compiler.trustTypeAnnotations || | 2790 assert(compiler.options.trustTypeAnnotations || |
| 2791 !node.checkedType.containsOnlyInt(classWorld) || | 2791 !node.checkedType.containsOnlyInt(classWorld) || |
| 2792 node.checkedInput.isIntegerOrNull(compiler)); | 2792 node.checkedInput.isIntegerOrNull(compiler)); |
| 2793 js.Expression test = generateReceiverOrArgumentTypeTest( | 2793 js.Expression test = generateReceiverOrArgumentTypeTest( |
| 2794 node.checkedInput, node.checkedType); | 2794 node.checkedInput, node.checkedType); |
| 2795 js.Block oldContainer = currentContainer; | 2795 js.Block oldContainer = currentContainer; |
| 2796 js.Statement body = new js.Block.empty(); | 2796 js.Statement body = new js.Block.empty(); |
| 2797 currentContainer = body; | 2797 currentContainer = body; |
| 2798 if (node.isArgumentTypeCheck) { | 2798 if (node.isArgumentTypeCheck) { |
| 2799 generateThrowWithHelper( | 2799 generateThrowWithHelper( |
| 2800 helpers.throwIllegalArgumentException, | 2800 helpers.throwIllegalArgumentException, |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2952 new StaticUse.staticInvoke(helper, | 2952 new StaticUse.staticInvoke(helper, |
| 2953 new CallStructure.unnamed(argumentCount))); | 2953 new CallStructure.unnamed(argumentCount))); |
| 2954 return backend.emitter.staticFunctionAccess(helper); | 2954 return backend.emitter.staticFunctionAccess(helper); |
| 2955 } | 2955 } |
| 2956 | 2956 |
| 2957 @override | 2957 @override |
| 2958 void visitRef(HRef node) { | 2958 void visitRef(HRef node) { |
| 2959 visit(node.value); | 2959 visit(node.value); |
| 2960 } | 2960 } |
| 2961 } | 2961 } |
| OLD | NEW |