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

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

Issue 2292213002: Remove legacy patch class syntax in VM (Closed)
Patch Set: Created 4 years, 3 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 6649 matching lines...) Expand 10 before | Expand all | Expand 10 after
6660 } 6660 }
6661 6661
6662 6662
6663 TEST_CASE(LoadPatch) { 6663 TEST_CASE(LoadPatch) {
6664 const char* kLibrary1Chars = 6664 const char* kLibrary1Chars =
6665 "library library1_name;"; 6665 "library library1_name;";
6666 const char* kSourceChars = 6666 const char* kSourceChars =
6667 "part of library1_name;\n" 6667 "part of library1_name;\n"
6668 "external int foo();"; 6668 "external int foo();";
6669 const char* kPatchChars = 6669 const char* kPatchChars =
6670 "patch int foo() => 42;"; 6670 "@patch int foo() => 42;";
6671 6671
6672 // Load up a library. 6672 // Load up a library.
6673 Dart_Handle url = NewString("library1_url"); 6673 Dart_Handle url = NewString("library1_url");
6674 Dart_Handle source = NewString(kLibrary1Chars); 6674 Dart_Handle source = NewString(kLibrary1Chars);
6675 Dart_Handle lib = Dart_LoadLibrary(url, Dart_Null(), source, 0, 0); 6675 Dart_Handle lib = Dart_LoadLibrary(url, Dart_Null(), source, 0, 0);
6676 EXPECT_VALID(lib); 6676 EXPECT_VALID(lib);
6677 EXPECT(Dart_IsLibrary(lib)); 6677 EXPECT(Dart_IsLibrary(lib));
6678 6678
6679 url = NewString("source_url"); 6679 url = NewString("source_url");
6680 source = NewString(kSourceChars); 6680 source = NewString(kSourceChars);
(...skipping 24 matching lines...) Expand all
6705 const char* kLibrary1Chars = 6705 const char* kLibrary1Chars =
6706 "library library1_name;"; 6706 "library library1_name;";
6707 const char* kSourceChars = 6707 const char* kSourceChars =
6708 "part of library1_name;\n" 6708 "part of library1_name;\n"
6709 "external int foo([int x]);\n" 6709 "external int foo([int x]);\n"
6710 "class Foo {\n" 6710 "class Foo {\n"
6711 " external static int addDefault10([int x, int y]);\n" 6711 " external static int addDefault10([int x, int y]);\n"
6712 "}"; 6712 "}";
6713 const char* kPatchChars = 6713 const char* kPatchChars =
6714 "const _UNDEFINED = const Object();\n" 6714 "const _UNDEFINED = const Object();\n"
6715 "patch foo([x=_UNDEFINED]) => identical(x, _UNDEFINED) ? 42 : x;\n" 6715 "@patch foo([x=_UNDEFINED]) => identical(x, _UNDEFINED) ? 42 : x;\n"
6716 "patch class Foo {\n" 6716 "@patch class Foo {\n"
6717 " static addDefault10([x=_UNDEFINED, y=_UNDEFINED]) {\n" 6717 " static addDefault10([x=_UNDEFINED, y=_UNDEFINED]) {\n"
6718 " if (identical(x, _UNDEFINED)) x = 10;\n" 6718 " if (identical(x, _UNDEFINED)) x = 10;\n"
6719 " if (identical(y, _UNDEFINED)) y = 10;\n" 6719 " if (identical(y, _UNDEFINED)) y = 10;\n"
6720 " return x + y;\n" 6720 " return x + y;\n"
6721 " }\n" 6721 " }\n"
6722 "}"; 6722 "}";
6723 6723
6724 bool old_flag_value = FLAG_ignore_patch_signature_mismatch; 6724 bool old_flag_value = FLAG_ignore_patch_signature_mismatch;
6725 FLAG_ignore_patch_signature_mismatch = true; 6725 FLAG_ignore_patch_signature_mismatch = true;
6726 6726
(...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
10214 result = Dart_Invoke(lib, 10214 result = Dart_Invoke(lib,
10215 NewString("foozoo"), 10215 NewString("foozoo"),
10216 0, 10216 0,
10217 NULL); 10217 NULL);
10218 EXPECT(Dart_IsError(result)); 10218 EXPECT(Dart_IsError(result));
10219 } 10219 }
10220 10220
10221 #endif // !PRODUCT 10221 #endif // !PRODUCT
10222 10222
10223 } // namespace dart 10223 } // 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