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

Side by Side Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart

Issue 2926763003: Add type inference for complex assignments whose LHS is an index expression. (Closed)
Patch Set: Created 3 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) 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/visitor.dart'; 11 import 'package:analyzer/dart/ast/visitor.dart';
11 import 'package:analyzer/dart/element/element.dart'; 12 import 'package:analyzer/dart/element/element.dart';
12 import 'package:analyzer/dart/element/type.dart'; 13 import 'package:analyzer/dart/element/type.dart';
13 import 'package:analyzer/src/dart/analysis/driver.dart'; 14 import 'package:analyzer/src/dart/analysis/driver.dart';
14 import 'package:analyzer/src/generated/source.dart'; 15 import 'package:analyzer/src/generated/source.dart';
15 import 'package:analyzer/src/generated/utilities_dart.dart'; 16 import 'package:analyzer/src/generated/utilities_dart.dart';
16 import 'package:front_end/src/base/instrumentation.dart' as fasta; 17 import 'package:front_end/src/base/instrumentation.dart' as fasta;
17 import 'package:front_end/src/fasta/compiler_context.dart' as fasta; 18 import 'package:front_end/src/fasta/compiler_context.dart' as fasta;
18 import 'package:front_end/src/fasta/testing/validating_instrumentation.dart' 19 import 'package:front_end/src/fasta/testing/validating_instrumentation.dart'
19 as fasta; 20 as fasta;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 node.prefix.staticElement is! ClassElement) { 444 node.prefix.staticElement is! ClassElement) {
444 if (node.identifier.inGetterContext() || 445 if (node.identifier.inGetterContext() ||
445 node.identifier.inSetterContext()) { 446 node.identifier.inSetterContext()) {
446 _recordTarget(node.identifier.offset, node.identifier.staticElement); 447 _recordTarget(node.identifier.offset, node.identifier.staticElement);
447 } 448 }
448 } 449 }
449 } 450 }
450 451
451 visitPrefixExpression(PrefixExpression node) { 452 visitPrefixExpression(PrefixExpression node) {
452 super.visitPrefixExpression(node); 453 super.visitPrefixExpression(node);
453 _recordTarget(node.operator.charOffset, node.staticElement); 454 if (node.operator.type != TokenType.PLUS_PLUS &&
455 node.operator.type != TokenType.MINUS_MINUS) {
456 _recordTarget(node.operator.charOffset, node.staticElement);
457 }
454 } 458 }
455 459
456 @override 460 @override
457 visitPropertyAccess(PropertyAccess node) { 461 visitPropertyAccess(PropertyAccess node) {
458 super.visitPropertyAccess(node); 462 super.visitPropertyAccess(node);
459 if (node.propertyName.inGetterContext() || 463 if (node.propertyName.inGetterContext() ||
460 node.propertyName.inSetterContext()) { 464 node.propertyName.inSetterContext()) {
461 _recordTarget(node.propertyName.offset, node.propertyName.staticElement); 465 _recordTarget(node.propertyName.offset, node.propertyName.staticElement);
462 } 466 }
463 } 467 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 549
546 /// Based on DDC code generator's `_recoverTypeArguments` 550 /// Based on DDC code generator's `_recoverTypeArguments`
547 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { 551 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) {
548 assert(identical(g.element, f.element)); 552 assert(identical(g.element, f.element));
549 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); 553 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty);
550 assert(g.typeFormals.length + g.typeArguments.length == 554 assert(g.typeFormals.length + g.typeArguments.length ==
551 f.typeArguments.length); 555 f.typeArguments.length);
552 return f.typeArguments.skip(g.typeArguments.length); 556 return f.typeArguments.skip(g.typeArguments.length);
553 } 557 }
554 } 558 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698