| OLD | NEW |
| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 function_.set_result_type(Type::Handle(Type::DynamicType())); | 170 function_.set_result_type(Type::Handle(Type::DynamicType())); |
| 171 const Array& functions = Array::Handle(Array::New(1)); | 171 const Array& functions = Array::Handle(Array::New(1)); |
| 172 functions.SetAt(0, function_); | 172 functions.SetAt(0, function_); |
| 173 cls.SetFunctions(functions); | 173 cls.SetFunctions(functions); |
| 174 Library& lib = Library::Handle(Library::CoreLibrary()); | 174 Library& lib = Library::Handle(Library::CoreLibrary()); |
| 175 lib.AddClass(cls); | 175 lib.AddClass(cls); |
| 176 } | 176 } |
| 177 | 177 |
| 178 | 178 |
| 179 void CodeGenTest::Compile() { | 179 void CodeGenTest::Compile() { |
| 180 ParsedFunction parsed_function(function_); | 180 ParsedFunction* parsed_function = new ParsedFunction(function_); |
| 181 parsed_function.SetNodeSequence(node_sequence_); | 181 parsed_function->SetNodeSequence(node_sequence_); |
| 182 parsed_function.set_instantiator(NULL); | 182 parsed_function->set_instantiator(NULL); |
| 183 parsed_function.set_default_parameter_values(default_parameter_values_); | 183 parsed_function->set_default_parameter_values(default_parameter_values_); |
| 184 parsed_function.set_expression_temp_var( | 184 parsed_function->set_expression_temp_var( |
| 185 ParsedFunction::CreateExpressionTempVar(0)); | 185 ParsedFunction::CreateExpressionTempVar(0)); |
| 186 node_sequence_->scope()->AddVariable(parsed_function.expression_temp_var()); | 186 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); |
| 187 parsed_function.AllocateVariables(); | 187 parsed_function->AllocateVariables(); |
| 188 const Error& error = | 188 const Error& error = |
| 189 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); | 189 Error::Handle(Compiler::CompileParsedFunction(*parsed_function)); |
| 190 EXPECT(error.IsNull()); | 190 EXPECT(error.IsNull()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 | 193 |
| 194 LocalVariable* CodeGenTest::CreateTempConstVariable(const char* name_part) { | 194 LocalVariable* CodeGenTest::CreateTempConstVariable(const char* name_part) { |
| 195 char name[64]; | 195 char name[64]; |
| 196 OS::SNPrint(name, 64, ":%s", name_part); | 196 OS::SNPrint(name, 64, ":%s", name_part); |
| 197 LocalVariable* temp = | 197 LocalVariable* temp = |
| 198 new LocalVariable(0, | 198 new LocalVariable(0, |
| 199 String::ZoneHandle(Symbols::New(name)), | 199 String::ZoneHandle(Symbols::New(name)), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 215 | 215 |
| 216 bool CompilerTest::TestCompileFunction(const Function& function) { | 216 bool CompilerTest::TestCompileFunction(const Function& function) { |
| 217 Isolate* isolate = Isolate::Current(); | 217 Isolate* isolate = Isolate::Current(); |
| 218 ASSERT(isolate != NULL); | 218 ASSERT(isolate != NULL); |
| 219 ASSERT(ClassFinalizer::AllClassesFinalized()); | 219 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 220 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 220 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 221 return error.IsNull(); | 221 return error.IsNull(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace dart | 224 } // namespace dart |
| OLD | NEW |