Reland "[pkg:js/dart:js_interop] Move annotations to dart:_js_annotations"

This is a reland of commit fbe9c21972

This fixes the issue with the duplicate allowPlatformPrivateLibraryAccess.

Original change's description:
> [pkg:js/dart:js_interop] Move annotations to dart:_js_annotations
>
> This moves package:js annotations to the internal library that
> Flutter has been using already. This gives us a single location
> for all package:js annotations. We also introduce a @JS annotation
> in dart:js_interop since we can no longer use dart:_js_annotations
> to avoid the breaking change in semantics.
>
> CoreLibraryReviewExempt: Backend-specific internal library.
> Change-Id: I9ca55c807d7d192004a6da99f63a72d598fe4f12
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284760
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>

CoreLibraryReviewExempt: Relanding.
Change-Id: I40ff2a00682fccbd7dd44a364b5046aaac0f3bac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293203
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Srujan Gaddam
2023-04-05 23:20:15 +00:00
committed by Commit Queue
parent dc33261641
commit 9e1997971e
61 changed files with 337 additions and 403 deletions
+31 -31
View File
@@ -5,33 +5,33 @@
import 'package:kernel/kernel.dart';
import 'package:kernel/util/graph.dart' as kernel_graph;
/// Returns true iff the node has an `@JS(...)` annotation from `package:js` or
/// from the internal `dart:_js_annotations`.
bool hasJSInteropAnnotation(Annotatable a) =>
a.annotations.any(_isPublicJSAnnotation);
/// Returns true iff the node has an `@JS(...)` annotation from the internal
/// `dart:_js_annotations`.
bool hasInternalJSInteropAnnotation(Annotatable a) =>
a.annotations.any(_isInternalJSAnnotation);
/// `dart:_js_annotations` or `dart:js_interop`.
bool hasJSInteropAnnotation(Annotatable a) =>
a.annotations.any(_isJSInteropAnnotation);
/// Returns true iff the node has an `@anonymous` annotation from `package:js`
/// or from the internal `dart:_js_annotations`.
/// Returns true iff the node has an `@JS(...)` annotation from
/// `dart:js_interop`.
bool hasDartJSInteropAnnotation(Annotatable a) =>
a.annotations.any(_isDartJSInteropAnnotation);
/// Returns true iff the node has an `@anonymous` annotation from the internal
/// `dart:_js_annotations`.
bool hasAnonymousAnnotation(Annotatable a) =>
a.annotations.any(_isAnonymousAnnotation);
/// Returns true iff the node has an `@staticInterop` annotation from
/// `package:js` or from the internal `dart:_js_annotations`.
/// Returns true iff the node has an `@staticInterop` annotation from the
/// internal `dart:_js_annotations`.
bool hasStaticInteropAnnotation(Annotatable a) =>
a.annotations.any(_isStaticInteropAnnotation);
/// Returns true iff the node has an `@trustTypes` annotation from
/// `package:js` or from the internal `dart:_js_annotations`.
/// Returns true iff the node has an `@trustTypes` annotation from the internal
/// `dart:_js_annotations`.
bool hasTrustTypesAnnotation(Annotatable a) =>
a.annotations.any(_isTrustTypesAnnotation);
/// Returns true iff the node has an `@JSExport(...)` annotation from
/// `package:js` or from the internal `dart:_js_annotations`.
/// Returns true iff the node has an `@JSExport(...)` annotation from the
/// internal `dart:_js_annotations`.
bool hasJSExportAnnotation(Annotatable a) =>
a.annotations.any(_isJSExportAnnotation);
@@ -53,7 +53,7 @@ bool hasObjectLiteralAnnotation(Annotatable a) =>
String getJSName(Annotatable a) {
String jsClass = '';
for (var annotation in a.annotations) {
if (_isPublicJSAnnotation(annotation)) {
if (_isJSInteropAnnotation(annotation)) {
var jsClasses = stringAnnotationValues(annotation);
if (jsClasses.isNotEmpty) {
jsClass = jsClasses[0];
@@ -102,31 +102,30 @@ String getJSExportName(Annotatable a) {
return jsExportValue;
}
final _packageJs = Uri.parse('package:js/js.dart');
final _internalJs = Uri.parse('dart:_js_annotations');
final _jsHelper = Uri.parse('dart:_js_helper');
final _jsInterop = Uri.parse('dart:js_interop');
/// Returns true if [value] is the interop annotation whose class is
/// [annotationClassName] from `package:js` or from `dart:_js_annotations`.
/// [annotationClassName] from `dart:_js_annotations` or `dart:js_interop`.
///
/// If [internalJsOnly] is true, we only check if it's the annotation from
/// `dart:_js_annotations`.
/// If [dartJsInteropOnly] is true, we only check if it's the annotation from
/// `dart:js_interop`.
bool _isInteropAnnotation(Expression value, String annotationClassName,
{bool internalJsOnly = false}) {
{bool dartJsInteropOnly = false}) {
var c = annotationClass(value);
if (c == null || c.name != annotationClassName) return false;
var importUri = c.enclosingLibrary.importUri;
if (internalJsOnly) return importUri == _internalJs;
return importUri == _packageJs || importUri == _internalJs;
if (dartJsInteropOnly) return importUri == _jsInterop;
return importUri == _internalJs || importUri == _jsInterop;
}
bool _isInternalJSAnnotation(Expression value) =>
_isInteropAnnotation(value, 'JS', internalJsOnly: true);
bool _isPublicJSAnnotation(Expression value) =>
bool _isJSInteropAnnotation(Expression value) =>
_isInteropAnnotation(value, 'JS');
bool _isDartJSInteropAnnotation(Expression value) =>
_isInteropAnnotation(value, 'JS', dartJsInteropOnly: true);
bool _isAnonymousAnnotation(Expression value) =>
_isInteropAnnotation(value, '_Anonymous');
@@ -160,9 +159,10 @@ bool _isObjectLiteralAnnotation(Expression value) {
///
/// For example:
///
/// - `@JS()` would return the "JS" class in "package:js".
/// - `@anonymous` would return the "_Anonymous" class in "package:js".
/// - `@staticInterop` would return the "_StaticInterop" class in "package:js".
/// - `@JS()` would return the "JS" class in "dart:_js_annotations".
/// - `@anonymous` would return the "_Anonymous" class in "dart:_js_annotations".
/// - `@staticInterop` would return the "_StaticInterop" class in
/// "dart:_js_annotations".
/// - `@Native` would return the "Native" class in "dart:_js_helper".
///
/// This function works regardless of whether the CFE is evaluating constants,
@@ -11,7 +11,7 @@ import '../js_interop.dart'
show
getJSName,
hasAnonymousAnnotation,
hasInternalJSInteropAnnotation,
hasDartJSInteropAnnotation,
hasJSInteropAnnotation,
hasNativeAnnotation,
hasObjectLiteralAnnotation,
@@ -69,11 +69,6 @@ class JsUtilOptimizer extends Transformer {
late InlineExtensionIndex _inlineExtensionIndex;
static const Set<String> _existingJsAnnotationsUsers = {
'dart:_engine',
'dart:ui'
};
JsUtilOptimizer(this._coreTypes, ClassHierarchy hierarchy)
: _callMethodTarget =
_coreTypes.index.getTopLevelProcedure('dart:js_util', 'callMethod'),
@@ -233,17 +228,8 @@ class JsUtilOptimizer extends Transformer {
if (!node.isInlineClassMember &&
node.enclosingClass == null &&
((hasInternalJSInteropAnnotation(node) ||
hasInternalJSInteropAnnotation(node.enclosingLibrary)) &&
!_existingJsAnnotationsUsers
.contains(node.enclosingLibrary.importUri.toString()))) {
// Top-level external member. We only lower top-levels if we're using the
// `dart:_js_annotations`' `@JS` annotation to avoid a breaking change for
// `package:js` users. There are some internal libraries that already use
// this library, so we exclude them here.
// TODO(srujzs): When they're ready to migrate to sound semantics, we
// should remove this exception.
(hasDartJSInteropAnnotation(node) ||
hasDartJSInteropAnnotation(node.enclosingLibrary))) {
// If the `@JS` value of the node has any '.'s, we take the entries
// before the last '.' to determine the dotted prefix name.
var jsName = getJSName(node);
@@ -892,24 +878,24 @@ class InlineExtensionIndex {
}
bool isJSInteropMember(Procedure node) {
if (hasInternalJSInteropAnnotation(node) ||
hasInternalJSInteropAnnotation(node.enclosingLibrary) ||
if (hasDartJSInteropAnnotation(node) ||
hasDartJSInteropAnnotation(node.enclosingLibrary) ||
(node.enclosingClass != null &&
hasInternalJSInteropAnnotation(node.enclosingClass!))) {
hasDartJSInteropAnnotation(node.enclosingClass!))) {
return true;
}
if (node.isExtensionMember) {
final annotatable = getExtensionAnnotatable(node.reference);
if (annotatable != null) {
return hasInternalJSInteropAnnotation(annotatable);
return hasDartJSInteropAnnotation(annotatable);
}
}
if (node.isInlineClassMember) {
final cls = getInlineClass(node.reference);
if (cls != null) {
return hasInternalJSInteropAnnotation(cls);
return hasDartJSInteropAnnotation(cls);
}
}
@@ -2014,8 +2014,8 @@ class ElementAnnotationImpl implements ElementAnnotation {
/// The name of the class used to JS annotate an element.
static const String _jsClassName = 'JS';
/// The name of `js` library, used to define JS annotations.
static const String _jsLibName = 'js';
/// The name of `_js_annotations` library, used to define JS annotations.
static const String _jsLibName = '_js_annotations';
/// The name of `meta` library, used to define analysis annotations.
static const String _metaLibName = 'meta';
+4 -26
View File
@@ -143,10 +143,6 @@ abstract class CommonElements {
late final LibraryEntity? dartJsUtilLibrary =
_env.lookupLibrary(Uris.dart_js_util);
/// The package:js library.
late final LibraryEntity? packageJsLibrary =
_env.lookupLibrary(Uris.package_js);
/// The dart:_js_annotations library.
late final LibraryEntity? dartJsAnnotationsLibrary =
_env.lookupLibrary(Uris.dart__js_annotations);
@@ -1053,35 +1049,17 @@ abstract class CommonElements {
class KCommonElements extends CommonElements {
KCommonElements(super.dartTypes, super.env);
// From package:js
late final ClassEntity? jsAnnotationClass1 =
_findClassOrNull(packageJsLibrary, 'JS');
late final ClassEntity? jsAnonymousClass1 =
_findClassOrNull(packageJsLibrary, '_Anonymous');
// From dart:_js_annotations
late final ClassEntity? jsAnnotationClass2 =
late final ClassEntity? jsAnnotationClass =
_findClassOrNull(dartJsAnnotationsLibrary, 'JS');
late final ClassEntity? jsAnonymousClass2 =
late final ClassEntity? jsAnonymousClass =
_findClassOrNull(dartJsAnnotationsLibrary, '_Anonymous');
/// Returns `true` if [cls] is a @JS() annotation.
///
/// The class can come from either `package:js` or `dart:_js_annotations`.
bool isJsAnnotationClass(ClassEntity cls) {
return cls == jsAnnotationClass1 || cls == jsAnnotationClass2;
}
bool isJsAnnotationClass(ClassEntity cls) => cls == jsAnnotationClass;
/// Returns `true` if [cls] is an @anonymous annotation.
///
/// The class can come from either `package:js` or `dart:_js_annotations`.
bool isJsAnonymousClass(ClassEntity cls) {
return cls == jsAnonymousClass1 || cls == jsAnonymousClass2;
}
bool isJsAnonymousClass(ClassEntity cls) => cls == jsAnonymousClass;
late final ClassEntity pragmaClass = _findClass(coreLibrary, 'pragma');
-3
View File
@@ -266,9 +266,6 @@ class Uris {
/// The URI for 'dart:js_util'.
static final Uri dart_js_util = Uri(scheme: 'dart', path: 'js_util');
/// The URI for 'package:js'.
static final Uri package_js = Uri(scheme: 'package', path: 'js/js.dart');
/// The URI for 'dart:_js_annotations'.
static final Uri dart__js_annotations =
Uri(scheme: 'dart', path: '_js_annotations');
+10 -8
View File
@@ -332,9 +332,13 @@ String? _getReturnsAnnotation(ir.Constant constant) {
String? _getJsInteropName(ir.Constant constant) {
if (constant is ir.InstanceConstant &&
constant.classNode.name == 'JS' &&
(constant.classNode.enclosingLibrary.importUri == Uris.package_js ||
(constant.classNode.enclosingLibrary.importUri ==
Uris.dart__js_annotations ||
// TODO(srujzs): For now, this allows using `dart:js_interop`'s `@JS`
// for `package:js` classes. In the future, we should either further
// dedup or disallow this.
constant.classNode.enclosingLibrary.importUri ==
Uris.dart__js_annotations)) {
Uris.dart__js_interop)) {
assert(constant.fieldValues.length == 1);
ir.Constant fieldValue = constant.fieldValues.values.single;
if (fieldValue is ir.NullConstant) {
@@ -349,17 +353,15 @@ String? _getJsInteropName(ir.Constant constant) {
bool _isAnonymousJsInterop(ir.Constant constant) {
return constant is ir.InstanceConstant &&
constant.classNode.name == '_Anonymous' &&
(constant.classNode.enclosingLibrary.importUri == Uris.package_js ||
constant.classNode.enclosingLibrary.importUri ==
Uris.dart__js_annotations);
constant.classNode.enclosingLibrary.importUri ==
Uris.dart__js_annotations;
}
bool _isStaticInterop(ir.Constant constant) {
return constant is ir.InstanceConstant &&
constant.classNode.name == '_StaticInterop' &&
(constant.classNode.enclosingLibrary.importUri == Uris.package_js ||
constant.classNode.enclosingLibrary.importUri ==
Uris.dart__js_annotations);
constant.classNode.enclosingLibrary.importUri ==
Uris.dart__js_annotations;
}
bool _isJsInteropObjectLiteral(ir.Constant constant) {
@@ -225,8 +225,9 @@ class NativeBasicData {
// consider these valid JS members?
if (memberIsIgnorable(node)) return;
jsInteropMembers[map.getMember(node)] = name;
if (isJsInteropObjectLiteral)
if (isJsInteropObjectLiteral) {
jsInteropObjectLiterals.add(map.getMember(node));
}
});
return NativeBasicData(
@@ -129,7 +129,8 @@ class Dart2jsTarget extends Target {
super.allowPlatformPrivateLibraryAccess(importer, imported) ||
maybeEnableNative(importer) ||
(importer.isScheme('package') &&
importer.path.startsWith('dart2js_runtime_metrics/'));
(importer.path.startsWith('dart2js_runtime_metrics/') ||
importer.path == 'js/js.dart'));
@override
bool enableNative(Uri uri) => maybeEnableNative(uri);
@@ -40,10 +40,8 @@ class KernelAnnotationProcessor {
String? annotationName;
for (ConstantValue value in metadata) {
String? name = readAnnotationName(commonElements.dartTypes, spannable,
value, commonElements.jsAnnotationClass1!, defaultValue: '') ??
readAnnotationName(commonElements.dartTypes, spannable, value,
commonElements.jsAnnotationClass2!,
defaultValue: '');
value, commonElements.jsAnnotationClass!,
defaultValue: '');
if (annotationName == null) {
annotationName = name;
} else if (name != null) {
+2 -2
View File
@@ -902,12 +902,12 @@ class JSRuntimeFinalizer {
JSRuntimeFinalizer createJSRuntimeFinalizer(
Component component, CoreTypes coreTypes, ClassHierarchy classHierarchy) {
Set<Library> transitiveImportingJSInterop = {
...?calculateTransitiveImportsOfJsInteropIfUsed(
component, Uri.parse("package:js/js.dart")),
...?calculateTransitiveImportsOfJsInteropIfUsed(
component, Uri.parse("dart:_js_annotations")),
...?calculateTransitiveImportsOfJsInteropIfUsed(
component, Uri.parse("dart:_js_helper")),
...?calculateTransitiveImportsOfJsInteropIfUsed(
component, Uri.parse("dart:js_interop")),
};
Map<Procedure, String> jsInteropMethods = {};
jsInteropMethods = _performJSInteropTransformations(
+4 -3
View File
@@ -87,7 +87,8 @@ class WasmTarget extends Target {
bool allowPlatformPrivateLibraryAccess(Uri importer, Uri imported) =>
super.allowPlatformPrivateLibraryAccess(importer, imported) ||
importer.path.contains('tests/web/wasm');
importer.path.contains('tests/web/wasm') ||
importer.isScheme('package') && importer.path == 'js/js.dart';
void _patchHostEndian(CoreTypes coreTypes) {
// Fix Endian.host to be a const field equal to Endian.little instead of
@@ -154,9 +155,9 @@ class WasmTarget extends Target {
ChangedStructureNotifier? changedStructureNotifier}) {
Set<Library> transitiveImportingJSInterop = {
...?jsInteropHelper.calculateTransitiveImportsOfJsInteropIfUsed(
component, Uri.parse("package:js/js.dart")),
component, Uri.parse("dart:_js_annotations")),
...?jsInteropHelper.calculateTransitiveImportsOfJsInteropIfUsed(
component, Uri.parse("dart:_js_annotations"))
component, Uri.parse("dart:js_interop")),
};
if (transitiveImportingJSInterop.isEmpty) {
logger?.call("Skipped JS interop transformations");
@@ -2833,7 +2833,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
js_ast.LiteralString? _emitJSInteropExternalStaticMemberName(NamedNode n) {
if (!usesJSInterop(n)) return null;
if (n is Member && !n.isExternal) return null;
var name = _annotationName(n, isPublicJSAnnotation) ?? getTopLevelName(n);
var name = _annotationName(n, isJSInteropAnnotation) ?? getTopLevelName(n);
assert(!name.contains('.'),
'JS interop checker rejects dotted names on static class members');
return js.escapedString(name, "'");
@@ -2909,8 +2909,9 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
String? _jsNameWithoutGlobal(NamedNode n) {
if (!usesJSInterop(n)) return null;
var libraryJSName = _annotationName(getLibrary(n), isPublicJSAnnotation);
var jsName = _annotationName(n, isPublicJSAnnotation) ?? getTopLevelName(n);
var libraryJSName = _annotationName(getLibrary(n), isJSInteropAnnotation);
var jsName =
_annotationName(n, isJSInteropAnnotation) ?? getTopLevelName(n);
return libraryJSName != null ? '$libraryJSName.$jsName' : jsName;
}
+24 -17
View File
@@ -7,7 +7,7 @@ import 'package:kernel/kernel.dart';
import 'kernel_helpers.dart';
/// Returns true if [library] is one of the [candidates].
/// The latter should be a list, e.g.,: ['dart:js', 'package:js'].
/// The latter should be a list, e.g.,: ['dart:js', 'dart:_js_annotations'].
bool _isLibrary(Library library, List<String> candidates) {
var uri = library.importUri;
var scheme = uri.scheme;
@@ -21,13 +21,17 @@ bool _isLibrary(Library library, List<String> candidates) {
return false;
}
/// Returns true if [library] represents any library from `package:js` or is the
/// internal `dart:_js_helper` library.
/// Returns true if [library] represents any library from
/// `dart:_foreign_helper`, `dart:_js_annotations`, `dart:_js_helper`, or
/// `dart:js_interop`.
bool _isJSLibrary(Library library) => _isLibrary(library, [
'package:js',
'dart:_js_helper',
'dart:_foreign_helper',
'dart:_js_annotations'
'dart:_js_annotations',
'dart:_js_helper',
// TODO(srujzs): For now, this allows using `dart:js_interop`'s `@JS` for
// `package:js` classes. In the future, we should either further dedup or
// disallow this.
'dart:js_interop',
]);
/// Whether [node] is a direct call to `allowInterop`.
@@ -67,8 +71,9 @@ bool isJsRestAnnotation(Expression value) =>
bool isJSAnnotation(Expression value) =>
_annotationIsFromJSLibrary('JS', value) || isJSName(value);
/// Returns [true] if [value] is the `JS` annotation from `package:js`.
bool isPublicJSAnnotation(Expression value) =>
/// Returns [true] if [value] is the `JS` annotation from
/// `dart:_js_annotations` or `dart:js_interop`.
bool isJSInteropAnnotation(Expression value) =>
_annotationIsFromJSLibrary('JS', value);
bool _isJSAnonymousAnnotation(Expression value) =>
@@ -78,7 +83,7 @@ bool _isStaticInteropAnnotation(Expression value) =>
_annotationIsFromJSLibrary('_StaticInterop', value);
/// Whether [value] is a `@JSExportName` (internal annotation used in SDK
/// instead of `@JS` from `package:js`).
/// instead of `@JS` from `dart:_js_annotations`).
bool isJSExportNameAnnotation(Expression value) =>
isBuiltinAnnotation(value, '_foreign_helper', 'JSExportName');
@@ -125,18 +130,20 @@ bool isObjectLiteralAnnotation(Expression value) {
bool hasObjectLiteralAnnotation(Annotatable a) =>
a.annotations.any(isObjectLiteralAnnotation);
/// Returns true iff the class has an `@JS(...)` annotation from `package:js`.
/// Returns true iff the class has an `@JS(...)` annotation from
/// `dart:_js_annotations` or `dart:js_interop`.
///
/// Note: usually [_usesJSInterop] should be used instead of this.
/// Note: usually [usesJSInterop] should be used instead of this.
//
// TODO(jmesserly): I think almost all uses of this should be replaced with
// [_usesJSInterop], which also checks that the library is marked with `@JS`.
// [usesJSInterop], which also checks that the library is marked with `@JS`.
//
// Right now we have inconsistencies: sometimes we'll respect `@JS` on the
// class itself, other places we require it on the library. Also members are
// inconsistent: sometimes they need to have `@JS` on them, other times they
// need to be `external` in an `@JS` class.
bool hasJSInteropAnnotation(Class c) => c.annotations.any(isPublicJSAnnotation);
bool hasJSInteropAnnotation(Class c) =>
c.annotations.any(isJSInteropAnnotation);
/// Returns true iff this element is a JS interop member.
///
@@ -147,11 +154,11 @@ bool hasJSInteropAnnotation(Class c) => c.annotations.any(isPublicJSAnnotation);
/// the class or library.
bool usesJSInterop(NamedNode n) {
if (n is Member && n.isExternal) {
return n.enclosingLibrary.annotations.any(isPublicJSAnnotation) ||
n.annotations.any(isPublicJSAnnotation) ||
(n.enclosingClass?.annotations.any(isPublicJSAnnotation) ?? false);
return n.enclosingLibrary.annotations.any(isJSInteropAnnotation) ||
n.annotations.any(isJSInteropAnnotation) ||
(n.enclosingClass?.annotations.any(isJSInteropAnnotation) ?? false);
} else if (n is Class) {
return n.annotations.any(isPublicJSAnnotation);
return n.annotations.any(isJSInteropAnnotation);
}
return false;
}
@@ -101,8 +101,9 @@ bool isBuiltinAnnotation(
///
/// For example:
///
/// - `@JS()` would return the "JS" class in "package:js".
/// - `@anonymous` would return the "_Anonymous" class in "package:js".
/// - `@JS()` would return the "JS" class in "dart:_js_annotations".
/// - `@anonymous` would return the "_Anonymous" class in
/// "dart:_js_annotations".
///
/// This function works regardless of whether the CFE is evaluating constants,
/// or whether the constant is a field reference (such as "anonymous" above).
+2 -1
View File
@@ -145,7 +145,8 @@ class DevCompilerTarget extends Target {
super.allowPlatformPrivateLibraryAccess(importer, imported) ||
_allowedTestLibrary(importer) ||
(importer.isScheme('package') &&
importer.path.startsWith('dart2js_runtime_metrics/'));
(importer.path.startsWith('dart2js_runtime_metrics/') ||
importer.path == 'js/js.dart'));
@override
bool get nativeExtensionExpectsString => false;
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -79,7 +79,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String>
@@ -88,5 +88,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -94,7 +94,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String>
@@ -103,5 +103,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -79,7 +79,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String*>
@@ -88,5 +88,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -79,7 +79,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String*>
@@ -88,5 +88,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@js::JS::•()
@_js_annotations::JS::•()
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -10,7 +10,7 @@ abstract class A extends core::Object {
synthetic constructor •() → self::A
;
}
@js::JS::•()
@_js::JS::•()
inline class B /* declaredRepresentationType = self::A */ {
get field = self::B|get#field;
set field = self::B|set#field;
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -94,7 +94,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String*>
@@ -103,5 +103,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -79,7 +79,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String>
@@ -88,5 +88,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -94,7 +94,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String>
@@ -103,5 +103,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -79,7 +79,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String*>
@@ -88,5 +88,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -79,7 +79,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String*>
@@ -88,5 +88,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,7 +1,7 @@
@js::JS::•()
@_js_annotations::JS::•()
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -10,7 +10,7 @@ abstract class A extends core::Object {
synthetic constructor •() → self::A
;
}
@js::JS::•()
@_js::JS::•()
inline class B /* declaredRepresentationType = self::A */ {
get field = self::B|get#field;
set field = self::B|set#field;
@@ -1,7 +1,7 @@
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -94,7 +94,7 @@ static method method(self::A a) → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = static-tearoff self::B|staticMethod
#C4 = static-tearoff self::B|staticGenericMethod
#C5 = instantiation #C4 <core::String*>
@@ -103,5 +103,5 @@ constants {
Constructor coverage from constants:
org-dartlang-testcase:///external.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -12,7 +12,7 @@ static method main() → void {
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as sta;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -39,14 +39,14 @@ static method setUp() → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = "JSClass"
#C4 = js::JS {name:#C3}
#C5 = js::_StaticInterop {}
#C4 = _js::JS {name:#C3}
#C5 = _js::_StaticInterop {}
}
Constructor coverage from constants:
org-dartlang-testcase:///main_lib.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -12,7 +12,7 @@ static method main() → void {
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as sta;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -39,14 +39,14 @@ static method setUp() → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = "JSClass"
#C4 = js::JS {name:#C3}
#C5 = js::_StaticInterop {}
#C4 = _js::JS {name:#C3}
#C5 = _js::_StaticInterop {}
}
Constructor coverage from constants:
org-dartlang-testcase:///main_lib.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -12,7 +12,7 @@ static method main() → void {
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as sta;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -39,14 +39,14 @@ static method setUp() → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = "JSClass"
#C4 = js::JS {name:#C3}
#C5 = js::_StaticInterop {}
#C4 = _js::JS {name:#C3}
#C5 = _js::_StaticInterop {}
}
Constructor coverage from constants:
org-dartlang-testcase:///main_lib.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -9,7 +9,7 @@ static method main() → void
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as self2;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -34,14 +34,14 @@ static method setUp() → void
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = "JSClass"
#C4 = js::JS {name:#C3}
#C5 = js::_StaticInterop {}
#C4 = _js::JS {name:#C3}
#C5 = _js::_StaticInterop {}
}
Constructor coverage from constants:
org-dartlang-testcase:///main_lib.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -12,7 +12,7 @@ static method main() → void {
@#C2
library static_interop /*isNonNullableByDefault*/;
import self as sta;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "dart:js_util" as js_;
@@ -39,14 +39,14 @@ static method setUp() → void {
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C2 = _js::JS {name:#C1}
#C3 = "JSClass"
#C4 = js::JS {name:#C3}
#C5 = js::_StaticInterop {}
#C4 = _js::JS {name:#C3}
#C5 = _js::_StaticInterop {}
}
Constructor coverage from constants:
org-dartlang-testcase:///main_lib.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,12 +1,12 @@
library /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@js::JS::•()
@js::anonymous
@_js::JS::•()
@_js::anonymous
class ParallaxOptions extends core::Object {
external static factory •() → self::ParallaxOptions;
static method _#new#tearOff() → self::ParallaxOptions
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123b.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123b.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123b.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123b.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,12 +1,12 @@
library /*isNonNullableByDefault*/;
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@js::JS::•()
@js::anonymous
@_js::JS::•()
@_js::anonymous
class ParallaxOptions extends core::Object /*hasConstConstructor*/ {
external const constructor •() → self::ParallaxOptions;
static method _#new#tearOff() → self::ParallaxOptions
@@ -10,7 +10,7 @@ library /*isNonNullableByDefault*/;
// ^
//
import self as self;
import "package:js/js.dart" as js;
import "dart:_js_annotations" as _js;
import "dart:core" as core;
import "package:js/js.dart";
@@ -28,12 +28,12 @@ static method main() → dynamic {}
constants {
#C1 = null
#C2 = js::JS {name:#C1}
#C3 = js::_Anonymous {}
#C2 = _js::JS {name:#C1}
#C3 = _js::_Anonymous {}
}
Constructor coverage from constants:
org-dartlang-testcase:///issue46123b.dart:
- JS. (from org-dartlang-testcase-sdk:///pkg/js/lib/js.dart:23:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -79,14 +79,7 @@ worlds:
eval('''function JSClass() {}''');
}
js/lib/js.dart: |
class JS {
final String? name;
const JS([this.name]);
}
class _StaticInterop {
const _StaticInterop();
}
const _StaticInterop staticInterop = _StaticInterop();
export 'dart:_js_annotations' show JS, staticInterop;
.dart_tool/package_config.json: |
{
"configVersion": 2,
@@ -1,22 +1,10 @@
main = main::main;
library from "package:js/js.dart" as js {
additionalExports = (_js::staticInterop,
_js::JS)
export "dart:_js_annotations" show JS, staticInterop;
class JS extends dart.core::Object /*hasConstConstructor*/ {
final field dart.core::String? name;
const constructor •([dart.core::String? name = #C1]) → js::JS
: js::JS::name = name, super dart.core::Object::•()
;
static method _#new#tearOff([dart.core::String? name = #C1]) → js::JS
return new js::JS::•(name);
}
class _StaticInterop extends dart.core::Object /*hasConstConstructor*/ {
const constructor •() → js::_StaticInterop
: super dart.core::Object::•()
;
static method _#new#tearOff() → js::_StaticInterop
return new js::_StaticInterop::•();
}
static const field js::_StaticInterop staticInterop = #C2;
}
library from "org-dartlang-test:///lib1.dart" as lib1 {
@@ -45,13 +33,13 @@ library from "org-dartlang-test:///lib1.dart" as lib1 {
return sta::StaticJSClass::•();
static set topLevelSetter((sta::StaticJSClass) → void f) → void {}
}
@#C3
@#C2
library static_interop from "org-dartlang-test:///lib2.dart" as sta {
import "package:js/js.dart";
@#C4
@#C5
@#C2
class StaticJSClass extends dart.core::Object {
static factory •() → sta::StaticJSClass
return dart.js_util::_callConstructorUnchecked0<sta::StaticJSClass>(dart.js_util::_getPropertyTrustType<dart.core::Object>(dart.js_util::globalThis, "JSClass"));
@@ -63,7 +51,7 @@ library static_interop from "org-dartlang-test:///lib2.dart" as sta {
static method _#factory#tearOff() → sta::StaticJSClass
return sta::StaticJSClass::factory();
}
@#C3
@#C2
external static method eval(dart.core::String code) → void;
static method setUp() → void {
sta::eval("function JSClass() {}");
@@ -105,10 +93,10 @@ library from "org-dartlang-test:///main.dart" as main {
}
constants {
#C1 = null
#C2 = js::_StaticInterop {}
#C3 = js::JS {name:#C1}
#C4 = "JSClass"
#C5 = js::JS {name:#C4}
#C2 = _js_annotations::JS {name:#C1}
#C3 = "JSClass"
#C4 = _js_annotations::JS {name:#C3}
#C5 = _js_annotations::_StaticInterop {}
#C6 = static-tearoff lib1::topLevelMethod
#C7 = static-tearoff lib1::Class::staticMethod
}
@@ -116,10 +104,6 @@ constants {
Constructor coverage from constants:
org-dartlang-test:///lib2.dart:
- JS. (from org-dartlang-test:///js/lib/js.dart:3:9)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
org-dartlang-test:///js/lib/js.dart:
- _StaticInterop. (from org-dartlang-test:///js/lib/js.dart:6:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
@@ -1,22 +1,10 @@
main = main::main;
library from "package:js/js.dart" as js {
additionalExports = (_js::staticInterop,
_js::JS)
export "dart:_js_annotations" show JS, staticInterop;
class JS extends dart.core::Object /*hasConstConstructor*/ {
final field dart.core::String? name;
const constructor •([dart.core::String? name = #C1]) → js::JS
: js::JS::name = name, super dart.core::Object::•()
;
static method _#new#tearOff([dart.core::String? name = #C1]) → js::JS
return new js::JS::•(name);
}
class _StaticInterop extends dart.core::Object /*hasConstConstructor*/ {
const constructor •() → js::_StaticInterop
: super dart.core::Object::•()
;
static method _#new#tearOff() → js::_StaticInterop
return new js::_StaticInterop::•();
}
static const field js::_StaticInterop staticInterop = #C2;
}
library from "org-dartlang-test:///lib1.dart" as lib1 {
@@ -45,13 +33,13 @@ library from "org-dartlang-test:///lib1.dart" as lib1 {
return sta::StaticJSClass::•();
static set topLevelSetter((sta::StaticJSClass) → void f) → void {}
}
@#C3
@#C2
library static_interop from "org-dartlang-test:///lib2.dart" as sta {
import "package:js/js.dart";
@#C4
@#C5
@#C2
class StaticJSClass extends dart.core::Object {
static factory •() → sta::StaticJSClass
return dart.js_util::_callConstructorUnchecked0<sta::StaticJSClass>(dart.js_util::_getPropertyTrustType<dart.core::Object>(dart.js_util::globalThis, "JSClass"));
@@ -63,7 +51,7 @@ library static_interop from "org-dartlang-test:///lib2.dart" as sta {
static method _#factory#tearOff() → sta::StaticJSClass
return sta::StaticJSClass::factory();
}
@#C3
@#C2
external static method eval(dart.core::String code) → void;
static method setUp() → void {
sta::eval("function JSClass() {}");
@@ -106,10 +94,10 @@ library from "org-dartlang-test:///main.dart" as main {
}
constants {
#C1 = null
#C2 = js::_StaticInterop {}
#C3 = js::JS {name:#C1}
#C4 = "JSClass"
#C5 = js::JS {name:#C4}
#C2 = _js_annotations::JS {name:#C1}
#C3 = "JSClass"
#C4 = _js_annotations::JS {name:#C3}
#C5 = _js_annotations::_StaticInterop {}
#C6 = static-tearoff lib1::topLevelMethod
#C7 = static-tearoff lib1::Class::staticMethod
}
@@ -117,10 +105,6 @@ constants {
Constructor coverage from constants:
org-dartlang-test:///lib2.dart:
- JS. (from org-dartlang-test:///js/lib/js.dart:3:9)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
org-dartlang-test:///js/lib/js.dart:
- _StaticInterop. (from org-dartlang-test:///js/lib/js.dart:6:9)
- JS. (from org-dartlang-sdk:///lib/js/_js_annotations.dart)
- Object. (from org-dartlang-sdk:///lib/core/object.dart)
+1
View File
@@ -3,6 +3,7 @@
- Remove dependency on `dart:js`.
- Update SDK lower constraint to 3.0.0-217.0.dev.
- Update SDK upper constraint to 4.0.0.
- Moved annotations to single location in `dart:_js_annotations`.
## 0.6.7
+3 -83
View File
@@ -2,89 +2,9 @@
// 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.
/// Annotations to mark interfaces to JavaScript.
library js;
import 'package:meta/meta.dart';
// ignore: EXPORT_INTERNAL_LIBRARY
export 'dart:_js_annotations'
show JS, anonymous, staticInterop, trustTypes, JSExport;
export 'dart:js_util' show allowInterop, allowInteropCaptureThis;
/// An annotation that indicates a library, class, or member is implemented
/// directly in JavaScript.
///
/// All external members of a class or library with this annotation implicitly
/// have it as well.
///
/// Specifying [name] customizes the JavaScript name to use. By default the
/// dart name is used. It is not valid to specify a custom [name] for class
/// instance members.
class JS {
final String? name;
const JS([this.name]);
}
class _Anonymous {
const _Anonymous();
}
class _StaticInterop {
const _StaticInterop();
}
/// An annotation that indicates a [JS] annotated class is structural and does
/// not have a known JavaScript prototype.
///
/// A class marked with [anonymous] must have an unnamed factory constructor
/// with no positional arguments, only named arguments. Invoking the constructor
/// desugars to creating a JavaScript object literal with name-value pairs
/// corresponding to the parameter names and values.
const _Anonymous anonymous = _Anonymous();
/// [staticInterop] enables the [JS] annotated class to be treated as a "static"
/// interop class.
///
/// These classes allow interop with native types, like the ones in `dart:html`.
/// These classes should not contain any instance members, inherited or
/// otherwise, and should instead use static extension members.
const _StaticInterop staticInterop = _StaticInterop();
/// NOTE: [trustTypes] is an experimental annotation that may disappear at any
/// point in time. It exists solely to help users who wish to migrate classes
/// from the older style of JS interop to the new static interop model but wish
/// to preserve the older semantics for type checks. This annotation must be
/// used alongside [staticInterop] and it affects any external methods in any
/// extension to the static interop class.
@experimental
class _TrustTypes {
const _TrustTypes();
}
const _TrustTypes trustTypes = _TrustTypes();
/// Annotation to mark Dart classes as exportable and allow instance members to
/// be wrapped with an object literal.
///
/// Dart classes with this annotation can be used for exporting in `js_util`'s
/// `createDartExport`, which returns a JS object that forwards to the Dart
/// class. You may either annotate specific instance members to only export
/// those members or you can annotate the entire class (which will export all
/// instance members) to mark the class as exportable.
///
/// Classes and mixins in the hierarchy are included only if they are annotated
/// or specific members in them are annotated. If a superclass does not have an
/// annotation anywhere, its members are not included. Only concrete instance
/// members can and will be exported, and it's an error to annotate other
/// members with this annotation. In order to do renaming for members, you can
/// provide a name for the `@JSExport` on the members e.g.
/// ```
/// class Export {
/// @JSExport('printHelloWorld')
/// void printMessage() => print('Hello World!');
/// }
/// ```
/// which will then set 'printHelloWorld' to forward to `printMessage` in the
/// object literal.
class JSExport {
final String name;
const JSExport([this.name = '']);
}
+5 -3
View File
@@ -3,12 +3,14 @@ version: 0.6.9-dev
description: Annotations to create static Dart interfaces for JavaScript APIs.
repository: https://github.com/dart-lang/sdk/tree/main/pkg/js
# We export `dart:_js_annotations` in this library.
analyzer:
errors:
export_internal_library: ignore
environment:
sdk: ">=3.0.0-217.0.dev <4.0.0"
dependencies:
meta: ^1.7.0
# We use 'any' version constraints here as we get our package versions from
# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
# best practice for packages is to specify their compatible version ranges.
@@ -2,7 +2,7 @@
// 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.
import 'dart:_foreign_helper' show JS;
import 'dart:_foreign_helper' as foreign_helper;
import 'dart:_internal' show patch;
import 'dart:_js_types';
import 'dart:js_util';
@@ -15,7 +15,8 @@ extension NullableUndefineableJSAnyExtension on JSAny? {
bool get isUndefined => this == null || typeofEquals(this, 'undefined');
@patch
bool get isNull => this == null || JS('bool', '# === null', this);
bool get isNull =>
this == null || foreign_helper.JS('bool', '# === null', this);
}
/// [JSExportedDartFunction] <-> [Function]
+59 -3
View File
@@ -2,13 +2,21 @@
// 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.
// An implementation of the JS interop classes which are usable from the
// Dart SDK. These types need to stay in-sync with
// https://github.com/dart-lang/sdk/blob/master/pkg/js/lib/js.dart
/// Annotations to mark interfaces to JavaScript. All of these annotations are
/// exported via `package:js`.
library _js_annotations;
export 'dart:js_util' show allowInterop, allowInteropCaptureThis;
/// An annotation that indicates a library, class, or member is implemented
/// directly in JavaScript.
///
/// All external members of a class or library with this annotation implicitly
/// have it as well.
///
/// Specifying [name] customizes the JavaScript name to use. By default the
/// dart name is used. It is not valid to specify a custom [name] for class
/// instance members.
class JS {
final String? name;
const JS([this.name]);
@@ -22,10 +30,58 @@ class _StaticInterop {
const _StaticInterop();
}
/// An annotation that indicates a [JS] annotated class is structural and does
/// not have a known JavaScript prototype.
///
/// A class marked with [anonymous] must have an unnamed factory constructor
/// with no positional arguments, only named arguments. Invoking the constructor
/// desugars to creating a JavaScript object literal with name-value pairs
/// corresponding to the parameter names and values.
const _Anonymous anonymous = _Anonymous();
/// [staticInterop] enables the [JS] annotated class to be treated as a "static"
/// interop class.
///
/// These classes allow interop with native types, like the ones in `dart:html`.
/// These classes should not contain any instance members, inherited or
/// otherwise, and should instead use static extension members.
const _StaticInterop staticInterop = _StaticInterop();
/// NOTE: [trustTypes] is an experimental annotation that may disappear at any
/// point in time. It exists solely to help users who wish to migrate classes
/// from the older style of JS interop to the new static interop model but wish
/// to preserve the older semantics for type checks. This annotation must be
/// used alongside [staticInterop] and it affects any external methods in any
/// extension to the static interop class.
class _TrustTypes {
const _TrustTypes();
}
const _TrustTypes trustTypes = _TrustTypes();
/// Annotation to mark Dart classes as exportable and allow instance members to
/// be wrapped with an object literal.
///
/// Dart classes with this annotation can be used for exporting in `js_util`'s
/// `createDartExport`, which returns a JS object that forwards to the Dart
/// class. You may either annotate specific instance members to only export
/// those members or you can annotate the entire class (which will export all
/// instance members) to mark the class as exportable.
///
/// Classes and mixins in the hierarchy are included only if they are annotated
/// or specific members in them are annotated. If a superclass does not have an
/// annotation anywhere, its members are not included. Only concrete instance
/// members can and will be exported, and it's an error to annotate other
/// members with this annotation. In order to do renaming for members, you can
/// provide a name for the `@JSExport` on the members e.g.
/// ```
/// class Export {
/// @JSExport('printHelloWorld')
/// void printMessage() => print('Hello World!');
/// }
/// ```
/// which will then set 'printHelloWorld' to forward to `printMessage` in the
/// object literal.
class JSExport {
final String name;
const JSExport([this.name = '']);
+24 -5
View File
@@ -21,11 +21,30 @@ library dart.js_interop;
import 'dart:_js_types' as js_types;
import 'dart:typed_data';
/// Export the `dart:_js_annotations` version of the `@JS` annotation. This is
/// mostly identical to the `package:js` version, except this is meant to be used
/// for sound top-level external members and inline classes instead of the
/// `package:js` classes.
export 'dart:_js_annotations' show JS;
/// The annotation for JS interop members.
///
/// This is meant to signify that a given library, top-level external member, or
/// inline class is a JS interop declaration.
///
/// Specifying [name] customizes the JavaScript name to use. This can be used in
/// the following scenarios:
///
/// - Namespacing all the external top-level members, static members, and
/// constructors of a library by annotating the library with a custom name.
/// - Namespacing all the external static members and constructors of an inline
/// class by annotating the inline class with a custom name.
/// - Renaming external members by annotating the member with a custom name.
///
/// In the case where [name] is not specified, we default to the Dart name for
/// inline classes and external members.
///
/// Note: `package:js` has a `@JS` annotation as well. Unlike that annotation,
/// this is meant for inline classes, and will result in more type-checking for
/// external top-level members.
class JS {
final String? name;
const JS([this.name]);
}
/// The annotation for object literal constructors.
///
@@ -9,7 +9,7 @@ import 'dart:js_util';
import 'dart:typed_data';
import 'package:expect/minitest.dart';
import 'package:js/js.dart';
import 'package:js/js.dart' as js;
@JS()
external void eval(String code);
@@ -20,8 +20,8 @@ external JSAny any;
@JS()
external JSObject obj;
@JS()
@staticInterop
@js.JS()
@js.staticInterop
class SimpleObject {}
extension SimpleObjectExtension on SimpleObject {
@@ -12,7 +12,7 @@ import 'dart:_interceptors' show JavaScriptObject;
import 'package:js/js.dart';
import '../native_testing.dart';
import '../native_testing.dart' hide JS;
import '../native_testing.dart' as native_testing;
import 'factory_stub_lib.dart';
@@ -14,7 +14,7 @@ import 'package:expect/expect.dart' show hasUnsoundNullSafety;
import 'package:expect/minitest.dart';
import 'package:js/js.dart';
import '../native_testing.dart';
import '../native_testing.dart' hide JS;
import '../native_testing.dart' as native_testing;
NativeClass makeNativeClass() native;
@@ -13,7 +13,7 @@ import 'dart:_interceptors' show JavaScriptObject;
import 'package:expect/minitest.dart';
import 'package:js/js.dart';
import '../native_testing.dart';
import '../native_testing.dart' hide JS;
import '../native_testing.dart' as native_testing;
NativeClass makeNativeClass() native;
+1 -1
View File
@@ -8,7 +8,7 @@ import 'dart:typed_data';
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:js/js.dart';
import 'package:js/js.dart' hide JS;
@JS()
external void eval(String code);
@@ -14,7 +14,7 @@ import 'dart:_interceptors' show JavaScriptObject;
import 'package:js/js.dart';
import '../native_testing.dart';
import '../native_testing.dart' hide JS;
import '../native_testing.dart' as native_testing;
import 'factory_stub_lib.dart';
@@ -15,7 +15,7 @@ import 'dart:_interceptors' show JavaScriptObject;
import 'package:expect/minitest.dart';
import 'package:js/js.dart';
import '../native_testing.dart';
import '../native_testing.dart' hide JS;
import '../native_testing.dart' as native_testing;
NativeClass makeNativeClass() native;
@@ -15,7 +15,7 @@ import 'dart:_interceptors' show JavaScriptObject;
import 'package:expect/minitest.dart';
import 'package:js/js.dart';
import '../native_testing.dart';
import '../native_testing.dart' hide JS;
import '../native_testing.dart' as native_testing;
NativeClass makeNativeClass() native;