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 engine.incremental_resolver; | 5 library engine.incremental_resolver; |
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/src/context/cache.dart' | 10 import 'package:analyzer/src/context/cache.dart' |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 if (node is DefaultFormalParameter) { | 486 if (node is DefaultFormalParameter) { |
487 Expression nodeDefault = node.defaultValue; | 487 Expression nodeDefault = node.defaultValue; |
488 if (nodeDefault == null) { | 488 if (nodeDefault == null) { |
489 _assertNull(element.defaultValueCode); | 489 _assertNull(element.defaultValueCode); |
490 } else { | 490 } else { |
491 _assertEquals(nodeDefault.toSource(), element.defaultValueCode); | 491 _assertEquals(nodeDefault.toSource(), element.defaultValueCode); |
492 } | 492 } |
493 _assertCompatibleParameter(node.parameter, element); | 493 _assertCompatibleParameter(node.parameter, element); |
494 } else if (node is FieldFormalParameter) { | 494 } else if (node is FieldFormalParameter) { |
495 _assertTrue(element.isInitializingFormal); | 495 _assertTrue(element.isInitializingFormal); |
| 496 DartType parameterType = element.type; |
| 497 if (node.type == null && node.parameters == null) { |
| 498 FieldFormalParameterElement parameterElement = element; |
| 499 if (!parameterElement.hasImplicitType) { |
| 500 _assertTrue(parameterType == null || parameterType.isDynamic); |
| 501 } |
| 502 if (parameterElement.field != null) { |
| 503 _assertEquals(node.identifier.name, element.name); |
| 504 } |
| 505 } else { |
| 506 if (node.parameters != null) { |
| 507 _assertTrue(parameterType is FunctionType); |
| 508 FunctionType parameterFunctionType = parameterType; |
| 509 _assertSameType(node.type, parameterFunctionType.returnType); |
| 510 } else { |
| 511 _assertSameType(node.type, parameterType); |
| 512 } |
| 513 } |
496 _assertCompatibleParameters(node.parameters, element.parameters); | 514 _assertCompatibleParameters(node.parameters, element.parameters); |
497 } else if (node is FunctionTypedFormalParameter) { | 515 } else if (node is FunctionTypedFormalParameter) { |
498 _assertFalse(element.isInitializingFormal); | 516 _assertFalse(element.isInitializingFormal); |
499 _assertTrue(element.type is FunctionType); | 517 _assertTrue(element.type is FunctionType); |
500 FunctionType elementType = element.type; | 518 FunctionType elementType = element.type; |
501 _assertCompatibleParameters(node.parameters, element.parameters); | 519 _assertCompatibleParameters(node.parameters, element.parameters); |
502 _assertSameType(node.returnType, elementType.returnType); | 520 _assertSameType(node.returnType, elementType.returnType); |
503 } else if (node is SimpleFormalParameter) { | 521 } else if (node is SimpleFormalParameter) { |
504 _assertFalse(element.isInitializingFormal); | 522 _assertFalse(element.isInitializingFormal); |
505 _assertSameType(node.type, element.type); | 523 _assertSameType(node.type, element.type); |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 @override | 2141 @override |
2124 String toString() => name; | 2142 String toString() => name; |
2125 } | 2143 } |
2126 | 2144 |
2127 class _TokenPair { | 2145 class _TokenPair { |
2128 final _TokenDifferenceKind kind; | 2146 final _TokenDifferenceKind kind; |
2129 final Token oldToken; | 2147 final Token oldToken; |
2130 final Token newToken; | 2148 final Token newToken; |
2131 _TokenPair(this.kind, this.oldToken, this.newToken); | 2149 _TokenPair(this.kind, this.oldToken, this.newToken); |
2132 } | 2150 } |
OLD | NEW |