| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 Library& lib = Library::Handle(Library::CoreLibrary()); | 185 Library& lib = Library::Handle(Library::CoreLibrary()); |
| 186 lib.AddClass(cls); | 186 lib.AddClass(cls); |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 void CodeGenTest::Compile() { | 190 void CodeGenTest::Compile() { |
| 191 ParsedFunction* parsed_function = new ParsedFunction(function_); | 191 ParsedFunction* parsed_function = new ParsedFunction(function_); |
| 192 parsed_function->SetNodeSequence(node_sequence_); | 192 parsed_function->SetNodeSequence(node_sequence_); |
| 193 parsed_function->set_instantiator(NULL); | 193 parsed_function->set_instantiator(NULL); |
| 194 parsed_function->set_default_parameter_values(default_parameter_values_); | 194 parsed_function->set_default_parameter_values(default_parameter_values_); |
| 195 parsed_function->set_expression_temp_var( | 195 parsed_function->EnsureExpressionTemp(); |
| 196 ParsedFunction::CreateExpressionTempVar(0)); | |
| 197 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); | 196 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); |
| 198 parsed_function->AllocateVariables(); | 197 parsed_function->AllocateVariables(); |
| 199 const Error& error = | 198 const Error& error = |
| 200 Error::Handle(Compiler::CompileParsedFunction(*parsed_function)); | 199 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); |
| 201 EXPECT(error.IsNull()); | 200 EXPECT(error.IsNull()); |
| 202 } | 201 } |
| 203 | 202 |
| 204 | 203 |
| 205 LocalVariable* CodeGenTest::CreateTempConstVariable(const char* name_part) { | 204 LocalVariable* CodeGenTest::CreateTempConstVariable(const char* name_part) { |
| 206 char name[64]; | 205 char name[64]; |
| 207 OS::SNPrint(name, 64, ":%s", name_part); | 206 OS::SNPrint(name, 64, ":%s", name_part); |
| 208 LocalVariable* temp = | 207 LocalVariable* temp = |
| 209 new LocalVariable(0, | 208 new LocalVariable(0, |
| 210 String::ZoneHandle(Symbols::New(name)), | 209 String::ZoneHandle(Symbols::New(name)), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 226 | 225 |
| 227 bool CompilerTest::TestCompileFunction(const Function& function) { | 226 bool CompilerTest::TestCompileFunction(const Function& function) { |
| 228 Isolate* isolate = Isolate::Current(); | 227 Isolate* isolate = Isolate::Current(); |
| 229 ASSERT(isolate != NULL); | 228 ASSERT(isolate != NULL); |
| 230 ASSERT(ClassFinalizer::AllClassesFinalized()); | 229 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 231 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 230 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 232 return error.IsNull(); | 231 return error.IsNull(); |
| 233 } | 232 } |
| 234 | 233 |
| 235 } // namespace dart | 234 } // namespace dart |
| OLD | NEW |