Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: pkg/dartino_compiler/lib/src/find_position_visitor.dart

Issue 2140053002: Handle functions with no attached node in find_position_visitor. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698