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

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

Issue 2274663004: Backing out change that removed legacy patch syntax (Closed)
Patch Set: Created 4 years, 4 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 | « no previous file | runtime/vm/parser.cc » ('j') | 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 "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_mirrors_api.h" 8 #include "include/dart_mirrors_api.h"
9 #include "include/dart_native_api.h" 9 #include "include/dart_native_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 6635 matching lines...) Expand 10 before | Expand all | Expand 10 after
6646 } 6646 }
6647 6647
6648 6648
6649 TEST_CASE(LoadPatch) { 6649 TEST_CASE(LoadPatch) {
6650 const char* kLibrary1Chars = 6650 const char* kLibrary1Chars =
6651 "library library1_name;"; 6651 "library library1_name;";
6652 const char* kSourceChars = 6652 const char* kSourceChars =
6653 "part of library1_name;\n" 6653 "part of library1_name;\n"
6654 "external int foo();"; 6654 "external int foo();";
6655 const char* kPatchChars = 6655 const char* kPatchChars =
6656 "@patch int foo() => 42;"; 6656 "patch int foo() => 42;";
6657 6657
6658 // Load up a library. 6658 // Load up a library.
6659 Dart_Handle url = NewString("library1_url"); 6659 Dart_Handle url = NewString("library1_url");
6660 Dart_Handle source = NewString(kLibrary1Chars); 6660 Dart_Handle source = NewString(kLibrary1Chars);
6661 Dart_Handle lib = Dart_LoadLibrary(url, Dart_Null(), source, 0, 0); 6661 Dart_Handle lib = Dart_LoadLibrary(url, Dart_Null(), source, 0, 0);
6662 EXPECT_VALID(lib); 6662 EXPECT_VALID(lib);
6663 EXPECT(Dart_IsLibrary(lib)); 6663 EXPECT(Dart_IsLibrary(lib));
6664 6664
6665 url = NewString("source_url"); 6665 url = NewString("source_url");
6666 source = NewString(kSourceChars); 6666 source = NewString(kSourceChars);
(...skipping 24 matching lines...) Expand all
6691 const char* kLibrary1Chars = 6691 const char* kLibrary1Chars =
6692 "library library1_name;"; 6692 "library library1_name;";
6693 const char* kSourceChars = 6693 const char* kSourceChars =
6694 "part of library1_name;\n" 6694 "part of library1_name;\n"
6695 "external int foo([int x]);\n" 6695 "external int foo([int x]);\n"
6696 "class Foo {\n" 6696 "class Foo {\n"
6697 " external static int addDefault10([int x, int y]);\n" 6697 " external static int addDefault10([int x, int y]);\n"
6698 "}"; 6698 "}";
6699 const char* kPatchChars = 6699 const char* kPatchChars =
6700 "const _UNDEFINED = const Object();\n" 6700 "const _UNDEFINED = const Object();\n"
6701 "@patch foo([x=_UNDEFINED]) => identical(x, _UNDEFINED) ? 42 : x;\n" 6701 "patch foo([x=_UNDEFINED]) => identical(x, _UNDEFINED) ? 42 : x;\n"
6702 "@patch class Foo {\n" 6702 "patch class Foo {\n"
6703 " static addDefault10([x=_UNDEFINED, y=_UNDEFINED]) {\n" 6703 " static addDefault10([x=_UNDEFINED, y=_UNDEFINED]) {\n"
6704 " if (identical(x, _UNDEFINED)) x = 10;\n" 6704 " if (identical(x, _UNDEFINED)) x = 10;\n"
6705 " if (identical(y, _UNDEFINED)) y = 10;\n" 6705 " if (identical(y, _UNDEFINED)) y = 10;\n"
6706 " return x + y;\n" 6706 " return x + y;\n"
6707 " }\n" 6707 " }\n"
6708 "}"; 6708 "}";
6709 6709
6710 bool old_flag_value = FLAG_ignore_patch_signature_mismatch; 6710 bool old_flag_value = FLAG_ignore_patch_signature_mismatch;
6711 FLAG_ignore_patch_signature_mismatch = true; 6711 FLAG_ignore_patch_signature_mismatch = true;
6712 6712
(...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
10200 result = Dart_Invoke(lib, 10200 result = Dart_Invoke(lib,
10201 NewString("foozoo"), 10201 NewString("foozoo"),
10202 0, 10202 0,
10203 NULL); 10203 NULL);
10204 EXPECT(Dart_IsError(result)); 10204 EXPECT(Dart_IsError(result));
10205 } 10205 }
10206 10206
10207 #endif // !PRODUCT 10207 #endif // !PRODUCT
10208 10208
10209 } // namespace dart 10209 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698