| 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 | 5 |
| 6 #include "vm/ast_printer.h" | 6 #include "vm/ast_printer.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/parser.h" | 11 #include "vm/parser.h" |
| 12 #include "vm/symbols.h" | 12 #include "vm/symbols.h" |
| 13 #include "vm/unit_test.h" | 13 #include "vm/unit_test.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 DECLARE_FLAG(bool, show_invisible_frames); | 17 DECLARE_FLAG(bool, show_invisible_frames); |
| 18 | 18 |
| 19 | 19 |
| 20 void DumpFunction(const Library& lib, const char* cname, const char* fname) { | 20 void DumpFunction(const Library& lib, const char* cname, const char* fname) { |
| 21 const String& classname = String::Handle(Symbols::New(cname)); | 21 const String& classname = String::Handle(Symbols::New(cname)); |
| 22 Class& cls = Class::Handle(lib.LookupClass(classname)); | |
| 23 EXPECT(!cls.IsNull()); | |
| 24 | |
| 25 String& funcname = String::Handle(String::New(fname)); | 22 String& funcname = String::Handle(String::New(fname)); |
| 26 Function& function = Function::ZoneHandle(cls.LookupStaticFunction(funcname)); | |
| 27 EXPECT(!function.IsNull()); | |
| 28 | 23 |
| 29 bool retval; | 24 bool retval; |
| 30 EXPECT(Isolate::Current() != NULL); | 25 EXPECT(Isolate::Current() != NULL); |
| 31 LongJumpScope jump; | 26 LongJumpScope jump; |
| 32 if (setjmp(*jump.Set()) == 0) { | 27 if (setjmp(*jump.Set()) == 0) { |
| 28 Class& cls = Class::Handle(lib.LookupClass(classname)); |
| 29 EXPECT(!cls.IsNull()); |
| 30 Function& function = |
| 31 Function::ZoneHandle(cls.LookupStaticFunction(funcname)); |
| 32 EXPECT(!function.IsNull()); |
| 33 ParsedFunction* parsed_function = | 33 ParsedFunction* parsed_function = |
| 34 new ParsedFunction(Isolate::Current(), function); | 34 new ParsedFunction(Isolate::Current(), function); |
| 35 Parser::ParseFunction(parsed_function); | 35 Parser::ParseFunction(parsed_function); |
| 36 EXPECT(parsed_function->node_sequence() != NULL); | 36 EXPECT(parsed_function->node_sequence() != NULL); |
| 37 printf("Class %s function %s:\n", cname, fname); | 37 printf("Class %s function %s:\n", cname, fname); |
| 38 AstPrinter::PrintFunctionNodes(*parsed_function); | 38 AstPrinter::PrintFunctionNodes(*parsed_function); |
| 39 retval = true; | 39 retval = true; |
| 40 } else { | 40 } else { |
| 41 retval = false; | 41 retval = false; |
| 42 } | 42 } |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 "::.a\n" | 535 "::.a\n" |
| 536 " 0 ContextLevel level=1 scope=1 begin=1 end=76\n" | 536 " 0 ContextLevel level=1 scope=1 begin=1 end=76\n" |
| 537 " 1 SavedEntryCtx scope=0 begin=0 end=0" | 537 " 1 SavedEntryCtx scope=0 begin=0 end=0" |
| 538 " name=:saved_entry_context_var\n" | 538 " name=:saved_entry_context_var\n" |
| 539 " 2 ContextVar level=1 begin=6 end=76 name=x\n" | 539 " 2 ContextVar level=1 begin=6 end=76 name=x\n" |
| 540 " 3 StackVar scope=2 begin=11 end=76 name=b\n", | 540 " 3 StackVar scope=2 begin=11 end=76 name=b\n", |
| 541 CaptureVarsAtLine(lib, "a", 10)); | 541 CaptureVarsAtLine(lib, "a", 10)); |
| 542 } | 542 } |
| 543 | 543 |
| 544 } // namespace dart | 544 } // namespace dart |
| OLD | NEW |