dart-sdk/tests/lib/js/static_class_member_static_test.dart
Sigmund Cherem e808fa1751 [jsinterop] Add static check for JSName of static class members.
Static class members could technically be mapped to a name with dots,
but in the early days of JSInterop we thought this was not necessary
since it could also be modeled as a top-level member or by adding
additional classes and exposing the member as a simple name on a deeper
class.

This invariant was assumed by DDC (which crashed if this was not the
case) and ignored by dart2js.

This change adds a static check to ensure both compilers act
consistenlty.

Fixes https://github.com/dart-lang/sdk/issues/27926

Change-Id: I20e59fbb75f0378a58ca88dc3910e079b4eeb7a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247180
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2022-06-03 17:02:26 +00:00

16 lines
428 B
Dart

// Copyright (c) 2022, 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.
import 'package:js/js.dart';
@JS('a.Foo')
class Foo {
@JS('c.d.plus')
external static plus1(arg);
// ^
// [web] JS interop static class members cannot have '.' in their JS name.
}
main() {}