OLD | NEW |
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 '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 LinkBuilder<Element> parametersBuilder = | 359 LinkBuilder<Element> parametersBuilder = |
360 visitor.analyzeNodes(formalParameters.nodes); | 360 visitor.analyzeNodes(formalParameters.nodes); |
361 requiredParameterCount = parametersBuilder.length; | 361 requiredParameterCount = parametersBuilder.length; |
362 parameters = parametersBuilder.toList(); | 362 parameters = parametersBuilder.toList(); |
363 } | 363 } |
364 DartType returnType; | 364 DartType returnType; |
365 if (element.isFactoryConstructor) { | 365 if (element.isFactoryConstructor) { |
366 returnType = element.enclosingClass.thisType; | 366 returnType = element.enclosingClass.thisType; |
367 // Because there is no type annotation for the return type of | 367 // Because there is no type annotation for the return type of |
368 // this element, we explicitly add one. | 368 // this element, we explicitly add one. |
369 if (compiler.options.enableTypeAssertions) { | 369 registry.registerTypeUse(new TypeUse.checkedModeCheck(returnType)); |
370 registry.registerTypeUse(new TypeUse.checkedModeCheck(returnType)); | |
371 } | |
372 } else { | 370 } else { |
373 AsyncMarker asyncMarker = AsyncMarker.SYNC; | 371 AsyncMarker asyncMarker = AsyncMarker.SYNC; |
374 if (isFunctionExpression) { | 372 if (isFunctionExpression) { |
375 // Use async marker to determine the return type of function | 373 // Use async marker to determine the return type of function |
376 // expressions. | 374 // expressions. |
377 FunctionElement function = element; | 375 FunctionElement function = element; |
378 asyncMarker = function.asyncMarker; | 376 asyncMarker = function.asyncMarker; |
379 } | 377 } |
380 switch (asyncMarker) { | 378 switch (asyncMarker) { |
381 case AsyncMarker.SYNC: | 379 case AsyncMarker.SYNC: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 /// variables of the function signature itself when its signature is analyzed. | 473 /// variables of the function signature itself when its signature is analyzed. |
476 class FunctionSignatureBuildingScope extends TypeVariablesScope { | 474 class FunctionSignatureBuildingScope extends TypeVariablesScope { |
477 @override | 475 @override |
478 final List<DartType> typeVariables; | 476 final List<DartType> typeVariables; |
479 | 477 |
480 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) | 478 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) |
481 : super(parent); | 479 : super(parent); |
482 | 480 |
483 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; | 481 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; |
484 } | 482 } |
OLD | NEW |