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 "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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 OS::Print("Error compiling test script:\n%s\n", error.ToErrorCString()); | 465 OS::Print("Error compiling test script:\n%s\n", error.ToErrorCString()); |
466 } | 466 } |
467 return error.IsNull(); | 467 return error.IsNull(); |
468 } | 468 } |
469 | 469 |
470 | 470 |
471 bool CompilerTest::TestCompileFunction(const Function& function) { | 471 bool CompilerTest::TestCompileFunction(const Function& function) { |
472 Thread* thread = Thread::Current(); | 472 Thread* thread = Thread::Current(); |
473 ASSERT(thread != NULL); | 473 ASSERT(thread != NULL); |
474 ASSERT(ClassFinalizer::AllClassesFinalized()); | 474 ASSERT(ClassFinalizer::AllClassesFinalized()); |
475 const Error& error = | 475 const Object& result = |
476 Error::Handle(Compiler::CompileFunction(thread, function)); | 476 Object::Handle(Compiler::CompileFunction(thread, function)); |
477 return error.IsNull(); | 477 return result.IsCode(); |
478 } | 478 } |
479 | 479 |
480 | 480 |
481 void ElideJSONSubstring(const char* prefix, const char* in, char* out) { | 481 void ElideJSONSubstring(const char* prefix, const char* in, char* out) { |
482 const char* pos = strstr(in, prefix); | 482 const char* pos = strstr(in, prefix); |
483 while (pos != NULL) { | 483 while (pos != NULL) { |
484 // Copy up to pos into the output buffer. | 484 // Copy up to pos into the output buffer. |
485 while (in < pos) { | 485 while (in < pos) { |
486 *out++ = *in++; | 486 *out++ = *in++; |
487 } | 487 } |
488 | 488 |
489 // Skip to the close quote. | 489 // Skip to the close quote. |
490 in += strcspn(in, "\""); | 490 in += strcspn(in, "\""); |
491 pos = strstr(in, prefix); | 491 pos = strstr(in, prefix); |
492 } | 492 } |
493 // Copy the remainder of in to out. | 493 // Copy the remainder of in to out. |
494 while (*in != '\0') { | 494 while (*in != '\0') { |
495 *out++ = *in++; | 495 *out++ = *in++; |
496 } | 496 } |
497 *out = '\0'; | 497 *out = '\0'; |
498 } | 498 } |
499 | 499 |
500 | 500 |
501 } // namespace dart | 501 } // namespace dart |
OLD | NEW |