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

Unified Diff: runtime/vm/object.cc

Issue 2628693004: TokenPositions on more nodes when running from Kernel (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/kernel_to_il.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 2da9eb62c4b0b5c7f5ef255576b59967b0fba013..ba952d5715308620f370ed36ba6aca7ac25b9389 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3474,12 +3474,28 @@ TokenPosition Class::ComputeEndTokenPos() const {
if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) {
return token_pos();
}
+
Kevin Millikin (Google) 2017/01/12 13:43:04 I'm not a fan of these inserted blank lines (also
jensj 2017/01/13 10:14:44 That's probably me in an attempt to block stuff to
Zone* zone = Thread::Current()->zone();
const Script& scr = Script::Handle(zone, script());
ASSERT(!scr.IsNull());
if (scr.kind() == RawScript::kKernelTag) {
- return TokenPosition::kMinSource;
+ TokenPosition largest_seen = token_pos();
+
+ // Walk through all functions and get their end_tokens to find the classes
+ // "end token".
+ // TODO(jensj): Should probably walk though all fields as well.
+ Function& function = Function::Handle(zone);
+ const Array& arr = Array::Handle(functions());
+ for (int i = 0; i < arr.Length(); i++) {
+ function ^= arr.At(i);
+ if (function.script() == script()) {
+ if (largest_seen < function.end_token_pos()) {
+ largest_seen = function.end_token_pos();
+ }
+ }
+ }
+ return TokenPosition(largest_seen);
}
const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens());
« runtime/vm/kernel_to_il.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698