| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.analyzer.ast_from_analyzer; | 4 library kernel.analyzer.ast_from_analyzer; |
| 5 | 5 |
| 6 import '../ast.dart' as ast; | 6 import '../ast.dart' as ast; |
| 7 import '../frontend/accessors.dart'; | 7 import '../frontend/accessors.dart'; |
| 8 import '../frontend/super_initializers.dart'; | 8 import '../frontend/super_initializers.dart'; |
| 9 import '../log.dart'; | 9 import '../log.dart'; |
| 10 import '../type_algebra.dart'; | 10 import '../type_algebra.dart'; |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 return null; | 431 return null; |
| 432 } | 432 } |
| 433 | 433 |
| 434 ast.FunctionNode buildFunctionInterface(FunctionTypedElement element) { | 434 ast.FunctionNode buildFunctionInterface(FunctionTypedElement element) { |
| 435 var positional = <ast.VariableDeclaration>[]; | 435 var positional = <ast.VariableDeclaration>[]; |
| 436 var named = <ast.VariableDeclaration>[]; | 436 var named = <ast.VariableDeclaration>[]; |
| 437 int requiredParameterCount = 0; | 437 int requiredParameterCount = 0; |
| 438 // Initialize type parameters in two passes: put them into scope, | 438 // Initialize type parameters in two passes: put them into scope, |
| 439 // and compute the bounds afterwards while they are all in scope. | 439 // and compute the bounds afterwards while they are all in scope. |
| 440 var typeParameters = <ast.TypeParameter>[]; | 440 var typeParameters = <ast.TypeParameter>[]; |
| 441 var typeParameterElements = |
| 442 element is ConstructorElement && element.isFactory |
| 443 ? element.enclosingElement.typeParameters |
| 444 : element.typeParameters; |
| 441 if (strongMode || element is ConstructorElement) { | 445 if (strongMode || element is ConstructorElement) { |
| 442 for (var parameter in element.typeParameters) { | 446 for (var parameter in typeParameterElements) { |
| 443 var parameterNode = new ast.TypeParameter(parameter.name); | 447 var parameterNode = new ast.TypeParameter(parameter.name); |
| 444 typeParameters.add(parameterNode); | 448 typeParameters.add(parameterNode); |
| 445 localTypeParameters[parameter] = parameterNode; | 449 localTypeParameters[parameter] = parameterNode; |
| 446 } | 450 } |
| 447 } | 451 } |
| 448 for (int i = 0; i < typeParameters.length; ++i) { | 452 for (int i = 0; i < typeParameters.length; ++i) { |
| 449 var parameter = element.typeParameters[i]; | 453 var parameter = typeParameterElements[i]; |
| 450 var parameterNode = typeParameters[i]; | 454 var parameterNode = typeParameters[i]; |
| 451 parameterNode.bound = parameter.bound == null | 455 parameterNode.bound = parameter.bound == null |
| 452 ? defaultTypeParameterBound | 456 ? defaultTypeParameterBound |
| 453 : buildType(parameter.bound); | 457 : buildType(parameter.bound); |
| 454 } | 458 } |
| 455 for (var parameter in element.parameters) { | 459 for (var parameter in element.parameters) { |
| 456 var parameterNode = new ast.VariableDeclaration(parameter.name, | 460 var parameterNode = new ast.VariableDeclaration(parameter.name, |
| 457 type: buildType(parameter.type)); | 461 type: buildType(parameter.type)); |
| 458 switch (parameter.parameterKind) { | 462 switch (parameter.parameterKind) { |
| 459 case ParameterKind.REQUIRED: | 463 case ParameterKind.REQUIRED: |
| (...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3041 if (list[i - 1].compareTo(item) == 0) { | 3045 if (list[i - 1].compareTo(item) == 0) { |
| 3042 ++deleted; | 3046 ++deleted; |
| 3043 } else if (deleted > 0) { | 3047 } else if (deleted > 0) { |
| 3044 list[i - deleted] = item; | 3048 list[i - deleted] = item; |
| 3045 } | 3049 } |
| 3046 } | 3050 } |
| 3047 if (deleted > 0) { | 3051 if (deleted > 0) { |
| 3048 list.length -= deleted; | 3052 list.length -= deleted; |
| 3049 } | 3053 } |
| 3050 } | 3054 } |
| OLD | NEW |