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

Side by Side Diff: runtime/vm/object.cc

Issue 2628693004: TokenPositions on more nodes when running from Kernel (Closed)
Patch Set: Changes based on feedback 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 unified diff | Download patch
« runtime/vm/kernel_to_il.cc ('K') | « runtime/vm/object.h ('k') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 3456 matching lines...) Expand 10 before | Expand all | Expand 10 after
3467 ASSERT(!token_pos.IsClassifying()); 3467 ASSERT(!token_pos.IsClassifying());
3468 StoreNonPointer(&raw_ptr()->token_pos_, token_pos); 3468 StoreNonPointer(&raw_ptr()->token_pos_, token_pos);
3469 } 3469 }
3470 3470
3471 3471
3472 TokenPosition Class::ComputeEndTokenPos() const { 3472 TokenPosition Class::ComputeEndTokenPos() const {
3473 // Return the begin token for synthetic classes. 3473 // Return the begin token for synthetic classes.
3474 if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) { 3474 if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) {
3475 return token_pos(); 3475 return token_pos();
3476 } 3476 }
3477
3477 Zone* zone = Thread::Current()->zone(); 3478 Zone* zone = Thread::Current()->zone();
3478 const Script& scr = Script::Handle(zone, script()); 3479 const Script& scr = Script::Handle(zone, script());
3479 ASSERT(!scr.IsNull()); 3480 ASSERT(!scr.IsNull());
3480 3481
3481 if (scr.kind() == RawScript::kKernelTag) { 3482 if (scr.kind() == RawScript::kKernelTag) {
3482 return TokenPosition::kMinSource; 3483 TokenPosition largest_seen = token_pos();
3484
3485 // Walk through all functions and get their end_tokens to find the classes
3486 // "end token".
3487 // TODO(jensj): Should probably walk though all fields as well.
3488 Function& function = Function::Handle(zone);
3489 const Array& arr = Array::Handle(functions());
3490 for (int i = 0; i < arr.Length(); i++) {
3491 function ^= arr.At(i);
3492 if (function.script() == script()) {
3493 if (largest_seen < function.end_token_pos()) {
3494 largest_seen = function.end_token_pos();
3495 }
3496 }
3497 }
3498 return TokenPosition(largest_seen);
3483 } 3499 }
3484 3500
3485 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens()); 3501 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens());
3486 if (tkns.IsNull()) { 3502 if (tkns.IsNull()) {
3487 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT); 3503 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
3488 return TokenPosition::kNoSource; 3504 return TokenPosition::kNoSource;
3489 } 3505 }
3490 TokenStream::Iterator tkit(zone, tkns, token_pos(), 3506 TokenStream::Iterator tkit(zone, tkns, token_pos(),
3491 TokenStream::Iterator::kNoNewlines); 3507 TokenStream::Iterator::kNoNewlines);
3492 intptr_t level = 0; 3508 intptr_t level = 0;
(...skipping 19489 matching lines...) Expand 10 before | Expand all | Expand 10 after
22982 return UserTag::null(); 22998 return UserTag::null();
22983 } 22999 }
22984 23000
22985 23001
22986 const char* UserTag::ToCString() const { 23002 const char* UserTag::ToCString() const {
22987 const String& tag_label = String::Handle(label()); 23003 const String& tag_label = String::Handle(label());
22988 return tag_label.ToCString(); 23004 return tag_label.ToCString();
22989 } 23005 }
22990 23006
22991 } // namespace dart 23007 } // namespace dart
OLDNEW
« 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