| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 code_generator; | 5 library code_generator; |
| 6 | 6 |
| 7 import 'glue.dart'; | 7 import 'glue.dart'; |
| 8 | 8 |
| 9 import '../../closure.dart' show | 9 import '../../closure.dart' show |
| 10 ClosureClassElement; | 10 ClosureClassElement; |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 case BuiltinOperator.IsNumber: | 1120 case BuiltinOperator.IsNumber: |
| 1121 return js.js('typeof # === "number"', args); | 1121 return js.js('typeof # === "number"', args); |
| 1122 case BuiltinOperator.IsNotNumber: | 1122 case BuiltinOperator.IsNotNumber: |
| 1123 return js.js('typeof # !== "number"', args); | 1123 return js.js('typeof # !== "number"', args); |
| 1124 case BuiltinOperator.IsFloor: | 1124 case BuiltinOperator.IsFloor: |
| 1125 return js.js('Math.floor(#) === #', args); | 1125 return js.js('Math.floor(#) === #', args); |
| 1126 case BuiltinOperator.IsInteger: | 1126 case BuiltinOperator.IsInteger: |
| 1127 return js.js('typeof # === "number" && Math.floor(#) === #', args); | 1127 return js.js('typeof # === "number" && Math.floor(#) === #', args); |
| 1128 case BuiltinOperator.IsNotInteger: | 1128 case BuiltinOperator.IsNotInteger: |
| 1129 return js.js('typeof # !== "number" || Math.floor(#) !== #', args); | 1129 return js.js('typeof # !== "number" || Math.floor(#) !== #', args); |
| 1130 case BuiltinOperator.IsUnsigned32BitInteger: |
| 1131 return js.js('# >>> 0 === #', args); |
| 1132 case BuiltinOperator.IsNotUnsigned32BitInteger: |
| 1133 return js.js('# >>> 0 !== #', args); |
| 1130 case BuiltinOperator.IsFixedLengthJSArray: | 1134 case BuiltinOperator.IsFixedLengthJSArray: |
| 1131 // TODO(sra): Remove boolify (i.e. !!). | 1135 // TODO(sra): Remove boolify (i.e. !!). |
| 1132 return js.js(r'!!#.fixed$length', args); | 1136 return js.js(r'!!#.fixed$length', args); |
| 1133 case BuiltinOperator.IsExtendableJSArray: | 1137 case BuiltinOperator.IsExtendableJSArray: |
| 1134 return js.js(r'!#.fixed$length', args); | 1138 return js.js(r'!#.fixed$length', args); |
| 1135 case BuiltinOperator.IsModifiableJSArray: | 1139 case BuiltinOperator.IsModifiableJSArray: |
| 1136 return js.js(r'!#.immutable$list', args); | 1140 return js.js(r'!#.immutable$list', args); |
| 1137 case BuiltinOperator.IsUnmodifiableJSArray: | 1141 case BuiltinOperator.IsUnmodifiableJSArray: |
| 1138 // TODO(sra): Remove boolify (i.e. !!). | 1142 // TODO(sra): Remove boolify (i.e. !!). |
| 1139 return js.js(r'!!#.immutable$list', args); | 1143 return js.js(r'!!#.immutable$list', args); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 void registerDefaultParameterValues(ExecutableElement element) { | 1243 void registerDefaultParameterValues(ExecutableElement element) { |
| 1240 if (element is! FunctionElement) return; | 1244 if (element is! FunctionElement) return; |
| 1241 FunctionElement function = element; | 1245 FunctionElement function = element; |
| 1242 if (function.isStatic) return; // Defaults are inlined at call sites. | 1246 if (function.isStatic) return; // Defaults are inlined at call sites. |
| 1243 function.functionSignature.forEachOptionalParameter((param) { | 1247 function.functionSignature.forEachOptionalParameter((param) { |
| 1244 ConstantValue constant = glue.getDefaultParameterValue(param); | 1248 ConstantValue constant = glue.getDefaultParameterValue(param); |
| 1245 registry.registerCompileTimeConstant(constant); | 1249 registry.registerCompileTimeConstant(constant); |
| 1246 }); | 1250 }); |
| 1247 } | 1251 } |
| 1248 } | 1252 } |
| OLD | NEW |