-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[beta][dart2wasm] Use node's enclosing library annotation for lowerings
Closes #55359 The current library's annotation is used for the interop lowerings in dart2wasm. For most members, this is okay because we emit the equivalent JS code for the member when we visit the procedure and not when we visit the invocation. However, for methods, the invocation determines the resulting JS call due to the existence of optional parameters. In that case, if the invocation was not in the same library as the interop member declaration, it results in using the wrong library's annotation value. Adds tests for this case and does some cleanup of existing tests. Specifically: - Adds a consistent naming scheme for test libraries that are namespaced. - Adds code to delete the non-namespaced declarations so that the namespaced interop methods don't accidentally call those declarations. - Removes differentArgsMethod which was already tested in js_default_test. - Removes use of js_util in favor of js_interop_unsafe. Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/361241 Cherry-pick-request: #55430 Bug: #55359 Change-Id: Ibf7125fea6da7722549f3c87aafdf881132b104f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362195 Commit-Queue: Srujan Gaddam <srujzs@google.com> Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
- Loading branch information
Showing
10 changed files
with
394 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/lib/js/static_interop_test/extension_type/external_static_member_with_namespaces.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
@JS('library1.library2') | ||
library external_static_member_with_namespaces_test; | ||
|
||
import 'dart:js_interop'; | ||
|
||
@JS() | ||
external void eval(String code); | ||
|
||
@JS('library3.ExternalStatic') | ||
extension type ExternalStatic._(JSObject obj) implements JSObject { | ||
external ExternalStatic(); | ||
external factory ExternalStatic.factory(); | ||
external ExternalStatic.multipleArgs(double a, String b); | ||
ExternalStatic.nonExternal() : this.obj = ExternalStatic() as JSObject; | ||
|
||
external static String field; | ||
@JS('field') | ||
external static String renamedField; | ||
external static final String finalField; | ||
|
||
external static String get getSet; | ||
external static set getSet(String val); | ||
@JS('getSet') | ||
external static String get renamedGetSet; | ||
@JS('getSet') | ||
external static set renamedGetSet(String val); | ||
|
||
external static String method(); | ||
@JS('method') | ||
external static String renamedMethod(); | ||
} |
102 changes: 0 additions & 102 deletions
102
...ib/js/static_interop_test/extension_type/external_static_member_with_namespaces_test.dart
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.