Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1419)

Side by Side Diff: runtime/vm/unit_test.cc

Issue 1564493002: Make Scanner::kNoSourcePos be a true sentinel value (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/scopes.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "vm/unit_test.h" 5 #include "vm/unit_test.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 194
195 char* TestCase::BigintToHexValue(Dart_CObject* bigint) { 195 char* TestCase::BigintToHexValue(Dart_CObject* bigint) {
196 return bin::CObject::BigintToHexValue(bigint); 196 return bin::CObject::BigintToHexValue(bigint);
197 } 197 }
198 198
199 199
200 void AssemblerTest::Assemble() { 200 void AssemblerTest::Assemble() {
201 const String& function_name = String::ZoneHandle(Symbols::New(name_)); 201 const String& function_name = String::ZoneHandle(Symbols::New(name_));
202 const Class& cls = Class::ZoneHandle( 202 const Class& cls = Class::ZoneHandle(
203 Class::New(function_name, Script::Handle(), Scanner::kNoSourcePos)); 203 Class::New(function_name, Script::Handle(), 0));
204 const Library& lib = Library::ZoneHandle(Library::New(function_name)); 204 const Library& lib = Library::ZoneHandle(Library::New(function_name));
205 cls.set_library(lib); 205 cls.set_library(lib);
206 Function& function = Function::ZoneHandle( 206 Function& function = Function::ZoneHandle(
207 Function::New(function_name, RawFunction::kRegularFunction, 207 Function::New(function_name, RawFunction::kRegularFunction,
208 true, false, false, false, false, cls, 0)); 208 true, false, false, false, false, cls, 0));
209 code_ = Code::FinalizeCode(function, assembler_); 209 code_ = Code::FinalizeCode(function, assembler_);
210 if (FLAG_disassemble) { 210 if (FLAG_disassemble) {
211 OS::Print("Code for test '%s' {\n", name_); 211 OS::Print("Code for test '%s' {\n", name_);
212 const Instructions& instructions = 212 const Instructions& instructions =
213 Instructions::Handle(code_.instructions()); 213 Instructions::Handle(code_.instructions());
214 uword start = instructions.EntryPoint(); 214 uword start = instructions.EntryPoint();
215 Disassembler::Disassemble(start, start + assembler_->CodeSize()); 215 Disassembler::Disassemble(start, start + assembler_->CodeSize());
216 OS::Print("}\n"); 216 OS::Print("}\n");
217 } 217 }
218 } 218 }
219 219
220 220
221 CodeGenTest::CodeGenTest(const char* name) 221 CodeGenTest::CodeGenTest(const char* name)
222 : function_(Function::ZoneHandle()), 222 : function_(Function::ZoneHandle()),
223 node_sequence_(new SequenceNode(Scanner::kNoSourcePos, 223 node_sequence_(new SequenceNode(0,
224 new LocalScope(NULL, 0, 0))), 224 new LocalScope(NULL, 0, 0))),
225 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) { 225 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) {
226 ASSERT(name != NULL); 226 ASSERT(name != NULL);
227 const String& function_name = String::ZoneHandle(Symbols::New(name)); 227 const String& function_name = String::ZoneHandle(Symbols::New(name));
228 // Add function to a class and that class to the class dictionary so that 228 // Add function to a class and that class to the class dictionary so that
229 // frame walking can be used. 229 // frame walking can be used.
230 const Class& cls = Class::ZoneHandle( 230 const Class& cls = Class::ZoneHandle(
231 Class::New(function_name, Script::Handle(), Scanner::kNoSourcePos)); 231 Class::New(function_name, Script::Handle(), 0));
232 function_ = Function::New( 232 function_ = Function::New(
233 function_name, RawFunction::kRegularFunction, 233 function_name, RawFunction::kRegularFunction,
234 true, false, false, false, false, cls, 0); 234 true, false, false, false, false, cls, 0);
235 function_.set_result_type(Type::Handle(Type::DynamicType())); 235 function_.set_result_type(Type::Handle(Type::DynamicType()));
236 const Array& functions = Array::Handle(Array::New(1)); 236 const Array& functions = Array::Handle(Array::New(1));
237 functions.SetAt(0, function_); 237 functions.SetAt(0, function_);
238 cls.SetFunctions(functions); 238 cls.SetFunctions(functions);
239 Library& lib = Library::Handle(Library::CoreLibrary()); 239 Library& lib = Library::Handle(Library::CoreLibrary());
240 lib.AddClass(cls); 240 lib.AddClass(cls);
241 } 241 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 // Copy the remainder of in to out. 297 // Copy the remainder of in to out.
298 while (*in != '\0') { 298 while (*in != '\0') {
299 *out++ = *in++; 299 *out++ = *in++;
300 } 300 }
301 *out = '\0'; 301 *out = '\0';
302 } 302 }
303 303
304 304
305 } // namespace dart 305 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698