| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 | 88 |
| 89 CodeGenTest::CodeGenTest(const char* name) | 89 CodeGenTest::CodeGenTest(const char* name) |
| 90 : function_(Function::ZoneHandle()), | 90 : function_(Function::ZoneHandle()), |
| 91 node_sequence_(new SequenceNode(kPos, new LocalScope(NULL, 0, 0))), | 91 node_sequence_(new SequenceNode(kPos, new LocalScope(NULL, 0, 0))), |
| 92 default_parameter_values_(Array::ZoneHandle()) { | 92 default_parameter_values_(Array::ZoneHandle()) { |
| 93 ASSERT(name != NULL); | 93 ASSERT(name != NULL); |
| 94 const String& function_name = String::ZoneHandle(String::NewSymbol(name)); | 94 const String& function_name = String::ZoneHandle(String::NewSymbol(name)); |
| 95 function_ = Function::New( | 95 function_ = Function::New( |
| 96 function_name, RawFunction::kFunction, true, false, 0); | 96 function_name, RawFunction::kFunction, true, false, 0); |
| 97 function_.set_result_type(Type::Handle(Type::VarType())); | 97 function_.set_result_type(Type::Handle(Type::DynamicType())); |
| 98 // Add function to a class and that class to the class dictionary so that | 98 // Add function to a class and that class to the class dictionary so that |
| 99 // frame walking can be used. | 99 // frame walking can be used. |
| 100 Class& cls = Class::ZoneHandle(); | 100 Class& cls = Class::ZoneHandle(); |
| 101 const Script& script = Script::Handle(); | 101 const Script& script = Script::Handle(); |
| 102 cls = Class::New(function_name, script); | 102 cls = Class::New(function_name, script); |
| 103 const Array& functions = Array::Handle(Array::New(1)); | 103 const Array& functions = Array::Handle(Array::New(1)); |
| 104 functions.SetAt(0, function_); | 104 functions.SetAt(0, function_); |
| 105 cls.SetFunctions(functions); | 105 cls.SetFunctions(functions); |
| 106 Library& lib = Library::Handle(Library::CoreLibrary()); | 106 Library& lib = Library::Handle(Library::CoreLibrary()); |
| 107 lib.AddClass(cls); | 107 lib.AddClass(cls); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 Compiler::CompileFunction(function); | 177 Compiler::CompileFunction(function); |
| 178 retval = true; | 178 retval = true; |
| 179 } else { | 179 } else { |
| 180 retval = false; | 180 retval = false; |
| 181 } | 181 } |
| 182 isolate->set_long_jump_base(base); | 182 isolate->set_long_jump_base(base); |
| 183 return retval; | 183 return retval; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace dart | 186 } // namespace dart |
| OLD | NEW |