| 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/thread.h" |
| 13 #include "vm/unit_test.h" | 14 #include "vm/unit_test.h" |
| 14 | 15 |
| 15 namespace dart { | 16 namespace dart { |
| 16 | 17 |
| 17 DECLARE_FLAG(bool, show_invisible_frames); | 18 DECLARE_FLAG(bool, show_invisible_frames); |
| 18 | 19 |
| 19 | 20 |
| 20 void DumpFunction(const Library& lib, const char* cname, const char* fname) { | 21 void DumpFunction(const Library& lib, const char* cname, const char* fname) { |
| 21 const String& classname = String::Handle(Symbols::New(cname)); | 22 const String& classname = String::Handle(Symbols::New(cname)); |
| 22 String& funcname = String::Handle(String::New(fname)); | 23 String& funcname = String::Handle(String::New(fname)); |
| 23 | 24 |
| 24 bool retval; | 25 bool retval; |
| 25 EXPECT(Isolate::Current() != NULL); | 26 EXPECT(Isolate::Current() != NULL); |
| 26 LongJumpScope jump; | 27 LongJumpScope jump; |
| 27 if (setjmp(*jump.Set()) == 0) { | 28 if (setjmp(*jump.Set()) == 0) { |
| 28 Class& cls = Class::Handle(lib.LookupClass(classname)); | 29 Class& cls = Class::Handle(lib.LookupClass(classname)); |
| 29 EXPECT(!cls.IsNull()); | 30 EXPECT(!cls.IsNull()); |
| 30 Function& function = | 31 Function& function = |
| 31 Function::ZoneHandle(cls.LookupStaticFunction(funcname)); | 32 Function::ZoneHandle(cls.LookupStaticFunction(funcname)); |
| 32 EXPECT(!function.IsNull()); | 33 EXPECT(!function.IsNull()); |
| 33 ParsedFunction* parsed_function = | 34 ParsedFunction* parsed_function = |
| 34 new ParsedFunction(Isolate::Current(), function); | 35 new ParsedFunction(Thread::Current(), function); |
| 35 Parser::ParseFunction(parsed_function); | 36 Parser::ParseFunction(parsed_function); |
| 36 EXPECT(parsed_function->node_sequence() != NULL); | 37 EXPECT(parsed_function->node_sequence() != NULL); |
| 37 printf("Class %s function %s:\n", cname, fname); | 38 printf("Class %s function %s:\n", cname, fname); |
| 38 AstPrinter::PrintFunctionNodes(*parsed_function); | 39 AstPrinter::PrintFunctionNodes(*parsed_function); |
| 39 retval = true; | 40 retval = true; |
| 40 } else { | 41 } else { |
| 41 retval = false; | 42 retval = false; |
| 42 } | 43 } |
| 43 EXPECT(retval); | 44 EXPECT(retval); |
| 44 } | 45 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 "::.a\n" | 557 "::.a\n" |
| 557 " 0 ContextLevel level=1 scope=1 begin=1 end=76\n" | 558 " 0 ContextLevel level=1 scope=1 begin=1 end=76\n" |
| 558 " 1 CurrentCtx scope=0 begin=0 end=0" | 559 " 1 CurrentCtx scope=0 begin=0 end=0" |
| 559 " name=:current_context_var\n" | 560 " name=:current_context_var\n" |
| 560 " 2 ContextVar level=1 begin=6 end=76 name=x\n" | 561 " 2 ContextVar level=1 begin=6 end=76 name=x\n" |
| 561 " 3 StackVar scope=2 begin=11 end=76 name=b\n", | 562 " 3 StackVar scope=2 begin=11 end=76 name=b\n", |
| 562 CaptureVarsAtLine(lib, "a", 10)); | 563 CaptureVarsAtLine(lib, "a", 10)); |
| 563 } | 564 } |
| 564 | 565 |
| 565 } // namespace dart | 566 } // namespace dart |
| OLD | NEW |