Chromium Code Reviews

Side by Side Diff: lib/src/checker/rules.dart

Issue 1355893003: Rewire DDC to use the analyzer task model (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix for identifiers Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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
(...skipping 181 matching lines...)
192 : _nonnullableTypes = <DartType>[], 192 : _nonnullableTypes = <DartType>[],
193 super(provider) { 193 super(provider) {
194 var types = options.nonnullableTypes; 194 var types = options.nonnullableTypes;
195 _nonnullableTypes.addAll(types.map(_typeFromName)); 195 _nonnullableTypes.addAll(types.map(_typeFromName));
196 inferrer = new DownwardsInference(this); 196 inferrer = new DownwardsInference(this);
197 } 197 }
198 198
199 DartType getStaticType(Expression expr) { 199 DartType getStaticType(Expression expr) {
200 var type = expr.staticType; 200 var type = expr.staticType;
201 if (type != null) return type; 201 if (type != null) return type;
202 if (expr is SimpleIdentifier) {
vsm 2015/09/18 23:32:12 Brian / Leaf - any suggestions on the right code h
Jennifer Messerly 2015/09/19 00:18:46 FYI, at least one place this used to happen was th
Jennifer Messerly 2015/09/19 00:23:38 To clarify that: Given `obj.method(args)` analyz
Leaf 2015/09/21 17:15:59 I didn't port that line over because I was a littl
Brian Wilkerson 2015/09/24 19:41:01 Seems to me that we should change analyzer to alwa
Leaf 2015/09/24 19:48:21 I think the change on line 633 of this CL https://
Brian Wilkerson 2015/09/24 21:17:48 Yes. I think I made a comment to that effect in th
203 type = expr.staticElement?.type;
204 if (type != null) return type;
205 }
202 if (reportMissingType != null) reportMissingType(expr); 206 if (reportMissingType != null) reportMissingType(expr);
203 return provider.dynamicType; 207 return provider.dynamicType;
204 } 208 }
205 209
206 bool _isBottom(DartType t, {bool dynamicIsBottom: false}) { 210 bool _isBottom(DartType t, {bool dynamicIsBottom: false}) {
207 if (t.isDynamic && dynamicIsBottom) return true; 211 if (t.isDynamic && dynamicIsBottom) return true;
208 // TODO(vsm): We need direct support for non-nullability in DartType. 212 // TODO(vsm): We need direct support for non-nullability in DartType.
209 // This should check on "true/nonnullable" Bottom 213 // This should check on "true/nonnullable" Bottom
210 if (t.isBottom && _nonnullableTypes.isEmpty) return true; 214 if (t.isBottom && _nonnullableTypes.isEmpty) return true;
211 return false; 215 return false;
(...skipping 626 matching lines...)
838 var entries = e.entries; 842 var entries = e.entries;
839 bool inferEntry(MapLiteralEntry entry) { 843 bool inferEntry(MapLiteralEntry entry) {
840 return _inferExpression(entry.key, kType, errors) && 844 return _inferExpression(entry.key, kType, errors) &&
841 _inferExpression(entry.value, vType, errors); 845 _inferExpression(entry.value, vType, errors);
842 } 846 }
843 var b = entries.every(inferEntry); 847 var b = entries.every(inferEntry);
844 if (b) annotateMapLiteral(e, targs); 848 if (b) annotateMapLiteral(e, targs);
845 return b; 849 return b;
846 } 850 }
847 } 851 }
OLDNEW

Powered by Google App Engine