| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 Library& lib = Library::Handle(Library::CoreLibrary()); | 172 Library& lib = Library::Handle(Library::CoreLibrary()); |
| 173 lib.AddClass(cls); | 173 lib.AddClass(cls); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 void CodeGenTest::Compile() { | 177 void CodeGenTest::Compile() { |
| 178 ParsedFunction parsed_function(function_); | 178 ParsedFunction parsed_function(function_); |
| 179 parsed_function.SetNodeSequence(node_sequence_); | 179 parsed_function.SetNodeSequence(node_sequence_); |
| 180 parsed_function.set_instantiator(NULL); | 180 parsed_function.set_instantiator(NULL); |
| 181 parsed_function.set_default_parameter_values(default_parameter_values_); | 181 parsed_function.set_default_parameter_values(default_parameter_values_); |
| 182 parsed_function.set_expression_temp_var( |
| 183 ParsedFunction::CreateExpressionTempVar(0)); |
| 184 node_sequence_->scope()->AddVariable(parsed_function.expression_temp_var()); |
| 182 parsed_function.AllocateVariables(); | 185 parsed_function.AllocateVariables(); |
| 183 const Error& error = | 186 const Error& error = |
| 184 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); | 187 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); |
| 185 EXPECT(error.IsNull()); | 188 EXPECT(error.IsNull()); |
| 186 } | 189 } |
| 187 | 190 |
| 188 | 191 |
| 189 bool CompilerTest::TestCompileScript(const Library& library, | 192 bool CompilerTest::TestCompileScript(const Library& library, |
| 190 const Script& script) { | 193 const Script& script) { |
| 191 Isolate* isolate = Isolate::Current(); | 194 Isolate* isolate = Isolate::Current(); |
| 192 ASSERT(isolate != NULL); | 195 ASSERT(isolate != NULL); |
| 193 const Error& error = Error::Handle(Compiler::Compile(library, script)); | 196 const Error& error = Error::Handle(Compiler::Compile(library, script)); |
| 194 return error.IsNull(); | 197 return error.IsNull(); |
| 195 } | 198 } |
| 196 | 199 |
| 197 | 200 |
| 198 bool CompilerTest::TestCompileFunction(const Function& function) { | 201 bool CompilerTest::TestCompileFunction(const Function& function) { |
| 199 Isolate* isolate = Isolate::Current(); | 202 Isolate* isolate = Isolate::Current(); |
| 200 ASSERT(isolate != NULL); | 203 ASSERT(isolate != NULL); |
| 201 ASSERT(ClassFinalizer::AllClassesFinalized()); | 204 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 202 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 205 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 203 return error.IsNull(); | 206 return error.IsNull(); |
| 204 } | 207 } |
| 205 | 208 |
| 206 } // namespace dart | 209 } // namespace dart |
| OLD | NEW |