| 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/assert.h" | |
| 6 #include "vm/assembler.h" | 5 #include "vm/assembler.h" |
| 7 #include "vm/bigint_operations.h" | 6 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 11 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| 12 #include "vm/object.h" | 11 #include "vm/object.h" |
| 13 #include "vm/object_store.h" | 12 #include "vm/object_store.h" |
| 14 #include "vm/simulator.h" | 13 #include "vm/simulator.h" |
| 15 #include "vm/symbols.h" | 14 #include "vm/symbols.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 TypeArguments::New(2)); | 132 TypeArguments::New(2)); |
| 134 type_arguments1.SetTypeAt(0, type1); | 133 type_arguments1.SetTypeAt(0, type1); |
| 135 type_arguments1.SetTypeAt(1, type2); | 134 type_arguments1.SetTypeAt(1, type2); |
| 136 const TypeArguments& type_arguments2 = TypeArguments::Handle( | 135 const TypeArguments& type_arguments2 = TypeArguments::Handle( |
| 137 TypeArguments::New(2)); | 136 TypeArguments::New(2)); |
| 138 type_arguments2.SetTypeAt(0, type1); | 137 type_arguments2.SetTypeAt(0, type1); |
| 139 type_arguments2.SetTypeAt(1, type2); | 138 type_arguments2.SetTypeAt(1, type2); |
| 140 EXPECT_NE(type_arguments1.raw(), type_arguments2.raw()); | 139 EXPECT_NE(type_arguments1.raw(), type_arguments2.raw()); |
| 141 OS::Print("1: %s\n", type_arguments1.ToCString()); | 140 OS::Print("1: %s\n", type_arguments1.ToCString()); |
| 142 OS::Print("2: %s\n", type_arguments2.ToCString()); | 141 OS::Print("2: %s\n", type_arguments2.ToCString()); |
| 143 ASSERT(type_arguments1.Equals(type_arguments2)); | 142 EXPECT(type_arguments1.Equals(type_arguments2)); |
| 144 TypeArguments& type_arguments3 = TypeArguments::Handle(); | 143 TypeArguments& type_arguments3 = TypeArguments::Handle(); |
| 145 type_arguments1.Canonicalize(); | 144 type_arguments1.Canonicalize(); |
| 146 type_arguments3 ^= type_arguments2.Canonicalize(); | 145 type_arguments3 ^= type_arguments2.Canonicalize(); |
| 147 EXPECT_EQ(type_arguments1.raw(), type_arguments3.raw()); | 146 EXPECT_EQ(type_arguments1.raw(), type_arguments3.raw()); |
| 148 } | 147 } |
| 149 | 148 |
| 150 | 149 |
| 151 TEST_CASE(TokenStream) { | 150 TEST_CASE(TokenStream) { |
| 152 String& source = String::Handle(String::New("= ( 9 , .")); | 151 String& source = String::Handle(String::New("= ( 9 , .")); |
| 153 String& private_key = String::Handle(String::New("")); | 152 String& private_key = String::Handle(String::New("")); |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 | 1666 |
| 1668 other_array = Array::New(kArrayLen - 1); | 1667 other_array = Array::New(kArrayLen - 1); |
| 1669 other_array.SetAt(0, array); | 1668 other_array.SetAt(0, array); |
| 1670 other_array.SetAt(2, array); | 1669 other_array.SetAt(2, array); |
| 1671 EXPECT(!array.Equals(other_array)); | 1670 EXPECT(!array.Equals(other_array)); |
| 1672 | 1671 |
| 1673 EXPECT_EQ(0, Object::empty_array().Length()); | 1672 EXPECT_EQ(0, Object::empty_array().Length()); |
| 1674 | 1673 |
| 1675 array.MakeImmutable(); | 1674 array.MakeImmutable(); |
| 1676 Object& obj = Object::Handle(array.raw()); | 1675 Object& obj = Object::Handle(array.raw()); |
| 1677 ASSERT(obj.IsArray()); | 1676 EXPECT(obj.IsArray()); |
| 1678 } | 1677 } |
| 1679 | 1678 |
| 1680 | 1679 |
| 1681 TEST_CASE(StringCodePointIterator) { | 1680 TEST_CASE(StringCodePointIterator) { |
| 1682 const String& str0 = String::Handle(String::New("")); | 1681 const String& str0 = String::Handle(String::New("")); |
| 1683 String::CodePointIterator it0(str0); | 1682 String::CodePointIterator it0(str0); |
| 1684 EXPECT(!it0.Next()); | 1683 EXPECT(!it0.Next()); |
| 1685 | 1684 |
| 1686 const String& str1 = String::Handle(String::New(" \xc3\xa7 ")); | 1685 const String& str1 = String::Handle(String::New(" \xc3\xa7 ")); |
| 1687 String::CodePointIterator it1(str1); | 1686 String::CodePointIterator it1(str1); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 /* 4 */ " return 'foo';\n" | 2010 /* 4 */ " return 'foo';\n" |
| 2012 /* 5 */ " }\n" | 2011 /* 5 */ " }\n" |
| 2013 /* 6 */ "</script>\n"; | 2012 /* 6 */ "</script>\n"; |
| 2014 const char* line1 = text; | 2013 const char* line1 = text; |
| 2015 const char* line2 = strstr(line1, "\n") + 1; | 2014 const char* line2 = strstr(line1, "\n") + 1; |
| 2016 const char* line3 = strstr(line2, "\n") + 1; | 2015 const char* line3 = strstr(line2, "\n") + 1; |
| 2017 const char* line4 = strstr(line3, "\n") + 1; | 2016 const char* line4 = strstr(line3, "\n") + 1; |
| 2018 const char* line5 = strstr(line4, "\n") + 1; | 2017 const char* line5 = strstr(line4, "\n") + 1; |
| 2019 | 2018 |
| 2020 const int first_dart_line = 3; | 2019 const int first_dart_line = 3; |
| 2021 ASSERT(strstr(line3, "main") != NULL); | 2020 EXPECT(strstr(line3, "main") != NULL); |
| 2022 const int last_dart_line = 5; | 2021 const int last_dart_line = 5; |
| 2023 ASSERT(strstr(line5, "}") != NULL); | 2022 EXPECT(strstr(line5, "}") != NULL); |
| 2024 | 2023 |
| 2025 const char* script_begin = strstr(text, "main"); | 2024 const char* script_begin = strstr(text, "main"); |
| 2026 ASSERT(script_begin != NULL); | 2025 EXPECT(script_begin != NULL); |
| 2027 const char* script_end = strstr(text, "</script>"); | 2026 const char* script_end = strstr(text, "</script>"); |
| 2028 ASSERT(script_end != NULL); | 2027 EXPECT(script_end != NULL); |
| 2029 int script_length = script_end - script_begin; | 2028 int script_length = script_end - script_begin; |
| 2030 ASSERT(script_length > 0); | 2029 EXPECT(script_length > 0); |
| 2031 | 2030 |
| 2032 // The Dart script starts on line 3 instead of 1, offset is 3 - 1 = 2. | 2031 // The Dart script starts on line 3 instead of 1, offset is 3 - 1 = 2. |
| 2033 int line_offset = 2; | 2032 int line_offset = 2; |
| 2034 // Dart script starts with "main" on line 3. | 2033 // Dart script starts with "main" on line 3. |
| 2035 intptr_t col_offset = script_begin - line3; | 2034 intptr_t col_offset = script_begin - line3; |
| 2036 ASSERT(col_offset > 0); | 2035 EXPECT(col_offset > 0); |
| 2037 | 2036 |
| 2038 char* src_chars = strdup(script_begin); | 2037 char* src_chars = strdup(script_begin); |
| 2039 src_chars[script_length] = '\0'; | 2038 src_chars[script_length] = '\0'; |
| 2040 | 2039 |
| 2041 const String& url = String::Handle(String::New(url_chars)); | 2040 const String& url = String::Handle(String::New(url_chars)); |
| 2042 const String& source = String::Handle(String::New(src_chars)); | 2041 const String& source = String::Handle(String::New(src_chars)); |
| 2043 const Script& script = Script::Handle( | 2042 const Script& script = Script::Handle( |
| 2044 Script::New(url, source, RawScript::kScriptTag)); | 2043 Script::New(url, source, RawScript::kScriptTag)); |
| 2045 script.SetLocationOffset(line_offset, col_offset); | 2044 script.SetLocationOffset(line_offset, col_offset); |
| 2046 | 2045 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 Library& lib = Library::Handle(Library::New(url)); | 2457 Library& lib = Library::Handle(Library::New(url)); |
| 2459 lib.AddClass(ae66); | 2458 lib.AddClass(ae66); |
| 2460 lib.AddObject(ce68, String::ZoneHandle(ce68.name())); | 2459 lib.AddObject(ce68, String::ZoneHandle(ce68.name())); |
| 2461 lib.AddClass(re44); | 2460 lib.AddClass(re44); |
| 2462 lib.AddObject(tee, String::ZoneHandle(tee.name())); | 2461 lib.AddObject(tee, String::ZoneHandle(tee.name())); |
| 2463 ClassDictionaryIterator iterator(lib); | 2462 ClassDictionaryIterator iterator(lib); |
| 2464 int count = 0; | 2463 int count = 0; |
| 2465 Class& cls = Class::Handle(); | 2464 Class& cls = Class::Handle(); |
| 2466 while (iterator.HasNext()) { | 2465 while (iterator.HasNext()) { |
| 2467 cls = iterator.GetNextClass(); | 2466 cls = iterator.GetNextClass(); |
| 2468 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); | 2467 EXPECT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); |
| 2469 count++; | 2468 count++; |
| 2470 } | 2469 } |
| 2471 ASSERT(count == 2); | 2470 EXPECT(count == 2); |
| 2472 } | 2471 } |
| 2473 | 2472 |
| 2474 | 2473 |
| 2475 static RawFunction* GetDummyTarget(const char* name) { | 2474 static RawFunction* GetDummyTarget(const char* name) { |
| 2476 const String& function_name = String::Handle(Symbols::New(name)); | 2475 const String& function_name = String::Handle(Symbols::New(name)); |
| 2477 const Class& cls = Class::Handle( | 2476 const Class& cls = Class::Handle( |
| 2478 CreateDummyClass(function_name, Script::Handle())); | 2477 CreateDummyClass(function_name, Script::Handle())); |
| 2479 const bool is_static = false; | 2478 const bool is_static = false; |
| 2480 const bool is_const = false; | 2479 const bool is_const = false; |
| 2481 const bool is_abstract = false; | 2480 const bool is_abstract = false; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 EXPECT_EQ(target1.raw(), scall_icdata.GetTargetAt(0)); | 2552 EXPECT_EQ(target1.raw(), scall_icdata.GetTargetAt(0)); |
| 2554 } | 2553 } |
| 2555 | 2554 |
| 2556 | 2555 |
| 2557 TEST_CASE(SubtypeTestCache) { | 2556 TEST_CASE(SubtypeTestCache) { |
| 2558 String& class_name = String::Handle(Symbols::New("EmptyClass")); | 2557 String& class_name = String::Handle(Symbols::New("EmptyClass")); |
| 2559 Script& script = Script::Handle(); | 2558 Script& script = Script::Handle(); |
| 2560 const Class& empty_class = | 2559 const Class& empty_class = |
| 2561 Class::Handle(CreateDummyClass(class_name, script)); | 2560 Class::Handle(CreateDummyClass(class_name, script)); |
| 2562 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New()); | 2561 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New()); |
| 2563 ASSERT(!cache.IsNull()); | 2562 EXPECT(!cache.IsNull()); |
| 2564 EXPECT_EQ(0, cache.NumberOfChecks()); | 2563 EXPECT_EQ(0, cache.NumberOfChecks()); |
| 2565 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2)); | 2564 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2)); |
| 2566 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3)); | 2565 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3)); |
| 2567 cache.AddCheck(empty_class.id(), targ_0, targ_1, Bool::True()); | 2566 cache.AddCheck(empty_class.id(), targ_0, targ_1, Bool::True()); |
| 2568 EXPECT_EQ(1, cache.NumberOfChecks()); | 2567 EXPECT_EQ(1, cache.NumberOfChecks()); |
| 2569 intptr_t test_class_id = -1; | 2568 intptr_t test_class_id = -1; |
| 2570 AbstractTypeArguments& test_targ_0 = AbstractTypeArguments::Handle(); | 2569 AbstractTypeArguments& test_targ_0 = AbstractTypeArguments::Handle(); |
| 2571 AbstractTypeArguments& test_targ_1 = AbstractTypeArguments::Handle(); | 2570 AbstractTypeArguments& test_targ_1 = AbstractTypeArguments::Handle(); |
| 2572 Bool& test_result = Bool::Handle(); | 2571 Bool& test_result = Bool::Handle(); |
| 2573 cache.GetCheck(0, &test_class_id, &test_targ_0, &test_targ_1, &test_result); | 2572 cache.GetCheck(0, &test_class_id, &test_targ_0, &test_targ_1, &test_result); |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3194 EXPECT_EQ(returned_referent.raw(), library.raw()); | 3193 EXPECT_EQ(returned_referent.raw(), library.raw()); |
| 3195 | 3194 |
| 3196 const MirrorReference& other_reference = | 3195 const MirrorReference& other_reference = |
| 3197 MirrorReference::Handle(MirrorReference::New()); | 3196 MirrorReference::Handle(MirrorReference::New()); |
| 3198 EXPECT_NE(reference.raw(), other_reference.raw()); | 3197 EXPECT_NE(reference.raw(), other_reference.raw()); |
| 3199 other_reference.set_referent(library); | 3198 other_reference.set_referent(library); |
| 3200 EXPECT_NE(reference.raw(), other_reference.raw()); | 3199 EXPECT_NE(reference.raw(), other_reference.raw()); |
| 3201 EXPECT_EQ(reference.referent(), other_reference.referent()); | 3200 EXPECT_EQ(reference.referent(), other_reference.referent()); |
| 3202 | 3201 |
| 3203 Object& obj = Object::Handle(reference.raw()); | 3202 Object& obj = Object::Handle(reference.raw()); |
| 3204 ASSERT(obj.IsMirrorReference()); | 3203 EXPECT(obj.IsMirrorReference()); |
| 3205 } | 3204 } |
| 3206 | 3205 |
| 3207 | 3206 |
| 3208 static RawFunction* GetFunction(const Class& cls, const char* name) { | 3207 static RawFunction* GetFunction(const Class& cls, const char* name) { |
| 3209 const Function& result = Function::Handle(cls.LookupDynamicFunction( | 3208 const Function& result = Function::Handle(cls.LookupDynamicFunction( |
| 3210 String::Handle(String::New(name)))); | 3209 String::Handle(String::New(name)))); |
| 3211 ASSERT(!result.IsNull()); | 3210 EXPECT(!result.IsNull()); |
| 3212 return result.raw(); | 3211 return result.raw(); |
| 3213 } | 3212 } |
| 3214 | 3213 |
| 3215 | 3214 |
| 3216 static RawField* GetField(const Class& cls, const char* name) { | 3215 static RawField* GetField(const Class& cls, const char* name) { |
| 3217 const Field& field = | 3216 const Field& field = |
| 3218 Field::Handle(cls.LookupField(String::Handle(String::New(name)))); | 3217 Field::Handle(cls.LookupField(String::Handle(String::New(name)))); |
| 3219 ASSERT(!field.IsNull()); | 3218 EXPECT(!field.IsNull()); |
| 3220 return field.raw(); | 3219 return field.raw(); |
| 3221 } | 3220 } |
| 3222 | 3221 |
| 3223 | 3222 |
| 3224 static RawClass* GetClass(const Library& lib, const char* name) { | 3223 static RawClass* GetClass(const Library& lib, const char* name) { |
| 3225 const Class& cls = | 3224 String& ambiguity_error_msg = String::Handle(); |
| 3226 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(name)))); | 3225 const Class& cls = Class::Handle( |
| 3227 ASSERT(!cls.IsNull()); | 3226 lib.LookupClass(String::Handle(Symbols::New(name)), |
| 3227 &ambiguity_error_msg)); |
| 3228 EXPECT(!cls.IsNull()); // No ambiguity error expected. |
| 3228 return cls.raw(); | 3229 return cls.raw(); |
| 3229 } | 3230 } |
| 3230 | 3231 |
| 3231 | 3232 |
| 3232 static void PrintMetadata(const char* name, const Object& data) { | 3233 static void PrintMetadata(const char* name, const Object& data) { |
| 3233 if (data.IsError()) { | 3234 if (data.IsError()) { |
| 3234 OS::Print("Error in metadata evaluation for %s: '%s'\n", | 3235 OS::Print("Error in metadata evaluation for %s: '%s'\n", |
| 3235 name, | 3236 name, |
| 3236 Error::Cast(data).ToErrorCString()); | 3237 Error::Cast(data).ToErrorCString()); |
| 3237 } | 3238 } |
| 3238 ASSERT(data.IsArray()); | 3239 EXPECT(data.IsArray()); |
| 3239 const Array& metadata = Array::Cast(data); | 3240 const Array& metadata = Array::Cast(data); |
| 3240 OS::Print("Metadata for %s has %"Pd" values:\n", name, metadata.Length()); | 3241 OS::Print("Metadata for %s has %"Pd" values:\n", name, metadata.Length()); |
| 3241 Object& elem = Object::Handle(); | 3242 Object& elem = Object::Handle(); |
| 3242 for (int i = 0; i < metadata.Length(); i++) { | 3243 for (int i = 0; i < metadata.Length(); i++) { |
| 3243 elem = metadata.At(i); | 3244 elem = metadata.At(i); |
| 3244 OS::Print(" %d: %s\n", i, elem.ToCString()); | 3245 OS::Print(" %d: %s\n", i, elem.ToCString()); |
| 3245 } | 3246 } |
| 3246 } | 3247 } |
| 3247 | 3248 |
| 3248 | 3249 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3278 "A main() { \n" | 3279 "A main() { \n" |
| 3279 " return new A(); \n" | 3280 " return new A(); \n" |
| 3280 "} \n"; | 3281 "} \n"; |
| 3281 | 3282 |
| 3282 Dart_Handle h_lib = TestCase::LoadTestScript(kScriptChars, NULL); | 3283 Dart_Handle h_lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 3283 EXPECT_VALID(h_lib); | 3284 EXPECT_VALID(h_lib); |
| 3284 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); | 3285 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); |
| 3285 EXPECT_VALID(result); | 3286 EXPECT_VALID(result); |
| 3286 Library& lib = Library::Handle(); | 3287 Library& lib = Library::Handle(); |
| 3287 lib ^= Api::UnwrapHandle(h_lib); | 3288 lib ^= Api::UnwrapHandle(h_lib); |
| 3288 ASSERT(!lib.IsNull()); | 3289 EXPECT(!lib.IsNull()); |
| 3289 const Class& class_a = Class::Handle(GetClass(lib, "A")); | 3290 const Class& class_a = Class::Handle(GetClass(lib, "A")); |
| 3290 Object& res = Object::Handle(lib.GetMetadata(class_a)); | 3291 Object& res = Object::Handle(lib.GetMetadata(class_a)); |
| 3291 PrintMetadata("A", res); | 3292 PrintMetadata("A", res); |
| 3292 | 3293 |
| 3293 const Class& class_meta = Class::Handle(GetClass(lib, "Meta")); | 3294 const Class& class_meta = Class::Handle(GetClass(lib, "Meta")); |
| 3294 res = lib.GetMetadata(class_meta); | 3295 res = lib.GetMetadata(class_meta); |
| 3295 PrintMetadata("Meta", res); | 3296 PrintMetadata("Meta", res); |
| 3296 | 3297 |
| 3297 Field& field = Field::Handle(GetField(class_a, "aField")); | 3298 Field& field = Field::Handle(GetField(class_a, "aField")); |
| 3298 res = lib.GetMetadata(field); | 3299 res = lib.GetMetadata(field); |
| 3299 PrintMetadata("A.aField", res); | 3300 PrintMetadata("A.aField", res); |
| 3300 | 3301 |
| 3301 Function& func = Function::Handle(GetFunction(class_a, "aFunc")); | 3302 Function& func = Function::Handle(GetFunction(class_a, "aFunc")); |
| 3302 res = lib.GetMetadata(func); | 3303 res = lib.GetMetadata(func); |
| 3303 PrintMetadata("A.aFunc", res); | 3304 PrintMetadata("A.aFunc", res); |
| 3304 | 3305 |
| 3305 func = lib.LookupLocalFunction(String::Handle(Symbols::New("main"))); | 3306 func = lib.LookupLocalFunction(String::Handle(Symbols::New("main"))); |
| 3306 ASSERT(!func.IsNull()); | 3307 EXPECT(!func.IsNull()); |
| 3307 res = lib.GetMetadata(func); | 3308 res = lib.GetMetadata(func); |
| 3308 PrintMetadata("main", res); | 3309 PrintMetadata("main", res); |
| 3309 | 3310 |
| 3310 func = lib.LookupLocalFunction(String::Handle(Symbols::New("get:tlGetter"))); | 3311 func = lib.LookupLocalFunction(String::Handle(Symbols::New("get:tlGetter"))); |
| 3311 ASSERT(!func.IsNull()); | 3312 EXPECT(!func.IsNull()); |
| 3312 res = lib.GetMetadata(func); | 3313 res = lib.GetMetadata(func); |
| 3313 PrintMetadata("tlGetter", res); | 3314 PrintMetadata("tlGetter", res); |
| 3314 | 3315 |
| 3315 field = lib.LookupLocalField(String::Handle(Symbols::New("gVar"))); | 3316 field = lib.LookupLocalField(String::Handle(Symbols::New("gVar"))); |
| 3316 ASSERT(!field.IsNull()); | 3317 EXPECT(!field.IsNull()); |
| 3317 res = lib.GetMetadata(field); | 3318 res = lib.GetMetadata(field); |
| 3318 PrintMetadata("gVar", res); | 3319 PrintMetadata("gVar", res); |
| 3319 } | 3320 } |
| 3320 | 3321 |
| 3321 | 3322 |
| 3322 TEST_CASE(FunctionSourceFingerprint) { | 3323 TEST_CASE(FunctionSourceFingerprint) { |
| 3323 const char* kScriptChars = | 3324 const char* kScriptChars = |
| 3324 "class A {\n" | 3325 "class A {\n" |
| 3325 " void test1(int a) {\n" | 3326 " void test1(int a) {\n" |
| 3326 " return a > 1 ? a + 1 : a;\n" | 3327 " return a > 1 ? a + 1 : a;\n" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3345 " b - 2 : b;\n" | 3346 " b - 2 : b;\n" |
| 3346 " }\n" | 3347 " }\n" |
| 3347 "}"; | 3348 "}"; |
| 3348 TestCase::LoadTestScript(kScriptChars, NULL); | 3349 TestCase::LoadTestScript(kScriptChars, NULL); |
| 3349 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 3350 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 3350 const String& name = String::Handle(String::New(TestCase::url())); | 3351 const String& name = String::Handle(String::New(TestCase::url())); |
| 3351 const Library& lib = Library::Handle(Library::LookupLibrary(name)); | 3352 const Library& lib = Library::Handle(Library::LookupLibrary(name)); |
| 3352 EXPECT(!lib.IsNull()); | 3353 EXPECT(!lib.IsNull()); |
| 3353 | 3354 |
| 3354 const Class& class_a = Class::Handle( | 3355 const Class& class_a = Class::Handle( |
| 3355 lib.LookupClass(String::Handle(Symbols::New("A")))); | 3356 lib.LookupClass(String::Handle(Symbols::New("A")), NULL)); |
| 3356 const Function& test1 = Function::Handle(GetFunction(class_a, "test1")); | 3357 const Function& test1 = Function::Handle(GetFunction(class_a, "test1")); |
| 3357 const Function& test2 = Function::Handle(GetFunction(class_a, "test2")); | 3358 const Function& test2 = Function::Handle(GetFunction(class_a, "test2")); |
| 3358 const Function& test3 = Function::Handle(GetFunction(class_a, "test3")); | 3359 const Function& test3 = Function::Handle(GetFunction(class_a, "test3")); |
| 3359 const Function& test4 = Function::Handle(GetFunction(class_a, "test4")); | 3360 const Function& test4 = Function::Handle(GetFunction(class_a, "test4")); |
| 3360 const Function& test5 = Function::Handle(GetFunction(class_a, "test5")); | 3361 const Function& test5 = Function::Handle(GetFunction(class_a, "test5")); |
| 3361 const Function& test6 = Function::Handle(GetFunction(class_a, "test6")); | 3362 const Function& test6 = Function::Handle(GetFunction(class_a, "test6")); |
| 3362 const Function& test7 = Function::Handle(GetFunction(class_a, "test7")); | 3363 const Function& test7 = Function::Handle(GetFunction(class_a, "test7")); |
| 3363 EXPECT_EQ(test1.SourceFingerprint(), test2.SourceFingerprint()); | 3364 EXPECT_EQ(test1.SourceFingerprint(), test2.SourceFingerprint()); |
| 3364 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); | 3365 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); |
| 3365 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); | 3366 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); |
| 3366 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); | 3367 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); |
| 3367 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); | 3368 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); |
| 3368 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); | 3369 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); |
| 3369 } | 3370 } |
| 3370 | 3371 |
| 3371 } // namespace dart | 3372 } // namespace dart |
| OLD | NEW |