OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/assert.h" | 5 #include "vm/assert.h" |
6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 TEST_CASE(ContextScope) { | 1645 TEST_CASE(ContextScope) { |
1646 const intptr_t kPos = 1; // Dummy token index in non-existing source. | 1646 const intptr_t kPos = 1; // Dummy token index in non-existing source. |
1647 const intptr_t parent_scope_function_level = 0; | 1647 const intptr_t parent_scope_function_level = 0; |
1648 LocalScope* parent_scope = | 1648 LocalScope* parent_scope = |
1649 new LocalScope(NULL, parent_scope_function_level, 0); | 1649 new LocalScope(NULL, parent_scope_function_level, 0); |
1650 | 1650 |
1651 const intptr_t local_scope_function_level = 1; | 1651 const intptr_t local_scope_function_level = 1; |
1652 LocalScope* local_scope = | 1652 LocalScope* local_scope = |
1653 new LocalScope(parent_scope, local_scope_function_level, 0); | 1653 new LocalScope(parent_scope, local_scope_function_level, 0); |
1654 | 1654 |
1655 const Type& var_type = Type::ZoneHandle(Type::VarType()); | 1655 const Type& dynamic_type = Type::ZoneHandle(Type::DynamicType()); |
1656 const String& a = String::ZoneHandle(String::New("a")); | 1656 const String& a = String::ZoneHandle(String::New("a")); |
1657 LocalVariable* var_a = new LocalVariable(kPos, a, var_type); | 1657 LocalVariable* var_a = new LocalVariable(kPos, a, dynamic_type); |
1658 parent_scope->AddVariable(var_a); | 1658 parent_scope->AddVariable(var_a); |
1659 | 1659 |
1660 const String& b = String::ZoneHandle(String::New("b")); | 1660 const String& b = String::ZoneHandle(String::New("b")); |
1661 LocalVariable* var_b = new LocalVariable(kPos, b, var_type); | 1661 LocalVariable* var_b = new LocalVariable(kPos, b, dynamic_type); |
1662 local_scope->AddVariable(var_b); | 1662 local_scope->AddVariable(var_b); |
1663 | 1663 |
1664 const String& c = String::ZoneHandle(String::New("c")); | 1664 const String& c = String::ZoneHandle(String::New("c")); |
1665 LocalVariable* var_c = new LocalVariable(kPos, c, var_type); | 1665 LocalVariable* var_c = new LocalVariable(kPos, c, dynamic_type); |
1666 parent_scope->AddVariable(var_c); | 1666 parent_scope->AddVariable(var_c); |
1667 | 1667 |
1668 bool test_only = false; // Please, insert alias. | 1668 bool test_only = false; // Please, insert alias. |
1669 var_a = local_scope->LookupVariable(a, test_only); | 1669 var_a = local_scope->LookupVariable(a, test_only); |
1670 EXPECT(var_a->is_captured()); | 1670 EXPECT(var_a->is_captured()); |
1671 EXPECT_EQ(parent_scope_function_level, var_a->owner()->function_level()); | 1671 EXPECT_EQ(parent_scope_function_level, var_a->owner()->function_level()); |
1672 EXPECT(local_scope->LocalLookupVariable(a) == var_a); // Alias. | 1672 EXPECT(local_scope->LocalLookupVariable(a) == var_a); // Alias. |
1673 | 1673 |
1674 var_b = local_scope->LookupVariable(b, test_only); | 1674 var_b = local_scope->LookupVariable(b, test_only); |
1675 EXPECT(!var_b->is_captured()); | 1675 EXPECT(!var_b->is_captured()); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 cls = iterator.GetNextClass(); | 1950 cls = iterator.GetNextClass(); |
1951 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); | 1951 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); |
1952 count++; | 1952 count++; |
1953 } | 1953 } |
1954 ASSERT(count == 2); | 1954 ASSERT(count == 2); |
1955 } | 1955 } |
1956 | 1956 |
1957 #endif // TARGET_ARCH_IA32. | 1957 #endif // TARGET_ARCH_IA32. |
1958 | 1958 |
1959 } // namespace dart | 1959 } // namespace dart |
OLD | NEW |