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