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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2456803004: fixes #27586, prefer context type in generic inference (Closed)
Patch Set: more tweaks Created 4 years 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 2
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 import 'dart:collection' show HashMap, HashSet; 6 import 'dart:collection' show HashMap, HashSet;
7 import 'dart:math' show min, max; 7 import 'dart:math' show min, max;
8 8
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 5344 matching lines...) Expand 10 before | Expand all | Expand 10 after
5355 // TODO(jmesserly): verify this is unreachable. 5355 // TODO(jmesserly): verify this is unreachable.
5356 throw 'Unimplemented ${node.runtimeType}: $node'; 5356 throw 'Unimplemented ${node.runtimeType}: $node';
5357 } 5357 }
5358 5358
5359 _visit(AstNode node) { 5359 _visit(AstNode node) {
5360 if (node == null) return null; 5360 if (node == null) return null;
5361 var result = node.accept(this); 5361 var result = node.accept(this);
5362 return result is JS.Node ? annotate(result, node) : result; 5362 return result is JS.Node ? annotate(result, node) : result;
5363 } 5363 }
5364 5364
5365 List/*<T>*/ _visitList/*<T extends AstNode>*/(Iterable/*<T>*/ nodes) { 5365 // TODO(jmesserly): we should make sure this only returns JS AST nodes.
5366 List/*<T>*/ _visitList/*<T>*/(Iterable nodes) {
vsm 2016/11/30 04:05:33 Why was this change needed?
Jennifer Messerly 2016/11/30 04:35:04 the type was completely wrong before. It's mixing
5366 if (nodes == null) return null; 5367 if (nodes == null) return null;
5367 var result = /*<T>*/ []; 5368 var result = /*<T>*/ [];
5368 for (var node in nodes) result.add(_visit(node) as dynamic/*=T*/); 5369 for (var node in nodes) result.add(_visit(node) as dynamic/*=T*/);
5369 return result; 5370 return result;
5370 } 5371 }
5371 5372
5372 /// Visits a list of expressions, creating a comma expression if needed in JS. 5373 /// Visits a list of expressions, creating a comma expression if needed in JS.
5373 JS.Expression _visitListToBinary(List<Expression> nodes, String operator) { 5374 JS.Expression _visitListToBinary(List<Expression> nodes, String operator) {
5374 if (nodes == null || nodes.isEmpty) return null; 5375 if (nodes == null || nodes.isEmpty) return null;
5375 return new JS.Expression.binary( 5376 return new JS.Expression.binary(
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
5765 var targetIdentifier = target as SimpleIdentifier; 5766 var targetIdentifier = target as SimpleIdentifier;
5766 5767
5767 if (targetIdentifier.staticElement is! PrefixElement) return false; 5768 if (targetIdentifier.staticElement is! PrefixElement) return false;
5768 var prefix = targetIdentifier.staticElement as PrefixElement; 5769 var prefix = targetIdentifier.staticElement as PrefixElement;
5769 5770
5770 // The library the prefix is referring to must come from a deferred import. 5771 // The library the prefix is referring to must come from a deferred import.
5771 var containingLibrary = (target.root as CompilationUnit).element.library; 5772 var containingLibrary = (target.root as CompilationUnit).element.library;
5772 var imports = containingLibrary.getImportsWithPrefix(prefix); 5773 var imports = containingLibrary.getImportsWithPrefix(prefix);
5773 return imports.length == 1 && imports[0].isDeferred; 5774 return imports.length == 1 && imports[0].isDeferred;
5774 } 5775 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698