| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Defines static information collected by the type checker and used later by | 5 /// Defines static information collected by the type checker and used later by |
| 6 /// emitters to generate code. | 6 /// emitters to generate code. |
| 7 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be | 7 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be |
| 8 // refactored to fit into analyzer. | 8 // refactored to fit into analyzer. |
| 9 library analyzer.src.task.strong.info; | 9 library analyzer.src.task.strong.info; |
| 10 | 10 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 : super(rules, expression); | 205 : super(rules, expression); |
| 206 DartType get convertedType => DynamicTypeImpl.instance; | 206 DartType get convertedType => DynamicTypeImpl.instance; |
| 207 String get message => '{0} requires dynamic invoke'; | 207 String get message => '{0} requires dynamic invoke'; |
| 208 | 208 |
| 209 @override | 209 @override |
| 210 String get name => 'STRONG_MODE_DYNAMIC_INVOKE'; | 210 String get name => 'STRONG_MODE_DYNAMIC_INVOKE'; |
| 211 | 211 |
| 212 toErrorCode() => new HintCode(name, message); | 212 toErrorCode() => new HintCode(name, message); |
| 213 | 213 |
| 214 /// Whether this [node] is the target of a dynamic operation. | 214 /// Whether this [node] is the target of a dynamic operation. |
| 215 static bool get(AstNode node) { | 215 static bool get(AstNode node) => node.getProperty(_propertyName) ?? false; |
| 216 var value = node.getProperty(_propertyName); | |
| 217 return value != null ? value : false; | |
| 218 } | |
| 219 | 216 |
| 220 /// Sets whether this node is the target of a dynamic operation. | 217 /// Sets whether this node is the target of a dynamic operation. |
| 221 static bool set(AstNode node, bool value) { | 218 static bool set(AstNode node, bool value) { |
| 222 // Free the storage for things that aren't dynamic. | 219 // Free the storage for things that aren't dynamic. |
| 223 if (value == false) value = null; | 220 if (value == false) value = null; |
| 224 node.setProperty(_propertyName, value); | 221 node.setProperty(_propertyName, value); |
| 225 return value; | 222 return value; |
| 226 } | 223 } |
| 227 } | 224 } |
| 228 | 225 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 super(expression); | 538 super(expression); |
| 542 | 539 |
| 543 @override | 540 @override |
| 544 List<Object> get arguments => [node, baseType, expectedType]; | 541 List<Object> get arguments => [node, baseType, expectedType]; |
| 545 @override | 542 @override |
| 546 String get message => 'Type check failed: {0} ({1}) is not of type {2}'; | 543 String get message => 'Type check failed: {0} ({1}) is not of type {2}'; |
| 547 | 544 |
| 548 @override | 545 @override |
| 549 String get name => 'STRONG_MODE_STATIC_TYPE_ERROR'; | 546 String get name => 'STRONG_MODE_STATIC_TYPE_ERROR'; |
| 550 } | 547 } |
| OLD | NEW |