| 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 'ast.dart'; | 10 import 'ast.dart'; |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 void _assertNull(Object object) { | 511 void _assertNull(Object object) { |
| 512 if (object != null) { | 512 if (object != null) { |
| 513 throw new _DeclarationMismatchException(); | 513 throw new _DeclarationMismatchException(); |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 | 516 |
| 517 void _assertSameAnnotation(Annotation node, ElementAnnotation annotation) { | 517 void _assertSameAnnotation(Annotation node, ElementAnnotation annotation) { |
| 518 _assertNull(node.arguments); | |
| 519 Element element = annotation.element; | 518 Element element = annotation.element; |
| 520 _assertTrue(element is PropertyAccessorElement); | 519 if (element is ConstructorElement) { |
| 521 _assertTrue(node.name is SimpleIdentifier); | 520 _assertTrue(node.name is SimpleIdentifier); |
| 522 String nodeName = node.name.name; | 521 _assertNull(node.constructorName); |
| 523 String elementName = element.displayName; | 522 TypeName nodeType = new TypeName(node.name, null); |
| 524 _assertEquals(nodeName, elementName); | 523 _assertSameType(nodeType, element.returnType); |
| 524 // TODO(scheglov) validate arguments |
| 525 } |
| 526 if (element is PropertyAccessorElement) { |
| 527 _assertTrue(node.name is SimpleIdentifier); |
| 528 String nodeName = node.name.name; |
| 529 String elementName = element.displayName; |
| 530 _assertEquals(nodeName, elementName); |
| 531 } |
| 525 } | 532 } |
| 526 | 533 |
| 527 void _assertSameAnnotations(AnnotatedNode node, Element element) { | 534 void _assertSameAnnotations(AnnotatedNode node, Element element) { |
| 528 List<Annotation> nodeAnnotaitons = node.metadata; | 535 List<Annotation> nodeAnnotaitons = node.metadata; |
| 529 List<ElementAnnotation> elementAnnotations = element.metadata; | 536 List<ElementAnnotation> elementAnnotations = element.metadata; |
| 530 int length = nodeAnnotaitons.length; | 537 int length = nodeAnnotaitons.length; |
| 531 _assertEquals(elementAnnotations.length, length); | 538 _assertEquals(elementAnnotations.length, length); |
| 532 for (int i = 0; i < length; i++) { | 539 for (int i = 0; i < length; i++) { |
| 533 _assertSameAnnotation(nodeAnnotaitons[i], elementAnnotations[i]); | 540 _assertSameAnnotation(nodeAnnotaitons[i], elementAnnotations[i]); |
| 534 } | 541 } |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 String toString() => name; | 1857 String toString() => name; |
| 1851 } | 1858 } |
| 1852 | 1859 |
| 1853 | 1860 |
| 1854 class _TokenPair { | 1861 class _TokenPair { |
| 1855 final _TokenDifferenceKind kind; | 1862 final _TokenDifferenceKind kind; |
| 1856 final Token oldToken; | 1863 final Token oldToken; |
| 1857 final Token newToken; | 1864 final Token newToken; |
| 1858 _TokenPair(this.kind, this.oldToken, this.newToken); | 1865 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 1859 } | 1866 } |
| OLD | NEW |