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

Side by Side Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1827243003: Allow values to be returned from implicitly typed setters (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/strong_mode_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 bool wasInAsync = _inAsync; 635 bool wasInAsync = _inAsync;
636 bool wasInGenerator = _inGenerator; 636 bool wasInGenerator = _inGenerator;
637 try { 637 try {
638 _inAsync = node.isAsynchronous; 638 _inAsync = node.isAsynchronous;
639 _inGenerator = node.isGenerator; 639 _inGenerator = node.isGenerator;
640 FunctionType functionType = 640 FunctionType functionType =
641 _enclosingFunction == null ? null : _enclosingFunction.type; 641 _enclosingFunction == null ? null : _enclosingFunction.type;
642 DartType expectedReturnType = functionType == null 642 DartType expectedReturnType = functionType == null
643 ? DynamicTypeImpl.instance 643 ? DynamicTypeImpl.instance
644 : functionType.returnType; 644 : functionType.returnType;
645 _checkForReturnOfInvalidType(node.expression, expectedReturnType); 645 bool isSetterWithImplicitReturn =
646 _enclosingFunction.hasImplicitReturnType &&
647 _enclosingFunction is PropertyAccessorElement &&
648 (_enclosingFunction as PropertyAccessorElement).isSetter;
649 if (!isSetterWithImplicitReturn) {
650 _checkForReturnOfInvalidType(node.expression, expectedReturnType);
651 }
646 return super.visitExpressionFunctionBody(node); 652 return super.visitExpressionFunctionBody(node);
647 } finally { 653 } finally {
648 _inAsync = wasInAsync; 654 _inAsync = wasInAsync;
649 _inGenerator = wasInGenerator; 655 _inGenerator = wasInGenerator;
650 } 656 }
651 } 657 }
652 658
653 @override 659 @override
654 Object visitFieldDeclaration(FieldDeclaration node) { 660 Object visitFieldDeclaration(FieldDeclaration node) {
655 _isInStaticVariableDeclaration = node.isStatic; 661 _isInStaticVariableDeclaration = node.isStatic;
(...skipping 5402 matching lines...) Expand 10 before | Expand all | Expand 10 after
6058 class _InvocationCollector extends RecursiveAstVisitor { 6064 class _InvocationCollector extends RecursiveAstVisitor {
6059 final List<String> superCalls = <String>[]; 6065 final List<String> superCalls = <String>[];
6060 6066
6061 @override 6067 @override
6062 visitMethodInvocation(MethodInvocation node) { 6068 visitMethodInvocation(MethodInvocation node) {
6063 if (node.target is SuperExpression) { 6069 if (node.target is SuperExpression) {
6064 superCalls.add(node.methodName.name); 6070 superCalls.add(node.methodName.name);
6065 } 6071 }
6066 } 6072 }
6067 } 6073 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/strong_mode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698