Chromium Code Reviews| 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/assembler.h" | 5 #include "vm/assembler.h" |
| 6 #include "vm/bigint_operations.h" | 6 #include "vm/bigint_operations.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2073 | 2073 |
| 2074 script.GetTokenLocation(4, &line, &col); // Token 'return' | 2074 script.GetTokenLocation(4, &line, &col); // Token 'return' |
| 2075 EXPECT_EQ(4, line); // 'return' is in line 4. | 2075 EXPECT_EQ(4, line); // 'return' is in line 4. |
| 2076 EXPECT_EQ(5, col); // Four spaces before 'return'. | 2076 EXPECT_EQ(5, col); // Four spaces before 'return'. |
| 2077 | 2077 |
| 2078 intptr_t first_idx, last_idx; | 2078 intptr_t first_idx, last_idx; |
| 2079 script.TokenRangeAtLine(3, &first_idx, &last_idx); | 2079 script.TokenRangeAtLine(3, &first_idx, &last_idx); |
| 2080 EXPECT_EQ(0, first_idx); // Token 'main' is first token. | 2080 EXPECT_EQ(0, first_idx); // Token 'main' is first token. |
| 2081 EXPECT_EQ(3, last_idx); // Token { is last token. | 2081 EXPECT_EQ(3, last_idx); // Token { is last token. |
| 2082 script.TokenRangeAtLine(5, &first_idx, &last_idx); | 2082 script.TokenRangeAtLine(5, &first_idx, &last_idx); |
| 2083 EXPECT_EQ(7, first_idx); // Token } is first and only token. | 2083 EXPECT_EQ(8, first_idx); // Token } is first and only token. |
|
hausner
2013/09/18 22:27:47
Why has this token index changed?
Michael Lippautz (Google)
2013/09/18 23:59:31
The source text contains 2 NL, hence 7->9 (previou
| |
| 2084 EXPECT_EQ(7, last_idx); | 2084 EXPECT_EQ(8, last_idx); |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 | 2087 |
| 2088 TEST_CASE(Context) { | 2088 TEST_CASE(Context) { |
| 2089 const int kNumVariables = 5; | 2089 const int kNumVariables = 5; |
| 2090 const Context& parent_context = Context::Handle(Context::New(0)); | 2090 const Context& parent_context = Context::Handle(Context::New(0)); |
| 2091 EXPECT_EQ(parent_context.isolate(), Isolate::Current()); | 2091 EXPECT_EQ(parent_context.isolate(), Isolate::Current()); |
| 2092 const Context& context = Context::Handle(Context::New(kNumVariables)); | 2092 const Context& context = Context::Handle(Context::New(kNumVariables)); |
| 2093 context.set_parent(parent_context); | 2093 context.set_parent(parent_context); |
| 2094 const Context& check_parent_context = Context::Handle(context.parent()); | 2094 const Context& check_parent_context = Context::Handle(context.parent()); |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3450 cls = Object::dynamic_class(); | 3450 cls = Object::dynamic_class(); |
| 3451 array = cls.fields(); | 3451 array = cls.fields(); |
| 3452 EXPECT(!array.IsNull()); | 3452 EXPECT(!array.IsNull()); |
| 3453 EXPECT(array.IsArray()); | 3453 EXPECT(array.IsArray()); |
| 3454 array = cls.functions(); | 3454 array = cls.functions(); |
| 3455 EXPECT(!array.IsNull()); | 3455 EXPECT(!array.IsNull()); |
| 3456 EXPECT(array.IsArray()); | 3456 EXPECT(array.IsArray()); |
| 3457 } | 3457 } |
| 3458 | 3458 |
| 3459 } // namespace dart | 3459 } // namespace dart |
| OLD | NEW |