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

Side by Side Diff: pkg/compiler/lib/src/resolution/signatures.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fix comments. Created 4 years 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) 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 dart2js.resolution.signatures; 5 library dart2js.resolution.signatures;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart'; 8 import '../common/resolution.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 */ 295 */
296 static FunctionSignature analyze( 296 static FunctionSignature analyze(
297 Resolution resolution, 297 Resolution resolution,
298 Scope scope, 298 Scope scope,
299 NodeList typeVariables, 299 NodeList typeVariables,
300 NodeList formalParameters, 300 NodeList formalParameters,
301 Node returnNode, 301 Node returnNode,
302 FunctionTypedElement element, 302 FunctionTypedElement element,
303 ResolutionRegistry registry, 303 ResolutionRegistry registry,
304 {MessageKind defaultValuesError, 304 {MessageKind defaultValuesError,
305 bool isNewSyntax: false,
Siggi Cherem (dart-lang) 2016/12/12 23:20:40 while you are here, would you mind updating the da
305 bool createRealParameters: false, 306 bool createRealParameters: false,
306 bool isFunctionExpression: false}) { 307 bool isFunctionExpression: false}) {
307 DiagnosticReporter reporter = resolution.reporter; 308 DiagnosticReporter reporter = resolution.reporter;
308 309
309 List<DartType> createTypeVariables(NodeList typeVariableNodes) { 310 List<DartType> createTypeVariables(NodeList typeVariableNodes) {
310 if (element.isPatch) { 311 if (element.isPatch) {
311 FunctionTypedElement origin = element.origin; 312 FunctionTypedElement origin = element.origin;
312 origin.computeType(resolution); 313 origin.computeType(resolution);
313 return origin.typeVariables; 314 return origin.typeVariables;
314 } 315 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 LinkBuilder<DartType> parameterTypes = new LinkBuilder<DartType>(); 412 LinkBuilder<DartType> parameterTypes = new LinkBuilder<DartType>();
412 for (FormalElement parameter in parameters) { 413 for (FormalElement parameter in parameters) {
413 parameterTypes.addLast(parameter.type); 414 parameterTypes.addLast(parameter.type);
414 } 415 }
415 List<DartType> optionalParameterTypes = const <DartType>[]; 416 List<DartType> optionalParameterTypes = const <DartType>[];
416 List<String> namedParameters = const <String>[]; 417 List<String> namedParameters = const <String>[];
417 List<DartType> namedParameterTypes = const <DartType>[]; 418 List<DartType> namedParameterTypes = const <DartType>[];
418 List<Element> orderedOptionalParameters = 419 List<Element> orderedOptionalParameters =
419 visitor.optionalParameters.toList(); 420 visitor.optionalParameters.toList();
420 if (visitor.optionalParametersAreNamed) { 421 if (visitor.optionalParametersAreNamed) {
421 // TODO(karlklose); replace when [visitor.optinalParameters] is a [List]. 422 // TODO(karlklose); replace when [visitor.optionalParameters] is a [List].
422 orderedOptionalParameters.sort((Element a, Element b) { 423 orderedOptionalParameters.sort((Element a, Element b) {
423 return a.name.compareTo(b.name); 424 return a.name.compareTo(b.name);
424 }); 425 });
425 LinkBuilder<String> namedParametersBuilder = new LinkBuilder<String>(); 426 LinkBuilder<String> namedParametersBuilder = new LinkBuilder<String>();
426 LinkBuilder<DartType> namedParameterTypesBuilder = 427 LinkBuilder<DartType> namedParameterTypesBuilder =
427 new LinkBuilder<DartType>(); 428 new LinkBuilder<DartType>();
428 for (FormalElement parameter in orderedOptionalParameters) { 429 for (FormalElement parameter in orderedOptionalParameters) {
429 namedParametersBuilder.addLast(parameter.name); 430 namedParametersBuilder.addLast(parameter.name);
430 namedParameterTypesBuilder.addLast(parameter.type); 431 namedParameterTypesBuilder.addLast(parameter.type);
431 } 432 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 /// variables of the function signature itself when its signature is analyzed. 483 /// variables of the function signature itself when its signature is analyzed.
483 class FunctionSignatureBuildingScope extends TypeVariablesScope { 484 class FunctionSignatureBuildingScope extends TypeVariablesScope {
484 @override 485 @override
485 final List<DartType> typeVariables; 486 final List<DartType> typeVariables;
486 487
487 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) 488 FunctionSignatureBuildingScope(Scope parent, this.typeVariables)
488 : super(parent); 489 : super(parent);
489 490
490 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; 491 String toString() => 'FunctionSignatureBuildingScope($typeVariables)';
491 } 492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698