Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: lib/src/compiler/type_utilities.dart

Issue 2016483002: Enable strong mode in DDC, fix all warnings/errors (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 import 'dart:collection' show HashMap, HashSet; 5 import 'dart:collection' show HashMap, HashSet;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 9
10 import '../js_ast/js_ast.dart' as JS; 10 import '../js_ast/js_ast.dart' as JS;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 /// cache/generator variables discharged at the binding site for the 155 /// cache/generator variables discharged at the binding site for the
156 /// type variable since the type definition depends on the type 156 /// type variable since the type definition depends on the type
157 /// parameter. 157 /// parameter.
158 final _scopeDependencies = 158 final _scopeDependencies =
159 new HashMap<TypeParameterElement, List<DartType>>(); 159 new HashMap<TypeParameterElement, List<DartType>>();
160 160
161 /// Emit a list of statements declaring the cache variables and generator 161 /// Emit a list of statements declaring the cache variables and generator
162 /// definitions tracked by the table. If [formals] is present, only 162 /// definitions tracked by the table. If [formals] is present, only
163 /// emit the definitions which depend on the formals. 163 /// emit the definitions which depend on the formals.
164 List<JS.Statement> discharge([List<TypeParameterElement> formals]) { 164 List<JS.Statement> discharge([List<TypeParameterElement> formals]) {
165 var filter = formals?.expand((p) => _scopeDependencies[p] ?? []); 165 var filter = formals?.expand((p) => _scopeDependencies[p] ?? <DartType>[]);
Leaf 2016/05/26 17:53:38 It sure would be nice if our final inference algor
Jennifer Messerly 2016/05/26 18:11:48 Had the same thought :) filed https://github.com/
166 var stmts = [ 166 var stmts = [
167 _cacheNames, 167 _cacheNames,
168 _definiteCacheNames, 168 _definiteCacheNames,
169 _generators, 169 _generators,
170 _definiteGenerators 170 _definiteGenerators
171 ].expand((c) => c.discharge(filter)).toList(); 171 ].expand((c) => c.discharge(filter)).toList();
172 formals?.forEach(_scopeDependencies.remove); 172 formals?.forEach(_scopeDependencies.remove);
173 return stmts; 173 return stmts;
174 } 174 }
175 175
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 assert(hoistType != null); 220 assert(hoistType != null);
221 var table = hoistType 221 var table = hoistType
222 ? (definite ? _definiteGenerators : _generators) 222 ? (definite ? _definiteGenerators : _generators)
223 : (definite ? _definiteCacheNames : _cacheNames); 223 : (definite ? _definiteCacheNames : _cacheNames);
224 if (!table.isNamed(type)) { 224 if (!table.isNamed(type)) {
225 if (recordScopeDependencies(type)) return typeRep; 225 if (recordScopeDependencies(type)) return typeRep;
226 } 226 }
227 return table.nameType(type, typeRep); 227 return table.nameType(type, typeRep);
228 } 228 }
229 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698