| 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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 case BuiltinOperator.IsFalsy: | 1118 case BuiltinOperator.IsFalsy: |
| 1119 return new js.Prefix('!', args[0]); | 1119 return new js.Prefix('!', args[0]); |
| 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.IsNumberAndFloor: | 1126 case BuiltinOperator.IsNumberAndFloor: |
| 1127 return js.js('typeof # === "number" && Math.floor(#) === #', args); | 1127 return js.js('typeof # === "number" && Math.floor(#) === #', args); |
| 1128 case BuiltinOperator.IsNotInteger: |
| 1129 return js.js('typeof # !== "number" || Math.floor(#) !== #', args); |
| 1128 case BuiltinOperator.IsFixedLengthJSArray: | 1130 case BuiltinOperator.IsFixedLengthJSArray: |
| 1129 // TODO(sra): Remove boolify (i.e. !!). | 1131 // TODO(sra): Remove boolify (i.e. !!). |
| 1130 return js.js(r'!!#.fixed$length', args); | 1132 return js.js(r'!!#.fixed$length', args); |
| 1131 case BuiltinOperator.IsExtendableJSArray: | 1133 case BuiltinOperator.IsExtendableJSArray: |
| 1132 return js.js(r'!#.fixed$length', args); | 1134 return js.js(r'!#.fixed$length', args); |
| 1133 case BuiltinOperator.IsModifiableJSArray: | 1135 case BuiltinOperator.IsModifiableJSArray: |
| 1134 return js.js(r'!#.immutable$list', args); | 1136 return js.js(r'!#.immutable$list', args); |
| 1135 case BuiltinOperator.IsUnmodifiableJSArray: | 1137 case BuiltinOperator.IsUnmodifiableJSArray: |
| 1136 // TODO(sra): Remove boolify (i.e. !!). | 1138 // TODO(sra): Remove boolify (i.e. !!). |
| 1137 return js.js(r'!!#.immutable$list', args); | 1139 return js.js(r'!!#.immutable$list', args); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 void registerDefaultParameterValues(ExecutableElement element) { | 1239 void registerDefaultParameterValues(ExecutableElement element) { |
| 1238 if (element is! FunctionElement) return; | 1240 if (element is! FunctionElement) return; |
| 1239 FunctionElement function = element; | 1241 FunctionElement function = element; |
| 1240 if (function.isStatic) return; // Defaults are inlined at call sites. | 1242 if (function.isStatic) return; // Defaults are inlined at call sites. |
| 1241 function.functionSignature.forEachOptionalParameter((param) { | 1243 function.functionSignature.forEachOptionalParameter((param) { |
| 1242 ConstantValue constant = glue.getDefaultParameterValue(param); | 1244 ConstantValue constant = glue.getDefaultParameterValue(param); |
| 1243 registry.registerCompileTimeConstant(constant); | 1245 registry.registerCompileTimeConstant(constant); |
| 1244 }); | 1246 }); |
| 1245 } | 1247 } |
| 1246 } | 1248 } |
| OLD | NEW |