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 "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 LocalScope* parent_scope = | 2528 LocalScope* parent_scope = |
2529 new LocalScope(NULL, parent_scope_function_level, 0); | 2529 new LocalScope(NULL, parent_scope_function_level, 0); |
2530 | 2530 |
2531 const intptr_t local_scope_function_level = 1; | 2531 const intptr_t local_scope_function_level = 1; |
2532 LocalScope* local_scope = | 2532 LocalScope* local_scope = |
2533 new LocalScope(parent_scope, local_scope_function_level, 0); | 2533 new LocalScope(parent_scope, local_scope_function_level, 0); |
2534 | 2534 |
2535 const Type& dynamic_type = Type::ZoneHandle(Type::DynamicType()); | 2535 const Type& dynamic_type = Type::ZoneHandle(Type::DynamicType()); |
2536 const String& a = String::ZoneHandle(Symbols::New(thread, "a")); | 2536 const String& a = String::ZoneHandle(Symbols::New(thread, "a")); |
2537 LocalVariable* var_a = | 2537 LocalVariable* var_a = |
2538 new LocalVariable(TokenPosition::kNoSource, a, dynamic_type); | 2538 new LocalVariable(TokenPosition::kNoSource, |
| 2539 TokenPosition::kNoSource, |
| 2540 a, |
| 2541 dynamic_type); |
2539 parent_scope->AddVariable(var_a); | 2542 parent_scope->AddVariable(var_a); |
2540 | 2543 |
2541 const String& b = String::ZoneHandle(Symbols::New(thread, "b")); | 2544 const String& b = String::ZoneHandle(Symbols::New(thread, "b")); |
2542 LocalVariable* var_b = | 2545 LocalVariable* var_b = |
2543 new LocalVariable(TokenPosition::kNoSource, b, dynamic_type); | 2546 new LocalVariable(TokenPosition::kNoSource, |
| 2547 TokenPosition::kNoSource, |
| 2548 b, |
| 2549 dynamic_type); |
2544 local_scope->AddVariable(var_b); | 2550 local_scope->AddVariable(var_b); |
2545 | 2551 |
2546 const String& c = String::ZoneHandle(Symbols::New(thread, "c")); | 2552 const String& c = String::ZoneHandle(Symbols::New(thread, "c")); |
2547 LocalVariable* var_c = | 2553 LocalVariable* var_c = |
2548 new LocalVariable(TokenPosition::kNoSource, c, dynamic_type); | 2554 new LocalVariable(TokenPosition::kNoSource, |
| 2555 TokenPosition::kNoSource, |
| 2556 c, |
| 2557 dynamic_type); |
2549 parent_scope->AddVariable(var_c); | 2558 parent_scope->AddVariable(var_c); |
2550 | 2559 |
2551 bool test_only = false; // Please, insert alias. | 2560 bool test_only = false; // Please, insert alias. |
2552 var_a = local_scope->LookupVariable(a, test_only); | 2561 var_a = local_scope->LookupVariable(a, test_only); |
2553 EXPECT(var_a->is_captured()); | 2562 EXPECT(var_a->is_captured()); |
2554 EXPECT_EQ(parent_scope_function_level, var_a->owner()->function_level()); | 2563 EXPECT_EQ(parent_scope_function_level, var_a->owner()->function_level()); |
2555 EXPECT(local_scope->LocalLookupVariable(a) == var_a); // Alias. | 2564 EXPECT(local_scope->LocalLookupVariable(a) == var_a); // Alias. |
2556 | 2565 |
2557 var_b = local_scope->LookupVariable(b, test_only); | 2566 var_b = local_scope->LookupVariable(b, test_only); |
2558 EXPECT(!var_b->is_captured()); | 2567 EXPECT(!var_b->is_captured()); |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4735 int32_t char_codes[] = { | 4744 int32_t char_codes[] = { |
4736 0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff | 4745 0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff |
4737 }; | 4746 }; |
4738 | 4747 |
4739 const String& str = | 4748 const String& str = |
4740 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); | 4749 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); |
4741 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); | 4750 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); |
4742 } | 4751 } |
4743 | 4752 |
4744 } // namespace dart | 4753 } // namespace dart |
OLD | NEW |