Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3123)

Side by Side Diff: runtime/vm/code_generator_test.cc

Issue 14791005: BREAKING CHANGE: enforce part of directive (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/compiler_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 5 #include "platform/assert.h"
6 #include "vm/globals.h" 6 #include "vm/globals.h"
7 #include "vm/ast.h" 7 #include "vm/ast.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 const char* kScriptChars = 280 const char* kScriptChars =
281 "class A {\n" 281 "class A {\n"
282 " static bar() { return 42; }\n" 282 " static bar() { return 42; }\n"
283 " static fly() { return 5; }\n" 283 " static fly() { return 5; }\n"
284 "}\n"; 284 "}\n";
285 285
286 String& url = String::Handle(String::New("dart-test:CompileScript")); 286 String& url = String::Handle(String::New("dart-test:CompileScript"));
287 String& source = String::Handle(String::New(kScriptChars)); 287 String& source = String::Handle(String::New(kScriptChars));
288 Script& script = Script::Handle(Script::New(url, 288 Script& script = Script::Handle(Script::New(url,
289 source, 289 source,
290 RawScript::kSourceTag)); 290 RawScript::kScriptTag));
291 Library& lib = MakeTestLibrary("TestLib"); 291 Library& lib = MakeTestLibrary("TestLib");
292 EXPECT(CompilerTest::TestCompileScript(lib, script)); 292 EXPECT(CompilerTest::TestCompileScript(lib, script));
293 EXPECT(ClassFinalizer::FinalizePendingClasses()); 293 EXPECT(ClassFinalizer::FinalizePendingClasses());
294 Class& cls = Class::Handle(LookupClass(lib, "A")); 294 Class& cls = Class::Handle(LookupClass(lib, "A"));
295 EXPECT(!cls.IsNull()); 295 EXPECT(!cls.IsNull());
296 296
297 // 'bar' will not be compiled. 297 // 'bar' will not be compiled.
298 String& function_bar_name = String::Handle(String::New("bar")); 298 String& function_bar_name = String::Handle(String::New("bar"));
299 Function& function_bar = 299 Function& function_bar =
300 Function::ZoneHandle(cls.LookupStaticFunction(function_bar_name)); 300 Function::ZoneHandle(cls.LookupStaticFunction(function_bar_name));
(...skipping 26 matching lines...) Expand all
327 const char* kScriptChars = 327 const char* kScriptChars =
328 "class A {\n" 328 "class A {\n"
329 " A() {}\n" 329 " A() {}\n"
330 " int bar() { return 42; }\n" 330 " int bar() { return 42; }\n"
331 "}\n"; 331 "}\n";
332 332
333 String& url = String::Handle(String::New("dart-test:CompileScript")); 333 String& url = String::Handle(String::New("dart-test:CompileScript"));
334 String& source = String::Handle(String::New(kScriptChars)); 334 String& source = String::Handle(String::New(kScriptChars));
335 Script& script = Script::Handle(Script::New(url, 335 Script& script = Script::Handle(Script::New(url,
336 source, 336 source,
337 RawScript::kSourceTag)); 337 RawScript::kScriptTag));
338 Library& lib = MakeTestLibrary("TestLib"); 338 Library& lib = MakeTestLibrary("TestLib");
339 EXPECT(CompilerTest::TestCompileScript(lib, script)); 339 EXPECT(CompilerTest::TestCompileScript(lib, script));
340 EXPECT(ClassFinalizer::FinalizePendingClasses()); 340 EXPECT(ClassFinalizer::FinalizePendingClasses());
341 Class& cls = Class::ZoneHandle(LookupClass(lib, "A")); 341 Class& cls = Class::ZoneHandle(LookupClass(lib, "A"));
342 EXPECT(!cls.IsNull()); 342 EXPECT(!cls.IsNull());
343 343
344 String& constructor_name = String::Handle(String::New("A.")); 344 String& constructor_name = String::Handle(String::New("A."));
345 Function& constructor = 345 Function& constructor =
346 Function::ZoneHandle(cls.LookupConstructor(constructor_name)); 346 Function::ZoneHandle(cls.LookupConstructor(constructor_name));
347 EXPECT(!constructor.IsNull()); 347 EXPECT(!constructor.IsNull());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 const char* kScriptChars = 514 const char* kScriptChars =
515 "class A {\n" 515 "class A {\n"
516 " A() {}\n" 516 " A() {}\n"
517 " static bar() { return 42; }\n" 517 " static bar() { return 42; }\n"
518 "}\n"; 518 "}\n";
519 519
520 String& url = String::Handle(String::New("dart-test:CompileScript")); 520 String& url = String::Handle(String::New("dart-test:CompileScript"));
521 String& source = String::Handle(String::New(kScriptChars)); 521 String& source = String::Handle(String::New(kScriptChars));
522 Script& script = Script::Handle(Script::New(url, 522 Script& script = Script::Handle(Script::New(url,
523 source, 523 source,
524 RawScript::kSourceTag)); 524 RawScript::kScriptTag));
525 Library& lib = MakeTestLibrary("TestLib"); 525 Library& lib = MakeTestLibrary("TestLib");
526 EXPECT(CompilerTest::TestCompileScript(lib, script)); 526 EXPECT(CompilerTest::TestCompileScript(lib, script));
527 EXPECT(ClassFinalizer::FinalizePendingClasses()); 527 EXPECT(ClassFinalizer::FinalizePendingClasses());
528 Class& cls = Class::ZoneHandle(LookupClass(lib, "A")); 528 Class& cls = Class::ZoneHandle(LookupClass(lib, "A"));
529 EXPECT(!cls.IsNull()); 529 EXPECT(!cls.IsNull());
530 530
531 String& constructor_name = String::Handle(String::New("A.")); 531 String& constructor_name = String::Handle(String::New("A."));
532 Function& constructor = 532 Function& constructor =
533 Function::ZoneHandle(cls.LookupConstructor(constructor_name)); 533 Function::ZoneHandle(cls.LookupConstructor(constructor_name));
534 EXPECT(!constructor.IsNull()); 534 EXPECT(!constructor.IsNull());
(...skipping 17 matching lines...) Expand all
552 intptr_t num_libs = libs.Length(); 552 intptr_t num_libs = libs.Length();
553 Library& app_lib = Library::Handle(); 553 Library& app_lib = Library::Handle();
554 app_lib ^= libs.At(num_libs - 1); 554 app_lib ^= libs.At(num_libs - 1);
555 ASSERT(!app_lib.IsNull()); 555 ASSERT(!app_lib.IsNull());
556 const Class& cls = Class::Handle( 556 const Class& cls = Class::Handle(
557 app_lib.LookupClass(String::Handle(Symbols::New("A")))); 557 app_lib.LookupClass(String::Handle(Symbols::New("A"))));
558 EXPECT_EQ(cls.raw(), result.clazz()); 558 EXPECT_EQ(cls.raw(), result.clazz());
559 } 559 }
560 560
561 } // namespace dart 561 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698