Ensure native methods default to have all side-effects

note: NativeBehavior also has a SideEffect property, which is only used for
foreign helpers. If we add annotations in the future, we could move the effects
there and consume them at this point in inference.
Change-Id: I3e62faa3d80c0ba96a2626972c332c27eb52c142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130964
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
diff --git a/pkg/compiler/lib/src/inferrer/builder_kernel.dart b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
index 48e3b92..07a9e32 100644
--- a/pkg/compiler/lib/src/inferrer/builder_kernel.dart
+++ b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
@@ -391,7 +391,8 @@
 
     if (_closedWorld.nativeData.isNativeMember(_analyzedMember)) {
       // Native methods do not have a body, and we currently just say
-      // they return dynamic.
+      // they return dynamic and may contain all side-effects.
+      _sideEffectsBuilder.setAllSideEffectsAndDependsOnSomething();
       return _types.dynamicType;
     }