| 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/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 _recordMethodTarget(node.operator.charOffset, node.staticElement); | 318 _recordMethodTarget(node.operator.charOffset, node.staticElement); |
| 319 } | 319 } |
| 320 | 320 |
| 321 visitSimpleIdentifier(SimpleIdentifier node) { | 321 visitSimpleIdentifier(SimpleIdentifier node) { |
| 322 super.visitSimpleIdentifier(node); | 322 super.visitSimpleIdentifier(node); |
| 323 Element element = node.staticElement; | 323 Element element = node.staticElement; |
| 324 void recordPromotions(DartType elementType) { | 324 void recordPromotions(DartType elementType) { |
| 325 if (node.inGetterContext() && !node.inDeclarationContext()) { | 325 if (node.inGetterContext() && !node.inDeclarationContext()) { |
| 326 int offset = node.offset; | 326 int offset = node.offset; |
| 327 DartType type = node.staticType; | 327 DartType type = node.staticType; |
| 328 if (identical(type, elementType)) { | 328 if (!identical(type, elementType)) { |
| 329 _instrumentation.record(uri, offset, 'promotedType', | |
| 330 const fasta.InstrumentationValueLiteral('none')); | |
| 331 } else { | |
| 332 _instrumentation.record(uri, offset, 'promotedType', | 329 _instrumentation.record(uri, offset, 'promotedType', |
| 333 new _InstrumentationValueForType(type)); | 330 new _InstrumentationValueForType(type)); |
| 334 } | 331 } |
| 335 } | 332 } |
| 336 } | 333 } |
| 337 | 334 |
| 338 if (element is LocalVariableElement) { | 335 if (element is LocalVariableElement) { |
| 339 recordPromotions(element.type); | 336 recordPromotions(element.type); |
| 340 } else if (element is ParameterElement) { | 337 } else if (element is ParameterElement) { |
| 341 recordPromotions(element.type); | 338 recordPromotions(element.type); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 390 |
| 394 /// Based on DDC code generator's `_recoverTypeArguments` | 391 /// Based on DDC code generator's `_recoverTypeArguments` |
| 395 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { | 392 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { |
| 396 assert(identical(g.element, f.element)); | 393 assert(identical(g.element, f.element)); |
| 397 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); | 394 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); |
| 398 assert(g.typeFormals.length + g.typeArguments.length == | 395 assert(g.typeFormals.length + g.typeArguments.length == |
| 399 f.typeArguments.length); | 396 f.typeArguments.length); |
| 400 return f.typeArguments.skip(g.typeArguments.length); | 397 return f.typeArguments.skip(g.typeArguments.length); |
| 401 } | 398 } |
| 402 } | 399 } |
| OLD | NEW |