OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 } | 500 } |
501 } | 501 } |
502 | 502 |
503 visitVariableDeclarationList(VariableDeclarationList node) { | 503 visitVariableDeclarationList(VariableDeclarationList node) { |
504 super.visitVariableDeclarationList(node); | 504 super.visitVariableDeclarationList(node); |
505 if (node.type == null) { | 505 if (node.type == null) { |
506 for (VariableDeclaration variable in node.variables) { | 506 for (VariableDeclaration variable in node.variables) { |
507 VariableElement element = variable.element; | 507 VariableElement element = variable.element; |
508 if (element is LocalVariableElement) { | 508 if (element is LocalVariableElement) { |
509 _recordType(variable.name.offset, element.type); | 509 _recordType(variable.name.offset, element.type); |
510 } else { | 510 } else if (!element.isStatic || element.initializer != null) { |
511 _recordTopType(variable.name.offset, element.type); | 511 _recordTopType(variable.name.offset, element.type); |
512 } | 512 } |
513 } | 513 } |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 bool _elementRequiresMethodDispatch(Element element) { | 517 bool _elementRequiresMethodDispatch(Element element) { |
518 if (element is ConstructorElement) { | 518 if (element is ConstructorElement) { |
519 return false; | 519 return false; |
520 } else if (element is ClassMemberElement) { | 520 } else if (element is ClassMemberElement) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 | 564 |
565 /// Based on DDC code generator's `_recoverTypeArguments` | 565 /// Based on DDC code generator's `_recoverTypeArguments` |
566 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { | 566 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { |
567 assert(identical(g.element, f.element)); | 567 assert(identical(g.element, f.element)); |
568 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); | 568 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); |
569 assert(g.typeFormals.length + g.typeArguments.length == | 569 assert(g.typeFormals.length + g.typeArguments.length == |
570 f.typeArguments.length); | 570 f.typeArguments.length); |
571 return f.typeArguments.skip(g.typeArguments.length); | 571 return f.typeArguments.skip(g.typeArguments.length); |
572 } | 572 } |
573 } | 573 } |
OLD | NEW |