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

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/util.dart

Issue 836413006: Issue 22027. When parameters has function type alias type, use its name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_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 services.src.correction.util; 5 library services.src.correction.util;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analysis_server/src/protocol.dart' show SourceChange, 9 import 'package:analysis_server/src/protocol.dart' show SourceChange,
10 SourceEdit; 10 SourceEdit;
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 /** 870 /**
871 * @return the source for the parameter with the given type and name. 871 * @return the source for the parameter with the given type and name.
872 */ 872 */
873 String getParameterSource(DartType type, String name, 873 String getParameterSource(DartType type, String name,
874 Set<LibraryElement> librariesToImport) { 874 Set<LibraryElement> librariesToImport) {
875 // no type 875 // no type
876 if (type == null || type.isDynamic) { 876 if (type == null || type.isDynamic) {
877 return name; 877 return name;
878 } 878 }
879 // function type 879 // function type
880 if (type is FunctionType) { 880 if (type is FunctionType && type.element.isSynthetic) {
881 FunctionType functionType = type; 881 FunctionType functionType = type;
882 StringBuffer sb = new StringBuffer(); 882 StringBuffer sb = new StringBuffer();
883 // return type 883 // return type
884 DartType returnType = functionType.returnType; 884 DartType returnType = functionType.returnType;
885 if (returnType != null && !returnType.isDynamic) { 885 if (returnType != null && !returnType.isDynamic) {
886 String returnTypeSource = getTypeSource(returnType, librariesToImport); 886 String returnTypeSource = getTypeSource(returnType, librariesToImport);
887 sb.write(returnTypeSource); 887 sb.write(returnTypeSource);
888 sb.write(' '); 888 sb.write(' ');
889 } 889 }
890 // parameter name 890 // parameter name
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 1468
1469 @override 1469 @override
1470 Object visitExpression(Expression node) { 1470 Object visitExpression(Expression node) {
1471 if (node is BinaryExpression && node.operator.type == groupOperatorType) { 1471 if (node is BinaryExpression && node.operator.type == groupOperatorType) {
1472 return super.visitNode(node); 1472 return super.visitNode(node);
1473 } 1473 }
1474 operands.add(node); 1474 operands.add(node);
1475 return null; 1475 return null;
1476 } 1476 }
1477 } 1477 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698