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 6643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6654 | 6654 |
6655 RawString* TokenStream::PrivateKey() const { | 6655 RawString* TokenStream::PrivateKey() const { |
6656 return raw_ptr()->private_key_; | 6656 return raw_ptr()->private_key_; |
6657 } | 6657 } |
6658 | 6658 |
6659 | 6659 |
6660 void TokenStream::SetPrivateKey(const String& value) const { | 6660 void TokenStream::SetPrivateKey(const String& value) const { |
6661 StorePointer(&raw_ptr()->private_key_, value.raw()); | 6661 StorePointer(&raw_ptr()->private_key_, value.raw()); |
6662 } | 6662 } |
6663 | 6663 |
| 6664 RawString* TokenStream::GenerateSource() const { |
| 6665 return GenerateSource(0, kMaxElements); |
| 6666 } |
6664 | 6667 |
6665 RawString* TokenStream::GenerateSource() const { | 6668 RawString* TokenStream::GenerateSource(intptr_t start_pos, |
6666 Iterator iterator(*this, 0, Iterator::kAllTokens); | 6669 intptr_t end_pos) const { |
| 6670 Iterator iterator(*this, start_pos, Iterator::kAllTokens); |
6667 const ExternalTypedData& data = ExternalTypedData::Handle(GetStream()); | 6671 const ExternalTypedData& data = ExternalTypedData::Handle(GetStream()); |
6668 const GrowableObjectArray& literals = | 6672 const GrowableObjectArray& literals = |
6669 GrowableObjectArray::Handle(GrowableObjectArray::New(data.Length())); | 6673 GrowableObjectArray::Handle(GrowableObjectArray::New(data.Length())); |
6670 const String& private_key = String::Handle(PrivateKey()); | 6674 const String& private_key = String::Handle(PrivateKey()); |
6671 intptr_t private_len = private_key.Length(); | 6675 intptr_t private_len = private_key.Length(); |
6672 | 6676 |
6673 Token::Kind curr = iterator.CurrentTokenKind(); | 6677 Token::Kind curr = iterator.CurrentTokenKind(); |
6674 Token::Kind prev = Token::kILLEGAL; | 6678 Token::Kind prev = Token::kILLEGAL; |
6675 // Handles used in the loop. | 6679 // Handles used in the loop. |
6676 Object& obj = Object::Handle(); | 6680 Object& obj = Object::Handle(); |
6677 String& literal = String::Handle(); | 6681 String& literal = String::Handle(); |
6678 // Current indentation level. | 6682 // Current indentation level. |
6679 int indent = 0; | 6683 int indent = 0; |
6680 | 6684 |
6681 while (curr != Token::kEOS) { | 6685 while ((curr != Token::kEOS) && (iterator.CurrentPosition() < end_pos)) { |
6682 // Remember current values for this token. | 6686 // Remember current values for this token. |
6683 obj = iterator.CurrentToken(); | 6687 obj = iterator.CurrentToken(); |
6684 literal = iterator.MakeLiteralToken(obj); | 6688 literal = iterator.MakeLiteralToken(obj); |
6685 // Advance to be able to use next token kind. | 6689 // Advance to be able to use next token kind. |
6686 iterator.Advance(); | 6690 iterator.Advance(); |
6687 Token::Kind next = iterator.CurrentTokenKind(); | 6691 Token::Kind next = iterator.CurrentTokenKind(); |
6688 | 6692 |
6689 // Handle the current token. | 6693 // Handle the current token. |
6690 if (curr == Token::kSTRING) { | 6694 if (curr == Token::kSTRING) { |
6691 bool escape_characters = false; | 6695 bool escape_characters = false; |
(...skipping 10624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17316 return "_MirrorReference"; | 17320 return "_MirrorReference"; |
17317 } | 17321 } |
17318 | 17322 |
17319 | 17323 |
17320 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17324 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
17321 Instance::PrintToJSONStream(stream, ref); | 17325 Instance::PrintToJSONStream(stream, ref); |
17322 } | 17326 } |
17323 | 17327 |
17324 | 17328 |
17325 } // namespace dart | 17329 } // namespace dart |
OLD | NEW |