OLD | NEW |
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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3245 StorePointer(&raw_ptr()->script_, value.raw()); | 3245 StorePointer(&raw_ptr()->script_, value.raw()); |
3246 } | 3246 } |
3247 | 3247 |
3248 | 3248 |
3249 void Class::set_token_pos(intptr_t token_pos) const { | 3249 void Class::set_token_pos(intptr_t token_pos) const { |
3250 ASSERT(token_pos >= 0); | 3250 ASSERT(token_pos >= 0); |
3251 raw_ptr()->token_pos_ = token_pos; | 3251 raw_ptr()->token_pos_ = token_pos; |
3252 } | 3252 } |
3253 | 3253 |
3254 | 3254 |
| 3255 intptr_t Class::ComputeEndTokenPos() const { |
| 3256 // Return the begin token for synthetic classes. |
| 3257 if (IsSignatureClass() || IsMixinApplication() || IsTopLevel()) { |
| 3258 return token_pos(); |
| 3259 } |
| 3260 const Script& scr = Script::Handle(script()); |
| 3261 ASSERT(!scr.IsNull()); |
| 3262 const TokenStream& tkns = TokenStream::Handle(scr.tokens()); |
| 3263 TokenStream::Iterator tkit( |
| 3264 tkns, token_pos(), TokenStream::Iterator::kNoNewlines); |
| 3265 intptr_t level = 0; |
| 3266 while (tkit.CurrentTokenKind() != Token::kEOS) { |
| 3267 if (tkit.CurrentTokenKind() == Token::kLBRACE) { |
| 3268 level++; |
| 3269 } else if (tkit.CurrentTokenKind() == Token::kRBRACE) { |
| 3270 if (--level == 0) { |
| 3271 return tkit.CurrentPosition(); |
| 3272 } |
| 3273 } |
| 3274 tkit.Advance(); |
| 3275 } |
| 3276 UNREACHABLE(); |
| 3277 return 0; |
| 3278 } |
| 3279 |
| 3280 |
3255 void Class::set_is_implemented() const { | 3281 void Class::set_is_implemented() const { |
3256 set_state_bits(ImplementedBit::update(true, raw_ptr()->state_bits_)); | 3282 set_state_bits(ImplementedBit::update(true, raw_ptr()->state_bits_)); |
3257 } | 3283 } |
3258 | 3284 |
3259 | 3285 |
3260 void Class::set_is_abstract() const { | 3286 void Class::set_is_abstract() const { |
3261 set_state_bits(AbstractBit::update(true, raw_ptr()->state_bits_)); | 3287 set_state_bits(AbstractBit::update(true, raw_ptr()->state_bits_)); |
3262 } | 3288 } |
3263 | 3289 |
3264 | 3290 |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4001 jsobj.AddProperty("const", is_const()); | 4027 jsobj.AddProperty("const", is_const()); |
4002 const Class& superClass = Class::Handle(SuperClass()); | 4028 const Class& superClass = Class::Handle(SuperClass()); |
4003 if (!superClass.IsNull()) { | 4029 if (!superClass.IsNull()) { |
4004 jsobj.AddProperty("super", superClass); | 4030 jsobj.AddProperty("super", superClass); |
4005 } | 4031 } |
4006 jsobj.AddProperty("library", Object::Handle(library())); | 4032 jsobj.AddProperty("library", Object::Handle(library())); |
4007 const Script& script = Script::Handle(this->script()); | 4033 const Script& script = Script::Handle(this->script()); |
4008 if (!script.IsNull()) { | 4034 if (!script.IsNull()) { |
4009 jsobj.AddProperty("script", script); | 4035 jsobj.AddProperty("script", script); |
4010 jsobj.AddProperty("tokenPos", token_pos()); | 4036 jsobj.AddProperty("tokenPos", token_pos()); |
| 4037 jsobj.AddProperty("endTokenPos", ComputeEndTokenPos()); |
4011 } | 4038 } |
4012 { | 4039 { |
4013 JSONArray interfaces_array(&jsobj, "interfaces"); | 4040 JSONArray interfaces_array(&jsobj, "interfaces"); |
4014 const Array& interface_array = Array::Handle(interfaces()); | 4041 const Array& interface_array = Array::Handle(interfaces()); |
4015 Type& interface_type = Type::Handle(); | 4042 Type& interface_type = Type::Handle(); |
4016 Class& interface_cls = Class::Handle(); | 4043 Class& interface_cls = Class::Handle(); |
4017 if (!interface_array.IsNull()) { | 4044 if (!interface_array.IsNull()) { |
4018 for (intptr_t i = 0; i < interface_array.Length(); ++i) { | 4045 for (intptr_t i = 0; i < interface_array.Length(); ++i) { |
4019 // TODO(turnidge): Use the Type directly once regis has added | 4046 // TODO(turnidge): Use the Type directly once regis has added |
4020 // types to the vmservice. | 4047 // types to the vmservice. |
(...skipping 14987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19008 return tag_label.ToCString(); | 19035 return tag_label.ToCString(); |
19009 } | 19036 } |
19010 | 19037 |
19011 | 19038 |
19012 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19039 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
19013 Instance::PrintJSONImpl(stream, ref); | 19040 Instance::PrintJSONImpl(stream, ref); |
19014 } | 19041 } |
19015 | 19042 |
19016 | 19043 |
19017 } // namespace dart | 19044 } // namespace dart |
OLD | NEW |