[package:js] Clean up boolean logic for isJSInteropMember

Change-Id: I364d8029f134e549e6649439e9038a34e486137c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171630
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
This commit is contained in:
Riley Porter 2020-11-13 07:44:06 +00:00 committed by commit-bot@chromium.org
parent 55bb15a8cb
commit 4c0ddfbc1e

View file

@ -170,12 +170,17 @@ class JsInteropChecks extends RecursiveVisitor<void> {
/// Returns whether [member] is considered to be a JS interop member.
bool _isJSInteropMember(Member member) {
if (!member.isExternal) return false;
if (_classHasJSAnnotation) return true;
if (!_classHasJSAnnotation && member.enclosingClass != null) return false;
// In the case where the member does not belong to any class, a JS
// annotation is not needed on the library to be considered JS interop as
// long as the member has an annotation.
return hasJSInteropAnnotation(member) || _libraryHasJSAnnotation;
if (member.isExternal) {
if (_classHasJSAnnotation) return true;
if (member.enclosingClass == null) {
// In the case where the member does not belong to any class, a JS
// annotation is not needed on the library to be considered JS interop
// as long as the member has an annotation.
return hasJSInteropAnnotation(member) || _libraryHasJSAnnotation;
}
}
// Otherwise, not JS interop.
return false;
}
}