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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 bool CompilerTest::TestCompileFunction(const Function& function) { | 275 bool CompilerTest::TestCompileFunction(const Function& function) { |
276 Thread* thread = Thread::Current(); | 276 Thread* thread = Thread::Current(); |
277 ASSERT(thread != NULL); | 277 ASSERT(thread != NULL); |
278 ASSERT(ClassFinalizer::AllClassesFinalized()); | 278 ASSERT(ClassFinalizer::AllClassesFinalized()); |
279 const Error& error = Error::Handle(Compiler::CompileFunction(thread, | 279 const Error& error = Error::Handle(Compiler::CompileFunction(thread, |
280 function)); | 280 function)); |
281 return error.IsNull(); | 281 return error.IsNull(); |
282 } | 282 } |
283 | 283 |
284 | 284 |
| 285 void ElideJSONSubstring(const char* prefix, const char* in, char* out) { |
| 286 const char* pos = strstr(in, prefix); |
| 287 while (pos != NULL) { |
| 288 // Copy up to pos into the output buffer. |
| 289 while (in < pos) { |
| 290 *out++ = *in++; |
| 291 } |
| 292 |
| 293 // Skip to the close quote. |
| 294 in += strcspn(in, "\""); |
| 295 pos = strstr(in, prefix); |
| 296 } |
| 297 // Copy the remainder of in to out. |
| 298 while (*in != '\0') { |
| 299 *out++ = *in++; |
| 300 } |
| 301 *out = '\0'; |
| 302 } |
| 303 |
| 304 |
285 } // namespace dart | 305 } // namespace dart |
OLD | NEW |