| 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 library dev_compiler.src.checker.rules; | 5 library dev_compiler.src.checker.rules; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/resolver.dart'; | 9 import 'package:analyzer/src/generated/resolver.dart'; |
| 10 | 10 |
| 11 import 'package:dev_compiler/src/info.dart'; | 11 import 'package:dev_compiler/src/info.dart'; |
| 12 import 'package:dev_compiler/src/options.dart'; | 12 import 'package:dev_compiler/src/options.dart'; |
| 13 import 'package:dev_compiler/src/utils.dart' as utils; | 13 import 'package:dev_compiler/src/utils.dart' as utils; |
| 14 | 14 |
| 15 abstract class TypeRules { | 15 abstract class TypeRules { |
| 16 final TypeProvider provider; | 16 final TypeProvider provider; |
| 17 LibraryInfo currentLibraryInfo = null; | 17 LibraryInfo currentLibraryInfo = null; |
| 18 | 18 |
| 19 TypeRules(TypeProvider this.provider); | 19 /// Map of fields / properties / methods on Object. |
| 20 final Map<String, DartType> objectMembers; |
| 21 |
| 22 TypeRules(TypeProvider provider) |
| 23 : provider = provider, |
| 24 objectMembers = utils.getObjectMemberMap(provider); |
| 20 | 25 |
| 21 MissingTypeReporter reportMissingType; | 26 MissingTypeReporter reportMissingType; |
| 22 | 27 |
| 23 bool isSubTypeOf(DartType t1, DartType t2); | 28 bool isSubTypeOf(DartType t1, DartType t2); |
| 24 bool isAssignable(DartType t1, DartType t2); | 29 bool isAssignable(DartType t1, DartType t2); |
| 25 | 30 |
| 26 bool isGroundType(DartType t) => true; | 31 bool isGroundType(DartType t) => true; |
| 27 // TODO(vsm): The default implementation is not ignoring the return type, | 32 // TODO(vsm): The default implementation is not ignoring the return type, |
| 28 // only the restricted override is. | 33 // only the restricted override is. |
| 29 bool isFunctionSubTypeOf(FunctionType f1, FunctionType f2, | 34 bool isFunctionSubTypeOf(FunctionType f1, FunctionType f2, |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 var entries = e.entries; | 844 var entries = e.entries; |
| 840 bool inferEntry(MapLiteralEntry entry) { | 845 bool inferEntry(MapLiteralEntry entry) { |
| 841 return _inferExpression(entry.key, kType, errors) && | 846 return _inferExpression(entry.key, kType, errors) && |
| 842 _inferExpression(entry.value, vType, errors); | 847 _inferExpression(entry.value, vType, errors); |
| 843 } | 848 } |
| 844 var b = entries.every(inferEntry); | 849 var b = entries.every(inferEntry); |
| 845 if (b) annotateMapLiteral(e, targs); | 850 if (b) annotateMapLiteral(e, targs); |
| 846 return b; | 851 return b; |
| 847 } | 852 } |
| 848 } | 853 } |
| OLD | NEW |