| 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 computer.highlights; | 5 library computer.highlights; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart' hide Element; | 7 import 'package:analysis_server/src/protocol.dart' hide Element; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 if (element is PropertyAccessorElement) { | 162 if (element is PropertyAccessorElement) { |
| 163 element = (element as PropertyAccessorElement).variable; | 163 element = (element as PropertyAccessorElement).variable; |
| 164 } | 164 } |
| 165 // prepare type | 165 // prepare type |
| 166 HighlightRegionType type; | 166 HighlightRegionType type; |
| 167 if (element is FieldElement) { | 167 if (element is FieldElement) { |
| 168 Element enclosingElement = element.enclosingElement; | 168 Element enclosingElement = element.enclosingElement; |
| 169 if (enclosingElement is ClassElement && enclosingElement.isEnum) { | 169 if (enclosingElement is ClassElement && enclosingElement.isEnum) { |
| 170 type = HighlightRegionType.ENUM_CONSTANT; | 170 type = HighlightRegionType.ENUM_CONSTANT; |
| 171 } else if ((element as FieldElement).isStatic) { | 171 } else if (element.isStatic) { |
| 172 type = HighlightRegionType.FIELD_STATIC; | 172 type = HighlightRegionType.FIELD_STATIC; |
| 173 } else { | 173 } else { |
| 174 type = HighlightRegionType.FIELD; | 174 type = HighlightRegionType.FIELD; |
| 175 } | 175 } |
| 176 } else if (element is TopLevelVariableElement) { | 176 } else if (element is TopLevelVariableElement) { |
| 177 type = HighlightRegionType.TOP_LEVEL_VARIABLE; | 177 type = HighlightRegionType.TOP_LEVEL_VARIABLE; |
| 178 } | 178 } |
| 179 // add region | 179 // add region |
| 180 if (type != null) { | 180 if (type != null) { |
| 181 return _addRegion_node(node, type); | 181 return _addRegion_node(node, type); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 void _addRegions_functionBody(FunctionBody node) { | 715 void _addRegions_functionBody(FunctionBody node) { |
| 716 Token keyword = node.keyword; | 716 Token keyword = node.keyword; |
| 717 if (keyword != null) { | 717 if (keyword != null) { |
| 718 Token star = node.star; | 718 Token star = node.star; |
| 719 int offset = keyword.offset; | 719 int offset = keyword.offset; |
| 720 int end = star != null ? star.end : keyword.end; | 720 int end = star != null ? star.end : keyword.end; |
| 721 computer._addRegion(offset, end - offset, HighlightRegionType.BUILT_IN); | 721 computer._addRegion(offset, end - offset, HighlightRegionType.BUILT_IN); |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 } | 724 } |
| OLD | NEW |