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 analysis_server.src.services.correction.fix_internal; | 5 library analysis_server.src.services.correction.fix_internal; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 | 9 |
10 import 'package:analysis_server/edit/fix/fix_core.dart'; | 10 import 'package:analysis_server/edit/fix/fix_core.dart'; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 445 |
446 void _addFix_createClass() { | 446 void _addFix_createClass() { |
447 Element prefixElement = null; | 447 Element prefixElement = null; |
448 String name = null; | 448 String name = null; |
449 SimpleIdentifier nameNode; | 449 SimpleIdentifier nameNode; |
450 if (node is SimpleIdentifier) { | 450 if (node is SimpleIdentifier) { |
451 AstNode parent = node.parent; | 451 AstNode parent = node.parent; |
452 if (parent is PrefixedIdentifier) { | 452 if (parent is PrefixedIdentifier) { |
453 PrefixedIdentifier prefixedIdentifier = parent; | 453 PrefixedIdentifier prefixedIdentifier = parent; |
454 prefixElement = prefixedIdentifier.prefix.staticElement; | 454 prefixElement = prefixedIdentifier.prefix.staticElement; |
| 455 if (prefixElement == null) { |
| 456 return; |
| 457 } |
455 parent = prefixedIdentifier.parent; | 458 parent = prefixedIdentifier.parent; |
456 nameNode = prefixedIdentifier.identifier; | 459 nameNode = prefixedIdentifier.identifier; |
457 name = prefixedIdentifier.identifier.name; | 460 name = prefixedIdentifier.identifier.name; |
458 } else { | 461 } else { |
459 nameNode = node; | 462 nameNode = node; |
460 name = nameNode.name; | 463 name = nameNode.name; |
461 } | 464 } |
462 if (!_mayBeTypeIdentifier(nameNode)) { | 465 if (!_mayBeTypeIdentifier(nameNode)) { |
463 return; | 466 return; |
464 } | 467 } |
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 /** | 2750 /** |
2748 * Describes the location for a newly created [FieldDeclaration]. | 2751 * Describes the location for a newly created [FieldDeclaration]. |
2749 */ | 2752 */ |
2750 class _FieldLocation { | 2753 class _FieldLocation { |
2751 final String prefix; | 2754 final String prefix; |
2752 final int offset; | 2755 final int offset; |
2753 final String suffix; | 2756 final String suffix; |
2754 | 2757 |
2755 _FieldLocation(this.prefix, this.offset, this.suffix); | 2758 _FieldLocation(this.prefix, this.offset, this.suffix); |
2756 } | 2759 } |
OLD | NEW |