| 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; | 5 library dart2js.ir_builder; |
| 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, |
| 11 Selectors; | 11 Selectors; |
| 12 import '../compile_time_constants.dart' show | 12 import '../compile_time_constants.dart' show |
| 13 BackendConstantEnvironment; | 13 BackendConstantEnvironment; |
| 14 import '../constants/constant_system.dart'; | 14 import '../constants/constant_system.dart'; |
| 15 import '../constants/values.dart' show | 15 import '../constants/values.dart' show |
| 16 ConstantValue, | 16 ConstantValue, |
| 17 PrimitiveConstantValue; | 17 PrimitiveConstantValue; |
| 18 import '../dart_types.dart'; | 18 import '../dart_types.dart'; |
| 19 import '../elements/elements.dart'; | 19 import '../elements/elements.dart'; |
| 20 import '../io/source_information.dart'; | 20 import '../io/source_information.dart'; |
| 21 import '../js/js.dart' as js show | 21 import '../js/js.dart' as js show |
| 22 js, | 22 js, |
| 23 objectLiteral, | 23 objectLiteral, |
| 24 Expression, |
| 24 LiteralStatement, | 25 LiteralStatement, |
| 25 Template, | 26 Template, |
| 26 InterpolatedExpression, | 27 InterpolatedExpression, |
| 27 isIdentityTemplate; | 28 isIdentityTemplate; |
| 28 import '../native/native.dart' show | 29 import '../native/native.dart' show |
| 29 NativeBehavior; | 30 NativeBehavior; |
| 30 import '../tree/tree.dart' as ast; | 31 import '../tree/tree.dart' as ast; |
| 31 import '../types/types.dart' show | 32 import '../types/types.dart' show |
| 32 TypeMask; | 33 TypeMask; |
| 33 import '../universe/call_structure.dart' show | 34 import '../universe/call_structure.dart' show |
| (...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2065 // its value. | 2066 // its value. |
| 2066 ir.Primitive value = buildForeignCode( | 2067 ir.Primitive value = buildForeignCode( |
| 2067 js.js.uncachedExpressionTemplate(code), | 2068 js.js.uncachedExpressionTemplate(code), |
| 2068 arguments, | 2069 arguments, |
| 2069 behavior, | 2070 behavior, |
| 2070 type: program.getTypeMaskForNativeFunction(function)); | 2071 type: program.getTypeMaskForNativeFunction(function)); |
| 2071 buildReturn(value: value, sourceInformation: source); | 2072 buildReturn(value: value, sourceInformation: source); |
| 2072 } | 2073 } |
| 2073 | 2074 |
| 2074 static _isNotNull(ir.Primitive value) => | 2075 static _isNotNull(ir.Primitive value) => |
| 2075 value is! ir.Constant || !value.value.isNull; | 2076 !(value is ir.Constant && value.value.isNull); |
| 2076 | 2077 |
| 2077 /// Builds a call to a resolved js-interop element. | 2078 /// Builds a call to a resolved js-interop element. |
| 2078 ir.Primitive buildInvokeJsInteropMember(FunctionElement element, | 2079 ir.Primitive buildInvokeJsInteropMember(FunctionElement element, |
| 2079 List<ir.Primitive> arguments) { | 2080 List<ir.Primitive> arguments) { |
| 2080 program.addNativeMethod(element); | 2081 program.addNativeMethod(element); |
| 2081 String target = program.getJsInteropTargetPath(element); | 2082 String target = program.getJsInteropTargetPath(element); |
| 2082 // Strip off trailing arguments that were not specified. | 2083 // Strip off trailing arguments that were not specified. |
| 2083 // TODO(jacobr,sigmund): assert that the trailing arguments are all null. | 2084 // TODO(jacobr,sigmund): assert that the trailing arguments are all null. |
| 2084 // TODO(jacobr): rewrite named arguments to an object literal matching | 2085 // TODO(jacobr): rewrite named arguments to an object literal matching |
| 2085 // the factory constructor case. | 2086 // the factory constructor case. |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2935 this.stackTraceVariable, | 2936 this.stackTraceVariable, |
| 2936 this.buildCatchBlock}); | 2937 this.buildCatchBlock}); |
| 2937 } | 2938 } |
| 2938 | 2939 |
| 2939 class SwitchCaseInfo { | 2940 class SwitchCaseInfo { |
| 2940 final SubbuildFunction buildCondition; | 2941 final SubbuildFunction buildCondition; |
| 2941 final SubbuildFunction buildBody; | 2942 final SubbuildFunction buildBody; |
| 2942 | 2943 |
| 2943 SwitchCaseInfo(this.buildCondition, this.buildBody); | 2944 SwitchCaseInfo(this.buildCondition, this.buildBody); |
| 2944 } | 2945 } |
| OLD | NEW |