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 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2687 const Class& owner = Class::Handle(closure_function.Owner()); | 2687 const Class& owner = Class::Handle(closure_function.Owner()); |
2688 Function& extractor = Function::Handle( | 2688 Function& extractor = Function::Handle( |
2689 Function::New(String::Handle(Symbols::New(getter_name)), | 2689 Function::New(String::Handle(Symbols::New(getter_name)), |
2690 RawFunction::kMethodExtractor, | 2690 RawFunction::kMethodExtractor, |
2691 false, // Not static. | 2691 false, // Not static. |
2692 false, // Not const. | 2692 false, // Not const. |
2693 false, // Not abstract. | 2693 false, // Not abstract. |
2694 false, // Not external. | 2694 false, // Not external. |
2695 false, // Not native. | 2695 false, // Not native. |
2696 owner, | 2696 owner, |
2697 0)); // token_pos | 2697 ClassifyingTokenPositions::kMethodExtractor)); // token_pos |
2698 | 2698 |
2699 // Initialize signature: receiver is a single fixed parameter. | 2699 // Initialize signature: receiver is a single fixed parameter. |
2700 const intptr_t kNumParameters = 1; | 2700 const intptr_t kNumParameters = 1; |
2701 extractor.set_num_fixed_parameters(kNumParameters); | 2701 extractor.set_num_fixed_parameters(kNumParameters); |
2702 extractor.SetNumOptionalParameters(0, 0); | 2702 extractor.SetNumOptionalParameters(0, 0); |
2703 extractor.set_parameter_types(Object::extractor_parameter_types()); | 2703 extractor.set_parameter_types(Object::extractor_parameter_types()); |
2704 extractor.set_parameter_names(Object::extractor_parameter_names()); | 2704 extractor.set_parameter_names(Object::extractor_parameter_names()); |
2705 extractor.set_result_type(Object::dynamic_type()); | 2705 extractor.set_result_type(Object::dynamic_type()); |
2706 | 2706 |
2707 extractor.set_extracted_method_closure(closure_function); | 2707 extractor.set_extracted_method_closure(closure_function); |
(...skipping 3072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5780 | 5780 |
5781 | 5781 |
5782 void Function::set_recognized_kind(MethodRecognizer::Kind value) const { | 5782 void Function::set_recognized_kind(MethodRecognizer::Kind value) const { |
5783 // Prevent multiple settings of kind. | 5783 // Prevent multiple settings of kind. |
5784 ASSERT((value == MethodRecognizer::kUnknown) || !IsRecognized()); | 5784 ASSERT((value == MethodRecognizer::kUnknown) || !IsRecognized()); |
5785 set_kind_tag(RecognizedBits::update(value, raw_ptr()->kind_tag_)); | 5785 set_kind_tag(RecognizedBits::update(value, raw_ptr()->kind_tag_)); |
5786 } | 5786 } |
5787 | 5787 |
5788 | 5788 |
5789 void Function::set_token_pos(intptr_t token_pos) const { | 5789 void Function::set_token_pos(intptr_t token_pos) const { |
5790 ASSERT(token_pos >= 0); | 5790 ASSERT((token_pos >= 0) || IsMethodExtractor()); |
5791 StoreNonPointer(&raw_ptr()->token_pos_, token_pos); | 5791 StoreNonPointer(&raw_ptr()->token_pos_, token_pos); |
5792 } | 5792 } |
5793 | 5793 |
5794 | 5794 |
5795 void Function::set_kind_tag(intptr_t value) const { | 5795 void Function::set_kind_tag(intptr_t value) const { |
5796 StoreNonPointer(&raw_ptr()->kind_tag_, static_cast<uint32_t>(value)); | 5796 StoreNonPointer(&raw_ptr()->kind_tag_, static_cast<uint32_t>(value)); |
5797 } | 5797 } |
5798 | 5798 |
5799 | 5799 |
5800 void Function::set_num_fixed_parameters(intptr_t value) const { | 5800 void Function::set_num_fixed_parameters(intptr_t value) const { |
(...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8540 : tokens_(TokenStream::Handle(tokens.raw())), | 8540 : tokens_(TokenStream::Handle(tokens.raw())), |
8541 data_(ExternalTypedData::Handle(tokens.GetStream())), | 8541 data_(ExternalTypedData::Handle(tokens.GetStream())), |
8542 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), | 8542 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), |
8543 token_objects_(Array::Handle( | 8543 token_objects_(Array::Handle( |
8544 GrowableObjectArray::Handle(tokens.TokenObjects()).data())), | 8544 GrowableObjectArray::Handle(tokens.TokenObjects()).data())), |
8545 obj_(Object::Handle()), | 8545 obj_(Object::Handle()), |
8546 cur_token_pos_(token_pos), | 8546 cur_token_pos_(token_pos), |
8547 cur_token_kind_(Token::kILLEGAL), | 8547 cur_token_kind_(Token::kILLEGAL), |
8548 cur_token_obj_index_(-1), | 8548 cur_token_obj_index_(-1), |
8549 stream_type_(stream_type) { | 8549 stream_type_(stream_type) { |
8550 SetCurrentPosition(token_pos); | 8550 ASSERT(token_pos != Scanner::kNoSourcePos); |
| 8551 if (token_pos >= 0) { |
| 8552 SetCurrentPosition(token_pos); |
| 8553 } |
8551 } | 8554 } |
8552 | 8555 |
8553 | 8556 |
8554 void TokenStream::Iterator::SetStream(const TokenStream& tokens, | 8557 void TokenStream::Iterator::SetStream(const TokenStream& tokens, |
8555 intptr_t token_pos) { | 8558 intptr_t token_pos) { |
8556 tokens_ = tokens.raw(); | 8559 tokens_ = tokens.raw(); |
8557 data_ = tokens.GetStream(); | 8560 data_ = tokens.GetStream(); |
8558 stream_.SetStream(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), | 8561 stream_.SetStream(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), |
8559 data_.Length()); | 8562 data_.Length()); |
8560 token_objects_ = GrowableObjectArray::Handle(tokens.TokenObjects()).data(); | 8563 token_objects_ = GrowableObjectArray::Handle(tokens.TokenObjects()).data(); |
(...skipping 13539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22100 return tag_label.ToCString(); | 22103 return tag_label.ToCString(); |
22101 } | 22104 } |
22102 | 22105 |
22103 | 22106 |
22104 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 22107 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
22105 Instance::PrintJSONImpl(stream, ref); | 22108 Instance::PrintJSONImpl(stream, ref); |
22106 } | 22109 } |
22107 | 22110 |
22108 | 22111 |
22109 } // namespace dart | 22112 } // namespace dart |
OLD | NEW |