dart-sdk/tests/web/regress/private_names_lib1.dart
Johnni Winther 50ac2500a1 [dart2js] Handle private names correctly in K/J-model
The library wasn't taken into account when handling computing class
members in the K/J-model and not handled correctly when computing
applicable selectors. This made dart2js unable to handle members with
a name private to a different library than the enclosing library.

Fixes #33732
Fixes #49226

Change-Id: I5ba143d87662bbd42e0ff02355054e4a937be8f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252665
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-08-11 06:56:32 +00:00

76 lines
2 KiB
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 'private_names_lib2.dart';
export 'private_names_lib2.dart' show DoubleLinkedQueueEntry;
abstract class _DoubleLinkedQueueEntry<E> {
_DoubleLinkedQueueEntry<E>? _previousLink;
_DoubleLinkedQueueEntry<E>? _nextLink;
void _link(
_DoubleLinkedQueueEntry<E>? previous, _DoubleLinkedQueueEntry<E>? next) {
_nextLink = next;
_previousLink = previous;
previous?._nextLink = this;
next?._previousLink = this;
}
_DoubleLinkedQueueElement<E>? _asNonSentinelEntry();
void _prepend(E element, DoubleLinkedQueue<E>? queue) {
_DoubleLinkedQueueElement<E>(element, queue)._link(_previousLink, this);
}
}
class _DoubleLinkedQueueElement<E> extends _DoubleLinkedQueueEntry<E>
implements DoubleLinkedQueueEntry<E> {
DoubleLinkedQueue<E>? _queue;
E element;
_DoubleLinkedQueueElement(this.element, this._queue);
void prepend(E e) {
_prepend(e, _queue);
_queue?._elementCount++;
}
_DoubleLinkedQueueElement<E> _asNonSentinelEntry() => this;
}
class _DoubleLinkedQueueSentinel<E> extends _DoubleLinkedQueueEntry<E> {
_DoubleLinkedQueueSentinel() {
_previousLink = this;
_nextLink = this;
}
Null _asNonSentinelEntry() => null;
}
class DoubleLinkedQueue<E> /*extends Iterable<E> implements Queue<E>*/ {
final _DoubleLinkedQueueSentinel<E> _sentinel =
_DoubleLinkedQueueSentinel<E>();
int _elementCount = 0;
DoubleLinkedQueue();
factory DoubleLinkedQueue.from(Iterable<dynamic> elements) {
DoubleLinkedQueue<E> list = DoubleLinkedQueue<E>();
for (final e in elements) {
list.addLast(e as E);
}
return list;
}
void addLast(E value) {
_sentinel._prepend(value, this);
_elementCount++;
}
DoubleLinkedQueueEntry<E>? firstEntry() =>
_sentinel._nextLink!._asNonSentinelEntry();
}