-
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.
[stable][dart2wasm] Use node's enclosing library annotation for lower…
…ings 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 Change-Id: I37661ed200c6db367e3f29f50b0877834f4c1639 Bug: #55359 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362190 Reviewed-by: Kevin Chisholm <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]>
- Loading branch information
Showing
10 changed files
with
403 additions
and
261 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
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(); | ||
} |
Oops, something went wrong.