OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'package:compiler/src/elements/visitor.dart'; | 5 import 'package:compiler/src/elements/visitor.dart'; |
6 import 'package:compiler/src/parser/partial_elements.dart'; | 6 import 'package:compiler/src/parser/partial_elements.dart'; |
7 import 'package:compiler/src/elements/elements.dart'; | 7 import 'package:compiler/src/elements/elements.dart'; |
8 import 'package:compiler/src/tree/nodes.dart'; | 8 import 'package:compiler/src/tree/nodes.dart'; |
9 | 9 |
10 /// Returns the innermost function in [compilationUnit] spanning [position] or | 10 /// Returns the innermost function in [compilationUnit] spanning [position] or |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 visitFieldElement(FieldElement e, _) { | 60 visitFieldElement(FieldElement e, _) { |
61 element = findSmallestMatchingClosure(e) ?? element; | 61 element = findSmallestMatchingClosure(e) ?? element; |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 visit(Element e, [arg]) => e.accept(this, arg); | 65 visit(Element e, [arg]) => e.accept(this, arg); |
66 | 66 |
67 visitElement(Element element, _) {} | 67 visitElement(Element element, _) {} |
68 | 68 |
69 bool containsPosition(Node node) { | 69 bool containsPosition(Node node) { |
70 // TODO(sigurdm): Find out when [node] is null. | |
71 if (node == null) return false; | |
danrubel
2016/07/12 14:15:06
Should we log something here to obtain more inform
sigurdm
2016/08/10 09:05:11
I prefer that we replicate it locally and fix it.
| |
70 return node.getBeginToken().charOffset <= position && | 72 return node.getBeginToken().charOffset <= position && |
71 position < node.getEndToken().charEnd; | 73 position < node.getEndToken().charEnd; |
72 } | 74 } |
73 | 75 |
74 static int nodeLength(Node node) { | 76 static int nodeLength(Node node) { |
75 return node.getEndToken().charEnd - node.getBeginToken().charOffset; | 77 return node.getEndToken().charEnd - node.getBeginToken().charOffset; |
76 } | 78 } |
77 } | 79 } |
OLD | NEW |