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 part of dart2js; | |
6 | |
7 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); | 5 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); |
8 | 6 |
9 class BitNotOperation implements UnaryOperation { | 7 class BitNotOperation implements UnaryOperation { |
10 final SourceString name = const SourceString('~'); | 8 final SourceString name = const SourceString('~'); |
11 bool isUserDefinable() => true; | 9 bool isUserDefinable() => true; |
12 const BitNotOperation(); | 10 const BitNotOperation(); |
13 Constant fold(Constant constant) { | 11 Constant fold(Constant constant) { |
14 if (constant.isInt()) { | 12 if (constant.isInt()) { |
15 IntConstant intConstant = constant; | 13 IntConstant intConstant = constant; |
16 return DART_CONSTANT_SYSTEM.createInt(~intConstant.value); | 14 return DART_CONSTANT_SYSTEM.createInt(~intConstant.value); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 bool isInt(Constant constant) => constant.isInt(); | 362 bool isInt(Constant constant) => constant.isInt(); |
365 bool isDouble(Constant constant) => constant.isDouble(); | 363 bool isDouble(Constant constant) => constant.isDouble(); |
366 bool isString(Constant constant) => constant.isString(); | 364 bool isString(Constant constant) => constant.isString(); |
367 bool isBool(Constant constant) => constant.isBool(); | 365 bool isBool(Constant constant) => constant.isBool(); |
368 bool isNull(Constant constant) => constant.isNull(); | 366 bool isNull(Constant constant) => constant.isNull(); |
369 | 367 |
370 bool isSubtype(Compiler compiler, DartType s, DartType t) { | 368 bool isSubtype(Compiler compiler, DartType s, DartType t) { |
371 return compiler.types.isSubtype(s, t); | 369 return compiler.types.isSubtype(s, t); |
372 } | 370 } |
373 } | 371 } |
OLD | NEW |