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 "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "include/dart_tools_api.h" | 7 #include "include/dart_tools_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 const TokenStream& expected_tokens = | 862 const TokenStream& expected_tokens = |
863 TokenStream::Handle(zone, script.tokens()); | 863 TokenStream::Handle(zone, script.tokens()); |
864 TokenStream::Iterator expected_iterator( | 864 TokenStream::Iterator expected_iterator( |
865 zone, | 865 zone, |
866 expected_tokens, | 866 expected_tokens, |
867 TokenPosition::kMinSource, | 867 TokenPosition::kMinSource, |
868 TokenStream::Iterator::kAllTokens); | 868 TokenStream::Iterator::kAllTokens); |
869 const String& str = String::Handle(zone, expected_tokens.GenerateSource()); | 869 const String& str = String::Handle(zone, expected_tokens.GenerateSource()); |
870 const String& private_key = | 870 const String& private_key = |
871 String::Handle(zone, expected_tokens.PrivateKey()); | 871 String::Handle(zone, expected_tokens.PrivateKey()); |
872 Scanner scanner(str, private_key); | |
873 const TokenStream& reconstructed_tokens = | 872 const TokenStream& reconstructed_tokens = |
874 TokenStream::Handle(zone, TokenStream::New(scanner.GetStream(), | 873 TokenStream::Handle(zone, TokenStream::New(str, |
875 private_key, | 874 private_key, |
876 false)); | 875 false)); |
877 expected_iterator.SetCurrentPosition(TokenPosition::kMinSource); | 876 expected_iterator.SetCurrentPosition(TokenPosition::kMinSource); |
878 TokenStream::Iterator reconstructed_iterator( | 877 TokenStream::Iterator reconstructed_iterator( |
879 zone, | 878 zone, |
880 reconstructed_tokens, | 879 reconstructed_tokens, |
881 TokenPosition::kMinSource, | 880 TokenPosition::kMinSource, |
882 TokenStream::Iterator::kAllTokens); | 881 TokenStream::Iterator::kAllTokens); |
883 Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); | 882 Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); |
884 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); | 883 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); |
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 StackZone zone(Thread::Current()); | 3013 StackZone zone(Thread::Current()); |
3015 uint8_t* buffer; | 3014 uint8_t* buffer; |
3016 MessageWriter writer(&buffer, &zone_allocator, true); | 3015 MessageWriter writer(&buffer, &zone_allocator, true); |
3017 writer.WriteInlinedObjectHeader(kOmittedObjectId); | 3016 writer.WriteInlinedObjectHeader(kOmittedObjectId); |
3018 // For performance, we'd like single-byte headers when ids are omitted. | 3017 // For performance, we'd like single-byte headers when ids are omitted. |
3019 // If this starts failing, consider renumbering the snapshot ids. | 3018 // If this starts failing, consider renumbering the snapshot ids. |
3020 EXPECT_EQ(1, writer.BytesWritten()); | 3019 EXPECT_EQ(1, writer.BytesWritten()); |
3021 } | 3020 } |
3022 | 3021 |
3023 } // namespace dart | 3022 } // namespace dart |
OLD | NEW |