mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
[cfe] Add basic parsing support for extension show clause
Change-Id: I63847a06ff7370dd1b92fc6b4b706c684f15638e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209909 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
parent
ccfe2d65a9
commit
ab508bb2d1
|
@ -651,9 +651,9 @@ class ForwardingListener implements Listener {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token endToken) {
|
||||
listener?.endExtensionDeclaration(
|
||||
extensionKeyword, typeKeyword, onKeyword, endToken);
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
|
||||
listener?.endExtensionDeclaration(extensionKeyword, typeKeyword, onKeyword,
|
||||
showKeyword, hideKeyword, endToken);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1159,6 +1159,13 @@ class ForwardingListener implements Listener {
|
|||
listener?.handleClassOrMixinImplements(implementsKeyword, interfacesCount);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleExtensionShowHide(Token? showKeyword, int showElementCount,
|
||||
Token? hideKeyword, int hideElementCount) {
|
||||
listener?.handleExtensionShowHide(
|
||||
showKeyword, showElementCount, hideKeyword, hideElementCount);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleClassWithClause(Token withKeyword) {
|
||||
listener?.handleClassWithClause(withKeyword);
|
||||
|
@ -1280,6 +1287,11 @@ class ForwardingListener implements Listener {
|
|||
listener?.handleFunctionBodySkipped(token, isExpressionBody);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleShowHideIdentifier(Token? modifier, Token identifier) {
|
||||
listener?.handleShowHideIdentifier(modifier, identifier);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleIdentifier(Token token, IdentifierContext context) {
|
||||
listener?.handleIdentifier(token, context);
|
||||
|
|
|
@ -226,6 +226,30 @@ abstract class IdentifierContext {
|
|||
static const ExpressionIdentifierContext expressionContinuation =
|
||||
const ExpressionIdentifierContext.continuation();
|
||||
|
||||
/// Identifier appears in a show or a hide clause of an extension type
|
||||
/// declaration preceded by 'get'.
|
||||
static const ExtensionShowHideElementIdentifierContext
|
||||
extensionShowHideElementGetter =
|
||||
const ExtensionShowHideElementIdentifierContext.getter();
|
||||
|
||||
/// Identifier appears in a show or a hide clause of an extension type
|
||||
/// declaration, not preceded by 'get', 'set', or 'operator'.
|
||||
static const ExtensionShowHideElementIdentifierContext
|
||||
extensionShowHideElementMemberOrType =
|
||||
const ExtensionShowHideElementIdentifierContext.memberOrType();
|
||||
|
||||
/// Identifier appears in a show or a hide clause of an extension type
|
||||
/// declaration preceded by 'operator'.
|
||||
static const ExtensionShowHideElementIdentifierContext
|
||||
extensionShowHideElementOperator =
|
||||
const ExtensionShowHideElementIdentifierContext.operator();
|
||||
|
||||
/// Identifier appears in a show or a hide clause of an extension type
|
||||
/// declaration preceded by 'set'.
|
||||
static const ExtensionShowHideElementIdentifierContext
|
||||
extensionShowHideElementSetter =
|
||||
const ExtensionShowHideElementIdentifierContext.setter();
|
||||
|
||||
/// Identifier is a reference to a named argument of a function or method
|
||||
/// invocation (e.g. `foo` in `f(foo: 0);`.
|
||||
static const NamedArgumentReferenceIdentifierContext namedArgumentReference =
|
||||
|
|
|
@ -371,6 +371,84 @@ class ExpressionIdentifierContext extends IdentifierContext {
|
|||
}
|
||||
}
|
||||
|
||||
/// See [IdentifierContext.extensionShowHideElementGetter],
|
||||
/// [IdentifierContext.extensionShowHideElementMemberOrType],
|
||||
/// [IdentifierContext.extensionShowHideElementOperator],
|
||||
/// [IdentifierContext.extensionShowHideElementSetter].
|
||||
class ExtensionShowHideElementIdentifierContext extends IdentifierContext {
|
||||
static const int _getterKind = 0;
|
||||
static const int _memberOrTypeKind = 1;
|
||||
static const int _operator = 2;
|
||||
static const int _setterKind = 3;
|
||||
|
||||
final int _kind;
|
||||
|
||||
const ExtensionShowHideElementIdentifierContext.getter()
|
||||
: _kind = _getterKind,
|
||||
super('extensionShowHideElementGetter', inDeclaration: true);
|
||||
|
||||
const ExtensionShowHideElementIdentifierContext.memberOrType()
|
||||
: _kind = _memberOrTypeKind,
|
||||
super('extensionShowHideElementMemberOrType', inDeclaration: true);
|
||||
|
||||
const ExtensionShowHideElementIdentifierContext.operator()
|
||||
: _kind = _operator,
|
||||
super('extensionShowHideElementOperator', inDeclaration: true);
|
||||
|
||||
const ExtensionShowHideElementIdentifierContext.setter()
|
||||
: _kind = _setterKind,
|
||||
super('extensionShowHideElementSetter', inDeclaration: true);
|
||||
|
||||
@override
|
||||
Token ensureIdentifier(Token token, Parser parser) {
|
||||
Token identifier = token.next!;
|
||||
if (identifier.isIdentifier ||
|
||||
_kind == _operator && identifier.isOperator) {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
// Recovery
|
||||
const List<String> afterIdentifier = const [
|
||||
'<',
|
||||
'{',
|
||||
'extends',
|
||||
'with',
|
||||
'implements',
|
||||
'on',
|
||||
'=',
|
||||
];
|
||||
if (identifier.isEof ||
|
||||
(looksLikeStartOfNextTopLevelDeclaration(identifier) &&
|
||||
(identifier.next == null ||
|
||||
!isOneOfOrEof(identifier.next!, afterIdentifier))) ||
|
||||
(isOneOfOrEof(identifier, afterIdentifier) &&
|
||||
(identifier.next == null ||
|
||||
!isOneOfOrEof(identifier.next!, afterIdentifier)))) {
|
||||
identifier = parser.insertSyntheticIdentifier(token, this,
|
||||
message: codes.templateExpectedIdentifier.withArguments(identifier));
|
||||
} else {
|
||||
if (!identifier.isKeywordOrIdentifier) {
|
||||
parser.reportRecoverableErrorWithToken(
|
||||
identifier, codes.templateExpectedIdentifier);
|
||||
// When in doubt, consume the token to ensure we make progress
|
||||
// but insert a synthetic identifier to satisfy listeners.
|
||||
identifier = parser.rewriter.insertSyntheticIdentifier(identifier);
|
||||
} else {
|
||||
// Use the keyword as the identifier.
|
||||
parser.reportRecoverableErrorWithToken(
|
||||
identifier, codes.templateExpectedIdentifierButGotKeyword);
|
||||
}
|
||||
}
|
||||
return identifier;
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return other is ExtensionShowHideElementIdentifierContext &&
|
||||
_kind == other._kind;
|
||||
}
|
||||
}
|
||||
|
||||
/// See [IdentifierContext.fieldDeclaration].
|
||||
class FieldDeclarationIdentifierContext extends IdentifierContext {
|
||||
const FieldDeclarationIdentifierContext()
|
||||
|
|
|
@ -144,6 +144,14 @@ class Listener implements UnescapeErrorListener {
|
|||
logEvent("ClassImplements");
|
||||
}
|
||||
|
||||
/// Handle a show clause in an extension declaration.
|
||||
/// Substructures:
|
||||
/// - shown types and instance members
|
||||
void handleExtensionShowHide(Token? showKeyword, int showElementCount,
|
||||
Token? hideKeyword, int hideElementCount) {
|
||||
logEvent("ExtensionShowHide");
|
||||
}
|
||||
|
||||
/// Handle the header of a class declaration. Substructures:
|
||||
/// - metadata
|
||||
/// - modifiers
|
||||
|
@ -238,7 +246,7 @@ class Listener implements UnescapeErrorListener {
|
|||
/// - on type
|
||||
/// - body
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token endToken) {
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
|
||||
logEvent('ExtensionDeclaration');
|
||||
}
|
||||
|
||||
|
@ -1445,6 +1453,13 @@ class Listener implements UnescapeErrorListener {
|
|||
logEvent("Identifier");
|
||||
}
|
||||
|
||||
/// Handle an identifier token in a show or hide clause.
|
||||
///
|
||||
/// [context] indicates what kind of construct the identifier appears in.
|
||||
void handleShowHideIdentifier(Token? modifier, Token identifier) {
|
||||
logEvent("ShowHideIdentifier");
|
||||
}
|
||||
|
||||
void handleIndexedExpression(
|
||||
Token? question, Token openSquareBracket, Token closeSquareBracket) {
|
||||
logEvent("IndexedExpression");
|
||||
|
|
|
@ -2391,6 +2391,63 @@ class Parser {
|
|||
}
|
||||
TypeInfo typeInfo = computeType(onKeyword, /* required = */ true);
|
||||
token = typeInfo.ensureTypeOrVoid(onKeyword, this);
|
||||
|
||||
int handleShowHideElements() {
|
||||
int elementCount = 0;
|
||||
do {
|
||||
Token next = token.next!.next!;
|
||||
if (optional('get', next)) {
|
||||
token = IdentifierContext.extensionShowHideElementGetter
|
||||
.ensureIdentifier(next, this);
|
||||
listener.handleShowHideIdentifier(next, token);
|
||||
} else if (optional('operator', next)) {
|
||||
token = IdentifierContext.extensionShowHideElementOperator
|
||||
.ensureIdentifier(next, this);
|
||||
listener.handleShowHideIdentifier(next, token);
|
||||
} else if (optional('set', next)) {
|
||||
token = IdentifierContext.extensionShowHideElementSetter
|
||||
.ensureIdentifier(next, this);
|
||||
listener.handleShowHideIdentifier(next, token);
|
||||
} else {
|
||||
TypeInfo typeInfo = computeType(
|
||||
token.next!,
|
||||
/* required = */ true,
|
||||
/* inDeclaration = */ true,
|
||||
/* acceptKeywordForSimpleType = */ true);
|
||||
final bool isUnambiguouslyType =
|
||||
typeInfo.hasTypeArguments || typeInfo is PrefixedType;
|
||||
if (isUnambiguouslyType) {
|
||||
token = typeInfo.ensureTypeOrVoid(token.next!, this);
|
||||
} else {
|
||||
token = IdentifierContext.extensionShowHideElementMemberOrType
|
||||
.ensureIdentifier(token.next!, this);
|
||||
listener.handleShowHideIdentifier(null, token);
|
||||
}
|
||||
}
|
||||
++elementCount;
|
||||
} while (optional(',', token.next!));
|
||||
return elementCount;
|
||||
}
|
||||
|
||||
Token? showKeyword = token.next!;
|
||||
int showElementCount = 0;
|
||||
if (optional('show', showKeyword)) {
|
||||
showElementCount = handleShowHideElements();
|
||||
} else {
|
||||
showKeyword = null;
|
||||
}
|
||||
|
||||
Token? hideKeyword = token.next!;
|
||||
int hideElementCount = 0;
|
||||
if (optional('hide', hideKeyword)) {
|
||||
hideElementCount = handleShowHideElements();
|
||||
} else {
|
||||
hideKeyword = null;
|
||||
}
|
||||
|
||||
listener.handleExtensionShowHide(
|
||||
showKeyword, showElementCount, hideKeyword, hideElementCount);
|
||||
|
||||
if (!optional('{', token.next!)) {
|
||||
// Recovery
|
||||
Token next = token.next!;
|
||||
|
@ -2417,8 +2474,8 @@ class Parser {
|
|||
}
|
||||
token = parseClassOrMixinOrExtensionBody(
|
||||
token, DeclarationKind.Extension, name?.lexeme);
|
||||
listener.endExtensionDeclaration(
|
||||
extensionKeyword, typeKeyword, onKeyword, token);
|
||||
listener.endExtensionDeclaration(extensionKeyword, typeKeyword, onKeyword,
|
||||
showKeyword, hideKeyword, token);
|
||||
return token;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ enum NullValue {
|
|||
FunctionBody,
|
||||
FunctionBodyAsyncToken,
|
||||
FunctionBodyStarToken,
|
||||
HideClause,
|
||||
Identifier,
|
||||
IdentifierList,
|
||||
Initializers,
|
||||
|
@ -55,8 +56,10 @@ enum NullValue {
|
|||
Metadata,
|
||||
Modifiers,
|
||||
Name,
|
||||
OperatorList,
|
||||
ParameterDefaultValue,
|
||||
Prefix,
|
||||
ShowClause,
|
||||
StringLiteral,
|
||||
SwitchScope,
|
||||
Token,
|
||||
|
@ -345,6 +348,12 @@ abstract class StackListener extends Listener {
|
|||
debugEvent("ClassImplements");
|
||||
}
|
||||
|
||||
@override
|
||||
void handleExtensionShowHide(Token? showKeyword, int showElementCount,
|
||||
Token? hideKeyword, int hideElementCount) {
|
||||
debugEvent("ExtensionShow");
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoTypeArguments(Token token) {
|
||||
debugEvent("NoTypeArguments");
|
||||
|
|
|
@ -36,6 +36,9 @@ abstract class TypeInfo {
|
|||
/// void Function foo(int x);
|
||||
bool get isFunctionType;
|
||||
|
||||
/// Returns true if the type has type arguments.
|
||||
bool get hasTypeArguments;
|
||||
|
||||
/// Call this function when the token after [token] must be a type (not void).
|
||||
/// This function will call the appropriate event methods on the [Parser]'s
|
||||
/// listener to handle the type, inserting a synthetic type reference if
|
||||
|
|
|
@ -98,6 +98,9 @@ class NoType implements TypeInfo {
|
|||
@override
|
||||
bool get couldBeExpression => false;
|
||||
|
||||
@override
|
||||
bool get hasTypeArguments => false;
|
||||
|
||||
@override
|
||||
bool get isNullable => false;
|
||||
|
||||
|
@ -142,6 +145,9 @@ class PrefixedType implements TypeInfo {
|
|||
@override
|
||||
bool get couldBeExpression => true;
|
||||
|
||||
@override
|
||||
bool get hasTypeArguments => false;
|
||||
|
||||
@override
|
||||
bool get isNullable => false;
|
||||
|
||||
|
@ -228,6 +234,9 @@ class SimpleTypeWith1Argument implements TypeInfo {
|
|||
@override
|
||||
bool get couldBeExpression => false;
|
||||
|
||||
@override
|
||||
bool get hasTypeArguments => true;
|
||||
|
||||
@override
|
||||
bool get isNullable => false;
|
||||
|
||||
|
@ -305,6 +314,9 @@ class SimpleType implements TypeInfo {
|
|||
@override
|
||||
bool get couldBeExpression => true;
|
||||
|
||||
@override
|
||||
bool get hasTypeArguments => false;
|
||||
|
||||
@override
|
||||
bool get isNullable => false;
|
||||
|
||||
|
@ -353,6 +365,9 @@ class VoidType implements TypeInfo {
|
|||
@override
|
||||
bool get couldBeExpression => false;
|
||||
|
||||
@override
|
||||
bool get hasTypeArguments => false;
|
||||
|
||||
@override
|
||||
bool get isNullable => false;
|
||||
|
||||
|
@ -492,6 +507,9 @@ class ComplexTypeInfo implements TypeInfo {
|
|||
bool get couldBeExpression =>
|
||||
typeArguments == noTypeParamOrArg && typeVariableStarters.isEmpty;
|
||||
|
||||
@override
|
||||
bool get hasTypeArguments => typeArguments is! NoTypeParamOrArg;
|
||||
|
||||
@override
|
||||
bool get isNullable => beforeQuestionMark != null;
|
||||
|
||||
|
@ -828,11 +846,8 @@ class SimpleTypeArgument1 extends TypeParamOrArgInfo {
|
|||
listener.beginTypeVariable(token);
|
||||
listener.handleTypeVariablesDefined(token, /* count = */ 1);
|
||||
listener.handleNoType(token);
|
||||
listener.endTypeVariable(
|
||||
endGroup,
|
||||
/* index = */ 0,
|
||||
/* extendsOrSuper = */ null,
|
||||
/* variance = */ null);
|
||||
listener.endTypeVariable(endGroup, /* index = */ 0,
|
||||
/* extendsOrSuper = */ null, /* variance = */ null);
|
||||
listener.endTypeVariables(beginGroup, endGroup);
|
||||
return endGroup;
|
||||
}
|
||||
|
|
|
@ -469,6 +469,8 @@ abstract class AstVisitor<R> {
|
|||
|
||||
R? visitGenericTypeAlias(GenericTypeAlias node);
|
||||
|
||||
R? visitHideClause(HideClause node);
|
||||
|
||||
R? visitHideCombinator(HideCombinator node);
|
||||
|
||||
R? visitIfElement(IfElement node);
|
||||
|
@ -544,8 +546,12 @@ abstract class AstVisitor<R> {
|
|||
|
||||
R? visitSetOrMapLiteral(SetOrMapLiteral node);
|
||||
|
||||
R? visitShowClause(ShowClause node);
|
||||
|
||||
R? visitShowCombinator(ShowCombinator node);
|
||||
|
||||
R? visitShowHideElement(ShowHideElement node);
|
||||
|
||||
R? visitSimpleFormalParameter(SimpleFormalParameter node);
|
||||
|
||||
R? visitSimpleIdentifier(SimpleIdentifier node);
|
||||
|
@ -1683,7 +1689,8 @@ abstract class ExtendsClause implements AstNode {
|
|||
///
|
||||
/// extension ::=
|
||||
/// 'extension' [SimpleIdentifier]? [TypeParameterList]?
|
||||
/// 'on' [TypeAnnotation] '{' [ClassMember]* '}'
|
||||
/// 'on' [TypeAnnotation] [ShowClause]? [HideClause]?
|
||||
/// '{' [ClassMember]* '}'
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class ExtensionDeclaration implements CompilationUnitMember {
|
||||
|
@ -1696,6 +1703,10 @@ abstract class ExtensionDeclaration implements CompilationUnitMember {
|
|||
/// Return the token representing the 'extension' keyword.
|
||||
Token get extensionKeyword;
|
||||
|
||||
/// Return the hide clause, or `null` if the extension does not have a hide
|
||||
/// clause.
|
||||
HideClause? get hideClause;
|
||||
|
||||
/// Return the left curly bracket.
|
||||
Token get leftBracket;
|
||||
|
||||
|
@ -1712,6 +1723,10 @@ abstract class ExtensionDeclaration implements CompilationUnitMember {
|
|||
/// Return the right curly bracket.
|
||||
Token get rightBracket;
|
||||
|
||||
/// Return the show clause, or `null` if the extension does not have a show
|
||||
/// clause.
|
||||
ShowClause? get showClause;
|
||||
|
||||
/// Return the token representing the 'type' keyword.
|
||||
Token? get typeKeyword;
|
||||
|
||||
|
@ -2437,6 +2452,20 @@ abstract class GenericTypeAlias implements TypeAlias {
|
|||
TypeParameterList? get typeParameters;
|
||||
}
|
||||
|
||||
/// The "hide" clause in an extension declaration.
|
||||
///
|
||||
/// hideClause ::=
|
||||
/// 'hide' [TypeName] (',' [TypeName])*
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class HideClause implements AstNode {
|
||||
/// Return the list of the elements that are being shown.
|
||||
NodeList<ShowHideClauseElement> get elements;
|
||||
|
||||
/// Return the token representing the 'hide' keyword.
|
||||
Token get hideKeyword;
|
||||
}
|
||||
|
||||
/// A combinator that restricts the names being imported to those that are not
|
||||
/// in a given list.
|
||||
///
|
||||
|
@ -3667,6 +3696,20 @@ abstract class SetOrMapLiteral implements TypedLiteral {
|
|||
Token get rightBracket;
|
||||
}
|
||||
|
||||
/// The "show" clause in an extension declaration.
|
||||
///
|
||||
/// showClause ::=
|
||||
/// 'show' [TypeName] (',' [TypeName])*
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class ShowClause implements AstNode {
|
||||
/// Return the list of the elements that are being shown.
|
||||
NodeList<ShowHideClauseElement> get elements;
|
||||
|
||||
/// Return the token representing the 'show' keyword.
|
||||
Token get showKeyword;
|
||||
}
|
||||
|
||||
/// A combinator that restricts the names being imported to those in a given list.
|
||||
///
|
||||
/// showCombinator ::=
|
||||
|
@ -3679,6 +3722,29 @@ abstract class ShowCombinator implements Combinator {
|
|||
NodeList<SimpleIdentifier> get shownNames;
|
||||
}
|
||||
|
||||
/// A node that can appear in the show or hide clauses.
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class ShowHideClauseElement implements AstNode {}
|
||||
|
||||
/// A potentially non-type element of a show or a hide clause.
|
||||
///
|
||||
/// showHideElement ::=
|
||||
/// 'get' [SimpleIdentifier] |
|
||||
/// 'set' [SimpleIdentifier] |
|
||||
/// 'operator' [SimpleIdentifier] |
|
||||
/// [SimpleIdentifier]
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class ShowHideElement implements AstNode, ShowHideClauseElement {
|
||||
/// Return the 'get', 'set', or 'operator' modifier that appears before the
|
||||
/// name, or `null` if there is no modifier.
|
||||
Token? get modifier;
|
||||
|
||||
/// Return the name of the member the element refers to.
|
||||
SimpleIdentifier get name;
|
||||
}
|
||||
|
||||
/// A simple formal parameter.
|
||||
///
|
||||
/// simpleFormalParameter ::=
|
||||
|
@ -4182,7 +4248,7 @@ abstract class TypeLiteral implements Expression {
|
|||
/// [Identifier] typeArguments?
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class TypeName implements NamedType {}
|
||||
abstract class TypeName implements NamedType, ShowHideClauseElement {}
|
||||
|
||||
/// A type parameter.
|
||||
///
|
||||
|
|
|
@ -545,6 +545,11 @@ abstract class AstFactory {
|
|||
TypeAnnotation type,
|
||||
Token semicolon);
|
||||
|
||||
/// Returns a newly created hide clause.
|
||||
HideClause hideClause(
|
||||
{required Token hideKeyword,
|
||||
required List<ShowHideClauseElement> elements});
|
||||
|
||||
/// Returns a newly created import show combinator.
|
||||
HideCombinator hideCombinator(
|
||||
Token keyword, List<SimpleIdentifier> hiddenNames);
|
||||
|
@ -792,10 +797,19 @@ abstract class AstFactory {
|
|||
required List<CollectionElement> elements,
|
||||
required Token rightBracket});
|
||||
|
||||
/// Returns a newly created show clause.
|
||||
ShowClause showClause(
|
||||
{required Token showKeyword,
|
||||
required List<ShowHideClauseElement> elements});
|
||||
|
||||
/// Returns a newly created import show combinator.
|
||||
ShowCombinator showCombinator(
|
||||
Token keyword, List<SimpleIdentifier> shownNames);
|
||||
|
||||
/// Returns a newly created element of a show or hide clause.
|
||||
ShowHideElement showHideElement(
|
||||
{required Token? modifier, required SimpleIdentifier name});
|
||||
|
||||
/// Returns a newly created formal parameter. Either or both of the
|
||||
/// [comment] and [metadata] can be `null` if the parameter does not have the
|
||||
/// corresponding attribute. The [keyword] can be `null` if a type was
|
||||
|
|
|
@ -365,6 +365,9 @@ class GeneralizingAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitGenericTypeAlias(GenericTypeAlias node) => visitTypeAlias(node);
|
||||
|
||||
@override
|
||||
R? visitHideClause(HideClause node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitHideCombinator(HideCombinator node) => visitCombinator(node);
|
||||
|
||||
|
@ -509,9 +512,15 @@ class GeneralizingAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitSetOrMapLiteral(SetOrMapLiteral node) => visitTypedLiteral(node);
|
||||
|
||||
@override
|
||||
R? visitShowClause(ShowClause node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitShowCombinator(ShowCombinator node) => visitCombinator(node);
|
||||
|
||||
@override
|
||||
R? visitShowHideElement(ShowHideElement node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitSimpleFormalParameter(SimpleFormalParameter node) =>
|
||||
visitNormalFormalParameter(node);
|
||||
|
@ -990,6 +999,12 @@ class RecursiveAstVisitor<R> implements AstVisitor<R> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitHideClause(HideClause node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitHideCombinator(HideCombinator node) {
|
||||
node.visitChildren(this);
|
||||
|
@ -1213,12 +1228,24 @@ class RecursiveAstVisitor<R> implements AstVisitor<R> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitShowClause(ShowClause node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitShowCombinator(ShowCombinator node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitShowHideElement(ShowHideElement node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitSimpleFormalParameter(SimpleFormalParameter node) {
|
||||
node.visitChildren(this);
|
||||
|
@ -1569,6 +1596,9 @@ class SimpleAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitGenericTypeAlias(GenericTypeAlias node) => null;
|
||||
|
||||
@override
|
||||
R? visitHideClause(HideClause node) => null;
|
||||
|
||||
@override
|
||||
R? visitHideCombinator(HideCombinator node) => null;
|
||||
|
||||
|
@ -1682,9 +1712,15 @@ class SimpleAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitSetOrMapLiteral(SetOrMapLiteral node) => null;
|
||||
|
||||
@override
|
||||
R? visitShowClause(ShowClause node) => null;
|
||||
|
||||
@override
|
||||
R? visitShowCombinator(ShowCombinator node) => null;
|
||||
|
||||
@override
|
||||
R? visitShowHideElement(ShowHideElement node) => null;
|
||||
|
||||
@override
|
||||
R? visitSimpleFormalParameter(SimpleFormalParameter node) => null;
|
||||
|
||||
|
@ -1963,6 +1999,9 @@ class ThrowingAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitGenericTypeAlias(GenericTypeAlias node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitHideClause(HideClause node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitHideCombinator(HideCombinator node) => _throw(node);
|
||||
|
||||
|
@ -2077,9 +2116,15 @@ class ThrowingAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitSetOrMapLiteral(SetOrMapLiteral node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitShowClause(ShowClause node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitShowCombinator(ShowCombinator node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitShowHideElement(ShowHideElement node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitSimpleFormalParameter(SimpleFormalParameter node) => _throw(node);
|
||||
|
||||
|
@ -2661,6 +2706,14 @@ class TimedAstVisitor<T> implements AstVisitor<T> {
|
|||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitHideClause(HideClause node) {
|
||||
stopwatch.start();
|
||||
T? result = _baseVisitor.visitHideClause(node);
|
||||
stopwatch.stop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitHideCombinator(HideCombinator node) {
|
||||
stopwatch.start();
|
||||
|
@ -2958,6 +3011,14 @@ class TimedAstVisitor<T> implements AstVisitor<T> {
|
|||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitShowClause(ShowClause node) {
|
||||
stopwatch.start();
|
||||
T? result = _baseVisitor.visitShowClause(node);
|
||||
stopwatch.stop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitShowCombinator(ShowCombinator node) {
|
||||
stopwatch.start();
|
||||
|
@ -2966,6 +3027,14 @@ class TimedAstVisitor<T> implements AstVisitor<T> {
|
|||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitShowHideElement(ShowHideElement node) {
|
||||
stopwatch.start();
|
||||
T? result = _baseVisitor.visitShowHideElement(node);
|
||||
stopwatch.stop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitSimpleFormalParameter(SimpleFormalParameter node) {
|
||||
stopwatch.start();
|
||||
|
@ -3382,6 +3451,9 @@ class UnifyingAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitGenericTypeAlias(GenericTypeAlias node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitHideClause(HideClause node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitHideCombinator(HideCombinator node) => visitNode(node);
|
||||
|
||||
|
@ -3503,9 +3575,15 @@ class UnifyingAstVisitor<R> implements AstVisitor<R> {
|
|||
@override
|
||||
R? visitSetOrMapLiteral(SetOrMapLiteral node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitShowClause(ShowClause node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitShowCombinator(ShowCombinator node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitShowHideElement(ShowHideElement node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitSimpleFormalParameter(SimpleFormalParameter node) => visitNode(node);
|
||||
|
||||
|
|
|
@ -3679,10 +3679,18 @@ class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
|||
@override
|
||||
Token? typeKeyword;
|
||||
|
||||
/// The hide clause for the extension or `null` if the declaration does not
|
||||
/// hide any elements.
|
||||
HideClauseImpl? _hideClause;
|
||||
|
||||
/// The name of the extension, or `null` if the extension does not have a
|
||||
/// name.
|
||||
SimpleIdentifierImpl? _name;
|
||||
|
||||
/// The show clause for the extension or `null` if the declaration does not
|
||||
/// show any elements.
|
||||
ShowClauseImpl? _showClause;
|
||||
|
||||
/// The type parameters for the extension, or `null` if the extension does not
|
||||
/// have any type parameters.
|
||||
TypeParameterListImpl? _typeParameters;
|
||||
|
@ -3713,6 +3721,8 @@ class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
|||
this._typeParameters,
|
||||
this.onKeyword,
|
||||
this._extendedType,
|
||||
this._showClause,
|
||||
this._hideClause,
|
||||
this.leftBracket,
|
||||
List<ClassMember> members,
|
||||
this.rightBracket)
|
||||
|
@ -3755,6 +3765,13 @@ class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
|||
@override
|
||||
Token get firstTokenAfterCommentAndMetadata => extensionKeyword;
|
||||
|
||||
@override
|
||||
HideClauseImpl? get hideClause => _hideClause;
|
||||
|
||||
set hideClause(HideClause? hideClause) {
|
||||
_hideClause = _becomeParentOf(hideClause as HideClauseImpl?);
|
||||
}
|
||||
|
||||
@override
|
||||
NodeListImpl<ClassMember> get members => _members;
|
||||
|
||||
|
@ -3765,6 +3782,13 @@ class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
|||
_name = _becomeParentOf(identifier as SimpleIdentifierImpl?);
|
||||
}
|
||||
|
||||
@override
|
||||
ShowClauseImpl? get showClause => _showClause;
|
||||
|
||||
set showClause(ShowClause? showClause) {
|
||||
_showClause = _becomeParentOf(showClause as ShowClauseImpl?);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeParameterListImpl? get typeParameters => _typeParameters;
|
||||
|
||||
|
@ -5457,6 +5481,46 @@ class GenericTypeAliasImpl extends TypeAliasImpl implements GenericTypeAlias {
|
|||
}
|
||||
}
|
||||
|
||||
/// The "hide" clause in an extension declaration.
|
||||
///
|
||||
/// hideClause ::=
|
||||
/// 'hide' [TypeName] (',' [TypeName])*
|
||||
class HideClauseImpl extends AstNodeImpl implements HideClause {
|
||||
/// The token representing the 'hide' keyword.
|
||||
@override
|
||||
Token hideKeyword;
|
||||
|
||||
/// The elements that are being shown.
|
||||
final NodeListImpl<ShowHideClauseElement> _elements = NodeListImpl._();
|
||||
|
||||
/// Initialize a newly created show clause.
|
||||
HideClauseImpl(this.hideKeyword, List<ShowHideClauseElement> elements) {
|
||||
_elements._initialize(this, elements);
|
||||
}
|
||||
|
||||
@override
|
||||
Token get beginToken => hideKeyword;
|
||||
|
||||
@override
|
||||
Iterable<SyntacticEntity> get childEntities => ChildEntities()
|
||||
..add(hideKeyword)
|
||||
..addAll(elements);
|
||||
|
||||
@override
|
||||
NodeListImpl<ShowHideClauseElement> get elements => _elements;
|
||||
|
||||
@override
|
||||
Token get endToken => _elements.endToken!;
|
||||
|
||||
@override
|
||||
E? accept<E>(AstVisitor<E> visitor) => visitor.visitHideClause(this);
|
||||
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
_elements.accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
/// A combinator that restricts the names being imported to those that are not
|
||||
/// in a given list.
|
||||
///
|
||||
|
@ -8620,6 +8684,46 @@ class SetOrMapLiteralImpl extends TypedLiteralImpl implements SetOrMapLiteral {
|
|||
}
|
||||
}
|
||||
|
||||
/// The "show" clause in an extension declaration.
|
||||
///
|
||||
/// showClause ::=
|
||||
/// 'show' [TypeName] (',' [TypeName])*
|
||||
class ShowClauseImpl extends AstNodeImpl implements ShowClause {
|
||||
/// The token representing the 'show' keyword.
|
||||
@override
|
||||
Token showKeyword;
|
||||
|
||||
/// The elements that are being shown.
|
||||
final NodeListImpl<ShowHideClauseElement> _elements = NodeListImpl._();
|
||||
|
||||
/// Initialize a newly created show clause.
|
||||
ShowClauseImpl(this.showKeyword, List<ShowHideClauseElement> elements) {
|
||||
_elements._initialize(this, elements);
|
||||
}
|
||||
|
||||
@override
|
||||
Token get beginToken => showKeyword;
|
||||
|
||||
@override
|
||||
Iterable<SyntacticEntity> get childEntities => ChildEntities()
|
||||
..add(showKeyword)
|
||||
..addAll(elements);
|
||||
|
||||
@override
|
||||
NodeListImpl<ShowHideClauseElement> get elements => _elements;
|
||||
|
||||
@override
|
||||
Token get endToken => _elements.endToken!;
|
||||
|
||||
@override
|
||||
E? accept<E>(AstVisitor<E> visitor) => visitor.visitShowClause(this);
|
||||
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
_elements.accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
/// A combinator that restricts the names being imported to those in a given
|
||||
/// list.
|
||||
///
|
||||
|
@ -8657,6 +8761,45 @@ class ShowCombinatorImpl extends CombinatorImpl implements ShowCombinator {
|
|||
}
|
||||
}
|
||||
|
||||
/// A potentially non-type element of a show or a hide clause.
|
||||
///
|
||||
/// showHideElement ::=
|
||||
/// 'get' [SimpleIdentifier] |
|
||||
/// 'set' [SimpleIdentifier] |
|
||||
/// 'operator' [SimpleIdentifier] |
|
||||
/// [SimpleIdentifier]
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
class ShowHideElementImpl extends AstNodeImpl implements ShowHideElement {
|
||||
@override
|
||||
Token? modifier;
|
||||
|
||||
@override
|
||||
SimpleIdentifier name;
|
||||
|
||||
ShowHideElementImpl(this.modifier, this.name) {
|
||||
_becomeParentOf<SimpleIdentifierImpl>(name as SimpleIdentifierImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
Token get beginToken => modifier ?? name.beginToken;
|
||||
|
||||
@override
|
||||
Iterable<SyntacticEntity> get childEntities =>
|
||||
ChildEntities()..addAll([if (modifier != null) modifier!, name]);
|
||||
|
||||
@override
|
||||
Token get endToken => name.endToken;
|
||||
|
||||
@override
|
||||
E? accept<E>(AstVisitor<E> visitor) => visitor.visitShowHideElement(this);
|
||||
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
name.accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
/// A simple formal parameter.
|
||||
///
|
||||
/// simpleFormalParameter ::=
|
||||
|
|
|
@ -446,6 +446,8 @@ class AstFactoryImpl extends AstFactory {
|
|||
TypeParameterList? typeParameters,
|
||||
required Token onKeyword,
|
||||
required TypeAnnotation extendedType,
|
||||
ShowClause? showClause,
|
||||
HideClause? hideClause,
|
||||
required Token leftBracket,
|
||||
required List<ClassMember> members,
|
||||
required Token rightBracket}) =>
|
||||
|
@ -458,6 +460,8 @@ class AstFactoryImpl extends AstFactory {
|
|||
typeParameters as TypeParameterListImpl?,
|
||||
onKeyword,
|
||||
extendedType as TypeAnnotationImpl,
|
||||
showClause as ShowClauseImpl?,
|
||||
hideClause as HideClauseImpl?,
|
||||
leftBracket,
|
||||
members,
|
||||
rightBracket);
|
||||
|
@ -729,6 +733,12 @@ class AstFactoryImpl extends AstFactory {
|
|||
type as TypeAnnotationImpl,
|
||||
semicolon);
|
||||
|
||||
@override
|
||||
HideClauseImpl hideClause(
|
||||
{required Token hideKeyword,
|
||||
required List<ShowHideClauseElement> elements}) =>
|
||||
HideClauseImpl(hideKeyword, elements);
|
||||
|
||||
@override
|
||||
HideCombinatorImpl hideCombinator(
|
||||
Token keyword, List<SimpleIdentifier> hiddenNames) =>
|
||||
|
@ -1076,11 +1086,22 @@ class AstFactoryImpl extends AstFactory {
|
|||
SetOrMapLiteralImpl(constKeyword, typeArguments as TypeArgumentListImpl?,
|
||||
leftBracket, elements, rightBracket);
|
||||
|
||||
@override
|
||||
ShowClauseImpl showClause(
|
||||
{required Token showKeyword,
|
||||
required List<ShowHideClauseElement> elements}) =>
|
||||
ShowClauseImpl(showKeyword, elements);
|
||||
|
||||
@override
|
||||
ShowCombinatorImpl showCombinator(
|
||||
Token keyword, List<SimpleIdentifier> shownNames) =>
|
||||
ShowCombinatorImpl(keyword, shownNames);
|
||||
|
||||
@override
|
||||
ShowHideElementImpl showHideElement(
|
||||
{required Token? modifier, required SimpleIdentifier name}) =>
|
||||
ShowHideElementImpl(modifier, name);
|
||||
|
||||
@override
|
||||
SimpleFormalParameterImpl simpleFormalParameter2(
|
||||
{Comment? comment,
|
||||
|
|
|
@ -368,6 +368,8 @@ class ToSourceVisitor implements AstVisitor<void> {
|
|||
_visitToken(node.onKeyword);
|
||||
sink.write(' ');
|
||||
_visitNode(node.extendedType, suffix: ' ');
|
||||
_visitNode(node.showClause, suffix: ' ');
|
||||
_visitNode(node.hideClause, suffix: ' ');
|
||||
_visitToken(node.leftBracket);
|
||||
_visitNodeList(node.members, separator: ' ');
|
||||
_visitToken(node.rightBracket);
|
||||
|
@ -564,6 +566,12 @@ class ToSourceVisitor implements AstVisitor<void> {
|
|||
_visitNode(node.type);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitHideClause(HideClause node) {
|
||||
sink.write('hide ');
|
||||
_visitNodeList(node.elements, separator: ', ');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitHideCombinator(HideCombinator node) {
|
||||
sink.write('hide ');
|
||||
|
@ -869,12 +877,24 @@ class ToSourceVisitor implements AstVisitor<void> {
|
|||
sink.write('}');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitShowClause(ShowClause node) {
|
||||
sink.write('show ');
|
||||
_visitNodeList(node.elements, separator: ', ');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitShowCombinator(ShowCombinator node) {
|
||||
sink.write('show ');
|
||||
_visitNodeList(node.shownNames, separator: ', ');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitShowHideElement(ShowHideElement node) {
|
||||
_visitToken(node.modifier, suffix: ' ');
|
||||
_visitNode(node.name);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitSimpleFormalParameter(SimpleFormalParameter node) {
|
||||
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
|
||||
|
|
|
@ -676,6 +676,13 @@ class AstComparator implements AstVisitor<bool> {
|
|||
isEqualNodes(node.type, other.type);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitHideClause(HideClause node) {
|
||||
HideClause other = _other as HideClause;
|
||||
return isEqualTokens(node.hideKeyword, other.hideKeyword) &&
|
||||
_isEqualNodeLists(node.elements, other.elements);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitHideCombinator(HideCombinator node) {
|
||||
HideCombinator other = _other as HideCombinator;
|
||||
|
@ -1006,6 +1013,13 @@ class AstComparator implements AstVisitor<bool> {
|
|||
isEqualTokens(node.rightBracket, other.rightBracket);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitShowClause(ShowClause node) {
|
||||
ShowClause other = _other as ShowClause;
|
||||
return isEqualTokens(node.showKeyword, other.showKeyword) &&
|
||||
_isEqualNodeLists(node.elements, other.elements);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitShowCombinator(ShowCombinator node) {
|
||||
ShowCombinator other = _other as ShowCombinator;
|
||||
|
@ -1013,6 +1027,13 @@ class AstComparator implements AstVisitor<bool> {
|
|||
_isEqualNodeLists(node.shownNames, other.shownNames);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitShowHideElement(ShowHideElement node) {
|
||||
ShowHideElement other = _other as ShowHideElement;
|
||||
return isEqualTokens(node.modifier, other.modifier) &&
|
||||
isEqualNodes(node.name, other.name);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitSimpleFormalParameter(SimpleFormalParameter node) {
|
||||
SimpleFormalParameter other = _other as SimpleFormalParameter;
|
||||
|
@ -2256,6 +2277,14 @@ class NodeReplacer implements AstVisitor<bool> {
|
|||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitHideClause(covariant HideClauseImpl node) {
|
||||
if (_replaceInList(node.elements)) {
|
||||
return true;
|
||||
}
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitHideCombinator(covariant HideCombinatorImpl node) {
|
||||
if (_replaceInList(node.hiddenNames)) {
|
||||
|
@ -2645,6 +2674,14 @@ class NodeReplacer implements AstVisitor<bool> {
|
|||
return visitTypedLiteral(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitShowClause(covariant ShowClauseImpl node) {
|
||||
if (_replaceInList(node.elements)) {
|
||||
return true;
|
||||
}
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitShowCombinator(covariant ShowCombinatorImpl node) {
|
||||
if (_replaceInList(node.shownNames)) {
|
||||
|
@ -2653,6 +2690,15 @@ class NodeReplacer implements AstVisitor<bool> {
|
|||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitShowHideElement(covariant ShowHideElementImpl node) {
|
||||
if (identical(node.name, _oldNode)) {
|
||||
node.name = _newNode as SimpleIdentifier;
|
||||
return true;
|
||||
}
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitSimpleFormalParameter(covariant SimpleFormalParameterImpl node) {
|
||||
if (identical(node.type, _oldNode)) {
|
||||
|
|
|
@ -258,6 +258,8 @@ class AstBuilder extends StackListener {
|
|||
_tmpSimpleIdentifier(),
|
||||
null,
|
||||
), // extendedType is set in [endExtensionDeclaration]
|
||||
showClause: null,
|
||||
hideClause: null,
|
||||
leftBracket: Tokens.openCurlyBracket(),
|
||||
rightBracket: Tokens.closeCurlyBracket(),
|
||||
members: [],
|
||||
|
@ -1192,7 +1194,7 @@ class AstBuilder extends StackListener {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token token) {
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token token) {
|
||||
if (typeKeyword != null && !enableExtensionTypes) {
|
||||
var feature = ExperimentalFeatures.extension_types;
|
||||
handleRecoverableError(
|
||||
|
@ -1203,11 +1205,29 @@ class AstBuilder extends StackListener {
|
|||
typeKeyword,
|
||||
typeKeyword);
|
||||
}
|
||||
|
||||
if ((showKeyword != null || hideKeyword != null) && !enableExtensionTypes) {
|
||||
var feature = ExperimentalFeatures.extension_types;
|
||||
handleRecoverableError(
|
||||
templateExperimentNotEnabled.withArguments(
|
||||
feature.enableString,
|
||||
_versionAsString(ExperimentStatus.currentVersion),
|
||||
),
|
||||
(showKeyword ?? hideKeyword)!,
|
||||
(showKeyword ?? hideKeyword)!);
|
||||
}
|
||||
|
||||
ShowClause? showClause = pop(NullValue.ShowClause) as ShowClause?;
|
||||
HideClause? hideClause = pop(NullValue.HideClause) as HideClause?;
|
||||
|
||||
var type = pop() as TypeAnnotation;
|
||||
|
||||
extensionDeclaration!
|
||||
..extendedType = type
|
||||
..onKeyword = onKeyword
|
||||
..typeKeyword = typeKeyword;
|
||||
..typeKeyword = typeKeyword
|
||||
..showClause = showClause
|
||||
..hideClause = hideClause;
|
||||
extensionDeclaration = null;
|
||||
}
|
||||
|
||||
|
@ -2705,6 +2725,29 @@ class AstBuilder extends StackListener {
|
|||
push(ast.expressionStatement(expression, semicolon));
|
||||
}
|
||||
|
||||
@override
|
||||
void handleExtensionShowHide(Token? showKeyword, int showElementCount,
|
||||
Token? hideKeyword, int hideElementCount) {
|
||||
assert(optionalOrNull('hide', hideKeyword));
|
||||
assert(optionalOrNull('show', showKeyword));
|
||||
debugEvent("ExtensionShowHide");
|
||||
|
||||
HideClause? hideClause;
|
||||
if (hideKeyword != null) {
|
||||
var elements = popTypedList2<ShowHideClauseElement>(hideElementCount);
|
||||
hideClause = ast.hideClause(hideKeyword: hideKeyword, elements: elements);
|
||||
}
|
||||
|
||||
ShowClause? showClause;
|
||||
if (showKeyword != null) {
|
||||
var elements = popTypedList2<ShowHideClauseElement>(showElementCount);
|
||||
showClause = ast.showClause(showKeyword: showKeyword, elements: elements);
|
||||
}
|
||||
|
||||
push(hideClause ?? NullValue.HideClause);
|
||||
push(showClause ?? NullValue.ShowClause);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleFinallyBlock(Token finallyKeyword) {
|
||||
debugEvent("FinallyBlock");
|
||||
|
@ -3478,6 +3521,22 @@ class AstBuilder extends StackListener {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void handleShowHideIdentifier(Token? modifier, Token identifier) {
|
||||
debugEvent("handleShowHideIdentifier");
|
||||
|
||||
assert(modifier == null ||
|
||||
modifier.stringValue! == "get" ||
|
||||
modifier.stringValue! == "set" ||
|
||||
modifier.stringValue! == "operator");
|
||||
|
||||
SimpleIdentifier name = ast.simpleIdentifier(identifier);
|
||||
ShowHideElement element =
|
||||
ast.showHideElement(modifier: modifier, name: name);
|
||||
|
||||
push(element);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleSpreadExpression(Token spreadToken) {
|
||||
var expression = pop() as Expression;
|
||||
|
|
|
@ -519,6 +519,8 @@ class AstTestFactory {
|
|||
required bool isExtensionTypeDeclaration,
|
||||
TypeParameterList? typeParameters,
|
||||
required TypeAnnotation extendedType,
|
||||
ShowClause? showClause,
|
||||
HideClause? hideClause,
|
||||
List<ClassMember> members = const []}) =>
|
||||
astFactory.extensionDeclaration(
|
||||
comment: null,
|
||||
|
@ -531,6 +533,8 @@ class AstTestFactory {
|
|||
typeParameters: typeParameters,
|
||||
onKeyword: TokenFactory.tokenFromKeyword(Keyword.ON),
|
||||
extendedType: extendedType,
|
||||
showClause: showClause,
|
||||
hideClause: hideClause,
|
||||
leftBracket: TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
|
||||
members: members,
|
||||
rightBracket:
|
||||
|
@ -720,6 +724,11 @@ class AstTestFactory {
|
|||
functionType,
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static HideClauseImpl hideClause(List<ShowHideClauseElement> elements) =>
|
||||
astFactory.hideClause(
|
||||
hideKeyword: TokenFactory.tokenFromString("hide"),
|
||||
elements: elements);
|
||||
|
||||
static HideCombinatorImpl hideCombinator(
|
||||
List<SimpleIdentifier> identifiers) =>
|
||||
astFactory.hideCombinator(
|
||||
|
@ -1205,6 +1214,11 @@ class AstTestFactory {
|
|||
rightBracket: TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET),
|
||||
);
|
||||
|
||||
static ShowClauseImpl showClause(List<ShowHideClauseElement> elements) =>
|
||||
astFactory.showClause(
|
||||
showKeyword: TokenFactory.tokenFromString("show"),
|
||||
elements: elements);
|
||||
|
||||
static ShowCombinatorImpl showCombinator(
|
||||
List<SimpleIdentifier> identifiers) =>
|
||||
astFactory.showCombinator(
|
||||
|
@ -1214,6 +1228,24 @@ class AstTestFactory {
|
|||
astFactory.showCombinator(
|
||||
TokenFactory.tokenFromString("show"), identifierList(identifiers));
|
||||
|
||||
static ShowHideElementImpl showHideElement(String name) =>
|
||||
astFactory.showHideElement(modifier: null, name: identifier3(name));
|
||||
|
||||
static ShowHideElementImpl showHideElementGetter(String name) =>
|
||||
astFactory.showHideElement(
|
||||
modifier: TokenFactory.tokenFromString("get"),
|
||||
name: identifier3(name));
|
||||
|
||||
static ShowHideElementImpl showHideElementOperator(String name) =>
|
||||
astFactory.showHideElement(
|
||||
modifier: TokenFactory.tokenFromString("operator"),
|
||||
name: identifier3(name));
|
||||
|
||||
static ShowHideElementImpl showHideElementSetter(String name) =>
|
||||
astFactory.showHideElement(
|
||||
modifier: TokenFactory.tokenFromString("set"),
|
||||
name: identifier3(name));
|
||||
|
||||
static SimpleFormalParameterImpl simpleFormalParameter(
|
||||
Keyword keyword, String parameterName) =>
|
||||
simpleFormalParameter2(keyword, null, parameterName);
|
||||
|
|
|
@ -342,6 +342,8 @@ class AstTextPrinter extends ThrowingAstVisitor<void> {
|
|||
node.typeParameters?.accept(this);
|
||||
_token(node.onKeyword);
|
||||
node.extendedType.accept(this);
|
||||
node.showClause?.accept(this);
|
||||
node.hideClause?.accept(this);
|
||||
_token(node.leftBracket);
|
||||
node.members.accept(this);
|
||||
_token(node.rightBracket);
|
||||
|
|
|
@ -750,9 +750,9 @@ class ForwardingTestListener extends ForwardingListener {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token token) {
|
||||
super.endExtensionDeclaration(
|
||||
extensionKeyword, typeKeyword, onKeyword, token);
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token token) {
|
||||
super.endExtensionDeclaration(extensionKeyword, typeKeyword, onKeyword,
|
||||
showKeyword, hideKeyword, token);
|
||||
end('ExtensionDeclaration');
|
||||
}
|
||||
|
||||
|
|
|
@ -895,6 +895,201 @@ export 'foo.dart'
|
|||
isExtensionTypeDeclaration: false));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationHideClause_empty() {
|
||||
_assertSource(
|
||||
'extension type E on C hide B {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
hideClause:
|
||||
AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationHideClause_multipleMember() {
|
||||
_assertSource(
|
||||
'extension type E on C hide B {var a; var b;}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
members: [
|
||||
AstTestFactory.fieldDeclaration2(false, Keyword.VAR,
|
||||
[AstTestFactory.variableDeclaration('a')]),
|
||||
AstTestFactory.fieldDeclaration2(
|
||||
false, Keyword.VAR, [AstTestFactory.variableDeclaration('b')])
|
||||
],
|
||||
hideClause:
|
||||
AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationHideClause_parameters() {
|
||||
_assertSource(
|
||||
'extension type E<T> on C hide B {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
typeParameters: AstTestFactory.typeParameterList(['T']),
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
hideClause:
|
||||
AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationHideClause_singleMember() {
|
||||
_assertSource(
|
||||
'extension type E on C hide B {var a;}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
members: [
|
||||
AstTestFactory.fieldDeclaration2(
|
||||
false, Keyword.VAR, [AstTestFactory.variableDeclaration('a')])
|
||||
],
|
||||
hideClause:
|
||||
AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_ambiguousElement() {
|
||||
_assertSource(
|
||||
'extension type E on C show foo {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause: AstTestFactory.showClause(
|
||||
[AstTestFactory.showHideElement("foo")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_empty() {
|
||||
_assertSource(
|
||||
'extension type E on C show B {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause:
|
||||
AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_getterElement() {
|
||||
_assertSource(
|
||||
'extension type E on C show get foo {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause: AstTestFactory.showClause(
|
||||
[AstTestFactory.showHideElementGetter("foo")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_multipleMember() {
|
||||
_assertSource(
|
||||
'extension type E on C show B {var a; var b;}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
members: [
|
||||
AstTestFactory.fieldDeclaration2(false, Keyword.VAR,
|
||||
[AstTestFactory.variableDeclaration('a')]),
|
||||
AstTestFactory.fieldDeclaration2(
|
||||
false, Keyword.VAR, [AstTestFactory.variableDeclaration('b')])
|
||||
],
|
||||
showClause:
|
||||
AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_operatorElement() {
|
||||
_assertSource(
|
||||
'extension type E on C show operator * {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause: AstTestFactory.showClause(
|
||||
[AstTestFactory.showHideElementOperator("*")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_parameters() {
|
||||
_assertSource(
|
||||
'extension type E<T> on C show B {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
typeParameters: AstTestFactory.typeParameterList(['T']),
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause:
|
||||
AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_qualifiedTypeElement() {
|
||||
_assertSource(
|
||||
'extension type E on C show prefix.B {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause: AstTestFactory.showClause([
|
||||
AstTestFactory.typeName3(
|
||||
AstTestFactory.identifier5('prefix', 'B'))
|
||||
]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_setterElement() {
|
||||
_assertSource(
|
||||
'extension type E on C show set foo {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause: AstTestFactory.showClause(
|
||||
[AstTestFactory.showHideElementSetter("foo")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_singleMember() {
|
||||
_assertSource(
|
||||
'extension type E on C show B {var a;}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
members: [
|
||||
AstTestFactory.fieldDeclaration2(
|
||||
false, Keyword.VAR, [AstTestFactory.variableDeclaration('a')])
|
||||
],
|
||||
showClause:
|
||||
AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowClause_typeWithArgumentsElement() {
|
||||
_assertSource(
|
||||
'extension type E on C show B<int, String> {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause: AstTestFactory.showClause([
|
||||
AstTestFactory.typeName3(AstTestFactory.identifier3('B'), [
|
||||
AstTestFactory.typeName4('int'),
|
||||
AstTestFactory.typeName4('String')
|
||||
])
|
||||
]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionDeclarationShowHideClause_empty() {
|
||||
_assertSource(
|
||||
'extension type E on C show B hide foo {}',
|
||||
AstTestFactory.extensionDeclaration(
|
||||
name: 'E',
|
||||
extendedType: AstTestFactory.typeName4('C'),
|
||||
showClause:
|
||||
AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
|
||||
hideClause: AstTestFactory.hideClause(
|
||||
[AstTestFactory.showHideElement("foo")]),
|
||||
isExtensionTypeDeclaration: true));
|
||||
}
|
||||
|
||||
void test_visitExtensionOverride_prefixedName_noTypeArgs() {
|
||||
_assertSource(
|
||||
'p.E(o)',
|
||||
|
|
|
@ -861,6 +861,12 @@ class DietListener extends StackListenerImpl {
|
|||
// Do nothing
|
||||
}
|
||||
|
||||
@override
|
||||
void handleShowHideIdentifier(Token? modifier, Token? identifier) {
|
||||
debugEvent("");
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@override
|
||||
void beginClassOrMixinBody(DeclarationKind kind, Token token) {
|
||||
assert(checkState(token, [
|
||||
|
@ -928,7 +934,7 @@ class DietListener extends StackListenerImpl {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token endToken) {
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
|
||||
debugEvent("endExtensionDeclaration");
|
||||
checkEmpty(extensionKeyword.charOffset);
|
||||
}
|
||||
|
|
|
@ -327,6 +327,30 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
push(token.charOffset);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleShowHideIdentifier(Token? modifier, Token identifier) {
|
||||
debugEvent("ShowHideIdentifier");
|
||||
|
||||
assert(modifier == null ||
|
||||
modifier.stringValue! == "get" ||
|
||||
modifier.stringValue! == "set" ||
|
||||
modifier.stringValue! == "operator");
|
||||
|
||||
if (modifier == null) {
|
||||
handleIdentifier(
|
||||
identifier, IdentifierContext.extensionShowHideElementMemberOrType);
|
||||
} else if (modifier.stringValue! == "get") {
|
||||
handleIdentifier(
|
||||
identifier, IdentifierContext.extensionShowHideElementGetter);
|
||||
} else if (modifier.stringValue! == "set") {
|
||||
handleIdentifier(
|
||||
identifier, IdentifierContext.extensionShowHideElementSetter);
|
||||
} else if (modifier.stringValue! == "operator") {
|
||||
handleIdentifier(
|
||||
identifier, IdentifierContext.extensionShowHideElementOperator);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void handleIdentifier(Token token, IdentifierContext context) {
|
||||
if (context == IdentifierContext.enumValueDeclaration) {
|
||||
|
@ -337,6 +361,16 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
} else {
|
||||
push(new EnumConstantInfo(metadata, token.lexeme, token.charOffset));
|
||||
}
|
||||
} else if (context == IdentifierContext.extensionShowHideElementGetter ||
|
||||
context == IdentifierContext.extensionShowHideElementMemberOrType ||
|
||||
context == IdentifierContext.extensionShowHideElementSetter) {
|
||||
push(context);
|
||||
super.handleIdentifier(token, context);
|
||||
push(token.charOffset);
|
||||
} else if (context == IdentifierContext.extensionShowHideElementOperator) {
|
||||
push(context);
|
||||
push(operatorFromString(token.stringValue!));
|
||||
push(token.charOffset);
|
||||
} else {
|
||||
super.handleIdentifier(token, context);
|
||||
push(token.charOffset);
|
||||
|
@ -492,9 +526,22 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
void beginClassOrMixinBody(DeclarationKind kind, Token token) {
|
||||
if (kind == DeclarationKind.Extension) {
|
||||
assert(checkState(token, [
|
||||
/* hide type elements = */ ValueKinds.TypeBuilderListOrNull,
|
||||
/* hide get elements = */ ValueKinds.NameListOrNull,
|
||||
/* hide member or type elements = */ ValueKinds.NameListOrNull,
|
||||
/* hide set elements = */ ValueKinds.NameListOrNull,
|
||||
/* hide operator elements = */ ValueKinds.OperatorListOrNull,
|
||||
/* show type elements = */ ValueKinds.TypeBuilderListOrNull,
|
||||
/* show get elements = */ ValueKinds.NameListOrNull,
|
||||
/* show member or type elements = */ ValueKinds.NameListOrNull,
|
||||
/* show set elements */ ValueKinds.NameListOrNull,
|
||||
/* show operator elements*/ ValueKinds.OperatorListOrNull,
|
||||
unionOfKinds([ValueKinds.ParserRecovery, ValueKinds.TypeBuilder])
|
||||
]));
|
||||
Object? extensionThisType = peek();
|
||||
|
||||
// We peek into 10th frame on the stack for the extension 'this' type.
|
||||
Object? extensionThisType = stack[10];
|
||||
|
||||
if (extensionThisType is TypeBuilder) {
|
||||
libraryBuilder.currentTypeParameterScopeBuilder
|
||||
.registerExtensionThisType(extensionThisType);
|
||||
|
@ -532,6 +579,75 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
NullValue.TypeBuilderList);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleExtensionShowHide(Token? showKeyword, int showElementCount,
|
||||
Token? hideKeyword, int hideElementCount) {
|
||||
debugEvent("ExtensionShow");
|
||||
|
||||
List<dynamic> toBePushed = <dynamic>[];
|
||||
void handleShowHideElements(int elementCount) {
|
||||
if (elementCount == 0) {
|
||||
toBePushed.add(NullValue.TypeBuilderList);
|
||||
toBePushed.add(NullValue.IdentifierList);
|
||||
toBePushed.add(NullValue.IdentifierList);
|
||||
toBePushed.add(NullValue.IdentifierList);
|
||||
toBePushed.add(NullValue.OperatorList);
|
||||
} else {
|
||||
List<TypeBuilder> typeElements = <TypeBuilder>[];
|
||||
List<String> getElements = <String>[];
|
||||
List<String> ambiguousMemberOrTypeElements = <String>[];
|
||||
List<String> setElements = <String>[];
|
||||
List<Operator> operatorElements = <Operator>[];
|
||||
|
||||
for (int i = 0; i < elementCount; ++i) {
|
||||
Object leadingElementPart = pop()!;
|
||||
if (leadingElementPart is TypeBuilder) {
|
||||
typeElements.add(leadingElementPart);
|
||||
} else {
|
||||
leadingElementPart as int; // Offset.
|
||||
Object name = pop()!;
|
||||
IdentifierContext context = pop() as IdentifierContext;
|
||||
|
||||
if (name is! ParserRecovery) {
|
||||
assert(context ==
|
||||
IdentifierContext.extensionShowHideElementGetter ||
|
||||
context ==
|
||||
IdentifierContext.extensionShowHideElementMemberOrType ||
|
||||
context ==
|
||||
IdentifierContext.extensionShowHideElementOperator ||
|
||||
context == IdentifierContext.extensionShowHideElementSetter);
|
||||
|
||||
if (context == IdentifierContext.extensionShowHideElementGetter) {
|
||||
getElements.add(name as String);
|
||||
} else if (context ==
|
||||
IdentifierContext.extensionShowHideElementMemberOrType) {
|
||||
ambiguousMemberOrTypeElements.add(name as String);
|
||||
} else if (context ==
|
||||
IdentifierContext.extensionShowHideElementOperator) {
|
||||
operatorElements.add(name as Operator);
|
||||
} else if (context ==
|
||||
IdentifierContext.extensionShowHideElementSetter) {
|
||||
setElements.add(name as String);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toBePushed.add(typeElements);
|
||||
toBePushed.add(getElements);
|
||||
toBePushed.add(ambiguousMemberOrTypeElements);
|
||||
toBePushed.add(setElements);
|
||||
toBePushed.add(operatorElements);
|
||||
}
|
||||
}
|
||||
|
||||
handleShowHideElements(hideElementCount);
|
||||
handleShowHideElements(showElementCount);
|
||||
for (int i = toBePushed.length - 1; i >= 0; --i) {
|
||||
push(toBePushed[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void handleRecoverClassHeader() {
|
||||
debugEvent("handleRecoverClassHeader");
|
||||
|
@ -774,8 +890,18 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token endToken) {
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
|
||||
assert(checkState(extensionKeyword, [
|
||||
/* hide type elements = */ ValueKinds.TypeBuilderListOrNull,
|
||||
/* hide get elements = */ ValueKinds.NameListOrNull,
|
||||
/* hide member or type elements = */ ValueKinds.NameListOrNull,
|
||||
/* hide set elements = */ ValueKinds.NameListOrNull,
|
||||
/* hide operator elements = */ ValueKinds.OperatorListOrNull,
|
||||
/* show type elements = */ ValueKinds.TypeBuilderListOrNull,
|
||||
/* show get elements = */ ValueKinds.NameListOrNull,
|
||||
/* show member or type elements = */ ValueKinds.NameListOrNull,
|
||||
/* show set elements = */ ValueKinds.NameListOrNull,
|
||||
/* show operator elements = */ ValueKinds.OperatorListOrNull,
|
||||
unionOfKinds([ValueKinds.ParserRecovery, ValueKinds.TypeBuilder]),
|
||||
ValueKinds.TypeVariableListOrNull,
|
||||
ValueKinds.Integer,
|
||||
|
@ -783,6 +909,23 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
ValueKinds.MetadataListOrNull
|
||||
]));
|
||||
debugEvent("endExtensionDeclaration");
|
||||
pop() as List<TypeBuilder>?; // Type elements of the 'hide' clause.
|
||||
pop() as List<String>?; // Getter elements of the 'hide' clause.
|
||||
pop() as List<String>?; // Member or type elements of the 'hide' clause.
|
||||
pop() as List<String>?; // Setter elements of the 'hide' clause.
|
||||
pop() as List<Operator>?; // Operator elements of the 'hide' clause.
|
||||
pop() as List<TypeBuilder>?; // Type elements of the 'show' clause.
|
||||
pop() as List<String>?; // Getter elements of the 'show' clause.
|
||||
pop() as List<String>?; // Member or type elements of the 'show' clause.
|
||||
pop() as List<String>?; // Setter elements of the 'show' clause.
|
||||
pop() as List<Operator>?; // Operator elements of the 'show' clause.
|
||||
if (showKeyword != null && !libraryBuilder.enableExtensionTypesInLibrary) {
|
||||
addProblem(
|
||||
templateExperimentNotEnabled.withArguments('extension-types',
|
||||
libraryBuilder.enableExtensionTypesVersionInLibrary.toText()),
|
||||
showKeyword.charOffset,
|
||||
showKeyword.length);
|
||||
}
|
||||
Object? onType = pop();
|
||||
if (onType is ParserRecovery) {
|
||||
ParserRecovery parserRecovery = onType;
|
||||
|
|
|
@ -75,6 +75,8 @@ class ValueKinds {
|
|||
static const ValueKind ModifiersOrNull =
|
||||
const SingleValueKind<List<type.Modifier>>(NullValue.Modifiers);
|
||||
static const ValueKind Name = const SingleValueKind<String>();
|
||||
static const ValueKind NameListOrNull =
|
||||
const SingleValueKind<List<String>>(NullValue.IdentifierList);
|
||||
static const ValueKind NameOrNull =
|
||||
const SingleValueKind<String>(NullValue.Name);
|
||||
static const ValueKind NameOrOperator =
|
||||
|
@ -87,6 +89,8 @@ class ValueKinds {
|
|||
const SingleValueKind<List<type.MetadataBuilder>>(NullValue.Metadata);
|
||||
static const ValueKind ObjectList = const SingleValueKind<List<Object>>();
|
||||
static const ValueKind Operator = const SingleValueKind<type.Operator>();
|
||||
static const ValueKind OperatorListOrNull =
|
||||
const SingleValueKind<List<type.Operator>>(NullValue.OperatorList);
|
||||
static const ValueKind ParserRecovery =
|
||||
const SingleValueKind<type.ParserRecovery>();
|
||||
static const ValueKind ProblemBuilder =
|
||||
|
@ -94,8 +98,7 @@ class ValueKinds {
|
|||
static const ValueKind QualifiedName =
|
||||
const SingleValueKind<type.QualifiedName>();
|
||||
static const ValueKind Scope = const SingleValueKind<type.Scope>();
|
||||
static const ValueKind Selector =
|
||||
const SingleValueKind<type.Selector>();
|
||||
static const ValueKind Selector = const SingleValueKind<type.Selector>();
|
||||
static const ValueKind SwitchScopeOrNull =
|
||||
const SingleValueKind<type.Scope>(NullValue.SwitchScope);
|
||||
static const ValueKind Statement = const SingleValueKind<type.Statement>();
|
||||
|
@ -114,6 +117,8 @@ class ValueKinds {
|
|||
const SingleValueKind<type.TypeBuilder>();
|
||||
static const ValueKind TypeBuilderOrNull =
|
||||
const SingleValueKind<type.TypeBuilder>(NullValue.Type);
|
||||
static const ValueKind TypeBuilderListOrNull =
|
||||
const SingleValueKind<List<type.TypeBuilder>>(NullValue.TypeBuilderList);
|
||||
static const ValueKind TypeVariableListOrNull =
|
||||
const SingleValueKind<List<type.TypeVariableBuilder>>(
|
||||
NullValue.TypeVariables);
|
||||
|
|
|
@ -215,6 +215,19 @@ abstract class AbstractDirectParserASTListener implements Listener {
|
|||
seen(data);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleExtensionShowHide(Token? showKeyword, int showElementCount,
|
||||
Token? hideKeyword, int hideElementCount) {
|
||||
DirectParserASTContentExtensionShowHideHandle data =
|
||||
new DirectParserASTContentExtensionShowHideHandle(
|
||||
DirectParserASTType.HANDLE,
|
||||
showKeyword: showKeyword,
|
||||
showElementCount: showElementCount,
|
||||
hideKeyword: hideKeyword,
|
||||
hideElementCount: hideElementCount);
|
||||
seen(data);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleClassHeader(Token begin, Token classKeyword, Token? nativeToken) {
|
||||
DirectParserASTContentClassHeaderHandle data =
|
||||
|
@ -311,13 +324,15 @@ abstract class AbstractDirectParserASTListener implements Listener {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token endToken) {
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
|
||||
DirectParserASTContentExtensionDeclarationEnd data =
|
||||
new DirectParserASTContentExtensionDeclarationEnd(
|
||||
DirectParserASTType.END,
|
||||
extensionKeyword: extensionKeyword,
|
||||
typeKeyword: typeKeyword,
|
||||
onKeyword: onKeyword,
|
||||
showKeyword: showKeyword,
|
||||
hideKeyword: hideKeyword,
|
||||
endToken: endToken);
|
||||
seen(data);
|
||||
}
|
||||
|
@ -2313,6 +2328,16 @@ abstract class AbstractDirectParserASTListener implements Listener {
|
|||
seen(data);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleShowHideIdentifier(Token? modifier, Token identifier) {
|
||||
DirectParserASTContentShowHideIdentifierHandle data =
|
||||
new DirectParserASTContentShowHideIdentifierHandle(
|
||||
DirectParserASTType.HANDLE,
|
||||
modifier: modifier,
|
||||
identifier: identifier);
|
||||
seen(data);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleIndexedExpression(
|
||||
Token? question, Token openSquareBracket, Token closeSquareBracket) {
|
||||
|
@ -3157,6 +3182,29 @@ class DirectParserASTContentClassOrMixinImplementsHandle
|
|||
};
|
||||
}
|
||||
|
||||
class DirectParserASTContentExtensionShowHideHandle
|
||||
extends DirectParserASTContent {
|
||||
final Token? showKeyword;
|
||||
final int showElementCount;
|
||||
final Token? hideKeyword;
|
||||
final int hideElementCount;
|
||||
|
||||
DirectParserASTContentExtensionShowHideHandle(DirectParserASTType type,
|
||||
{this.showKeyword,
|
||||
required this.showElementCount,
|
||||
this.hideKeyword,
|
||||
required this.hideElementCount})
|
||||
: super("ExtensionShowHide", type);
|
||||
|
||||
@override
|
||||
Map<String, Object?> get deprecatedArguments => {
|
||||
"showKeyword": showKeyword,
|
||||
"showElementCount": showElementCount,
|
||||
"hideKeyword": hideKeyword,
|
||||
"hideElementCount": hideElementCount,
|
||||
};
|
||||
}
|
||||
|
||||
class DirectParserASTContentClassHeaderHandle extends DirectParserASTContent {
|
||||
final Token begin;
|
||||
final Token classKeyword;
|
||||
|
@ -3317,12 +3365,16 @@ class DirectParserASTContentExtensionDeclarationEnd
|
|||
final Token extensionKeyword;
|
||||
final Token? typeKeyword;
|
||||
final Token onKeyword;
|
||||
final Token? showKeyword;
|
||||
final Token? hideKeyword;
|
||||
final Token endToken;
|
||||
|
||||
DirectParserASTContentExtensionDeclarationEnd(DirectParserASTType type,
|
||||
{required this.extensionKeyword,
|
||||
this.typeKeyword,
|
||||
required this.onKeyword,
|
||||
this.showKeyword,
|
||||
this.hideKeyword,
|
||||
required this.endToken})
|
||||
: super("ExtensionDeclaration", type);
|
||||
|
||||
|
@ -3331,6 +3383,8 @@ class DirectParserASTContentExtensionDeclarationEnd
|
|||
"extensionKeyword": extensionKeyword,
|
||||
"typeKeyword": typeKeyword,
|
||||
"onKeyword": onKeyword,
|
||||
"showKeyword": showKeyword,
|
||||
"hideKeyword": hideKeyword,
|
||||
"endToken": endToken,
|
||||
};
|
||||
}
|
||||
|
@ -6627,6 +6681,22 @@ class DirectParserASTContentIdentifierHandle extends DirectParserASTContent {
|
|||
};
|
||||
}
|
||||
|
||||
class DirectParserASTContentShowHideIdentifierHandle
|
||||
extends DirectParserASTContent {
|
||||
final Token? modifier;
|
||||
final Token identifier;
|
||||
|
||||
DirectParserASTContentShowHideIdentifierHandle(DirectParserASTType type,
|
||||
{this.modifier, required this.identifier})
|
||||
: super("ShowHideIdentifier", type);
|
||||
|
||||
@override
|
||||
Map<String, Object?> get deprecatedArguments => {
|
||||
"modifier": modifier,
|
||||
"identifier": identifier,
|
||||
};
|
||||
}
|
||||
|
||||
class DirectParserASTContentIndexedExpressionHandle
|
||||
extends DirectParserASTContent {
|
||||
final Token? question;
|
||||
|
|
|
@ -805,7 +805,7 @@ class TextualOutlineListener extends Listener {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token endToken) {
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
|
||||
classStartToChunk[extensionKeyword] =
|
||||
new _ExtensionDeclarationChunk(extensionKeyword, endToken);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ beginCompilationUnit(extension)
|
|||
handleType(T, null)
|
||||
endTypeArguments(1, <, >)
|
||||
handleType(List, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
beginMetadataStar(bool)
|
||||
endMetadataStar(0)
|
||||
|
@ -108,7 +109,7 @@ beginCompilationUnit(extension)
|
|||
endExtensionMethod(set, set, (, null, })
|
||||
endMember()
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 3, {, })
|
||||
endExtensionDeclaration(extension, null, on, })
|
||||
endExtensionDeclaration(extension, null, on, null, null, })
|
||||
endTopLevelDeclaration(void)
|
||||
beginMetadataStar(void)
|
||||
endMetadataStar(0)
|
||||
|
|
|
@ -31,6 +31,7 @@ parseUnit(extension)
|
|||
listener: handleType(T, null)
|
||||
listener: endTypeArguments(1, <, >)
|
||||
listener: handleType(List, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(>, DeclarationKind.Extension, E)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, bool)
|
||||
|
@ -172,7 +173,7 @@ parseUnit(extension)
|
|||
listener: endMember()
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 3, {, })
|
||||
listener: endExtensionDeclaration(extension, null, on, })
|
||||
listener: endExtensionDeclaration(extension, null, on, null, null, })
|
||||
listener: endTopLevelDeclaration(void)
|
||||
parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
|
||||
parseMetadataStar(})
|
||||
|
|
|
@ -22,6 +22,7 @@ beginCompilationUnit(class)
|
|||
handleIdentifier(A, typeReference)
|
||||
handleNoTypeArguments({)
|
||||
handleType(A, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
beginMetadataStar(method)
|
||||
endMetadataStar(0)
|
||||
|
@ -39,7 +40,7 @@ beginCompilationUnit(class)
|
|||
endExtensionMethod(null, method, (, null, })
|
||||
endMember()
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
endExtensionDeclaration(extension, null, on, })
|
||||
endExtensionDeclaration(extension, null, on, null, null, })
|
||||
endTopLevelDeclaration(test)
|
||||
beginMetadataStar(test)
|
||||
endMetadataStar(0)
|
||||
|
|
|
@ -43,6 +43,7 @@ parseUnit(class)
|
|||
listener: handleIdentifier(A, typeReference)
|
||||
listener: handleNoTypeArguments({)
|
||||
listener: handleType(A, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(A, DeclarationKind.Extension, type)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, method)
|
||||
|
@ -79,7 +80,7 @@ parseUnit(class)
|
|||
listener: endMember()
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
listener: endExtensionDeclaration(extension, null, on, })
|
||||
listener: endExtensionDeclaration(extension, null, on, null, null, })
|
||||
listener: endTopLevelDeclaration(test)
|
||||
parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
|
||||
parseMetadataStar(})
|
||||
|
|
|
@ -22,8 +22,9 @@ beginCompilationUnit(class)
|
|||
handleIdentifier(A, typeReference)
|
||||
handleNoTypeArguments({)
|
||||
handleType(A, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 0, {, })
|
||||
endExtensionDeclaration(extension, type, on, })
|
||||
endExtensionDeclaration(extension, type, on, null, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(2, )
|
||||
|
|
|
@ -43,11 +43,12 @@ parseUnit(class)
|
|||
listener: handleIdentifier(A, typeReference)
|
||||
listener: handleNoTypeArguments({)
|
||||
listener: handleType(A, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(A, DeclarationKind.Extension, E)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 0, {, })
|
||||
listener: endExtensionDeclaration(extension, type, on, })
|
||||
listener: endExtensionDeclaration(extension, type, on, null, null, })
|
||||
listener: endTopLevelDeclaration()
|
||||
reportAllErrorTokens(class)
|
||||
listener: endCompilationUnit(2, )
|
||||
|
|
|
@ -45,6 +45,7 @@ beginCompilationUnit(class)
|
|||
handleIdentifier(C, typeReference)
|
||||
handleNoTypeArguments({)
|
||||
handleType(C, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
beginMetadataStar(addChild)
|
||||
endMetadataStar(0)
|
||||
|
@ -72,6 +73,6 @@ beginCompilationUnit(class)
|
|||
endExtensionMethod(null, addChild, (, null, })
|
||||
endMember()
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
endExtensionDeclaration(extension, null, on, })
|
||||
endExtensionDeclaration(extension, null, on, null, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(3, )
|
||||
|
|
|
@ -74,6 +74,7 @@ parseUnit(class)
|
|||
listener: handleIdentifier(C, typeReference)
|
||||
listener: handleNoTypeArguments({)
|
||||
listener: handleType(C, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, addChild)
|
||||
|
@ -124,7 +125,7 @@ parseUnit(class)
|
|||
listener: endMember()
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
listener: endExtensionDeclaration(extension, null, on, })
|
||||
listener: endExtensionDeclaration(extension, null, on, null, null, })
|
||||
listener: endTopLevelDeclaration()
|
||||
reportAllErrorTokens(class)
|
||||
listener: endCompilationUnit(3, )
|
||||
|
|
|
@ -39,6 +39,7 @@ beginCompilationUnit(class)
|
|||
handleIdentifier(C, typeReference)
|
||||
handleNoTypeArguments({)
|
||||
handleType(C, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
beginMetadataStar(addChild)
|
||||
endMetadataStar(0)
|
||||
|
@ -65,6 +66,6 @@ beginCompilationUnit(class)
|
|||
endExtensionMethod(null, addChild, (, null, })
|
||||
endMember()
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
endExtensionDeclaration(extension, null, on, })
|
||||
endExtensionDeclaration(extension, null, on, null, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(3, )
|
||||
|
|
|
@ -74,6 +74,7 @@ parseUnit(class)
|
|||
listener: handleIdentifier(C, typeReference)
|
||||
listener: handleNoTypeArguments({)
|
||||
listener: handleType(C, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, addChild)
|
||||
|
@ -122,7 +123,7 @@ parseUnit(class)
|
|||
listener: endMember()
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
listener: endExtensionDeclaration(extension, null, on, })
|
||||
listener: endExtensionDeclaration(extension, null, on, null, null, })
|
||||
listener: endTopLevelDeclaration()
|
||||
reportAllErrorTokens(class)
|
||||
listener: endCompilationUnit(3, )
|
||||
|
|
|
@ -39,6 +39,7 @@ beginCompilationUnit(class)
|
|||
handleIdentifier(C, typeReference)
|
||||
handleNoTypeArguments({)
|
||||
handleType(C, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
beginMetadataStar(static)
|
||||
endMetadataStar(0)
|
||||
|
@ -65,6 +66,6 @@ beginCompilationUnit(class)
|
|||
endExtensionMethod(null, static, (, null, })
|
||||
endMember()
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
endExtensionDeclaration(extension, null, on, })
|
||||
endExtensionDeclaration(extension, null, on, null, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(3, )
|
||||
|
|
|
@ -74,6 +74,7 @@ parseUnit(class)
|
|||
listener: handleIdentifier(C, typeReference)
|
||||
listener: handleNoTypeArguments({)
|
||||
listener: handleType(C, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, static)
|
||||
|
@ -121,7 +122,7 @@ parseUnit(class)
|
|||
listener: endMember()
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
listener: endExtensionDeclaration(extension, null, on, })
|
||||
listener: endExtensionDeclaration(extension, null, on, null, null, })
|
||||
listener: endTopLevelDeclaration()
|
||||
reportAllErrorTokens(class)
|
||||
listener: endCompilationUnit(3, )
|
||||
|
|
|
@ -45,6 +45,7 @@ beginCompilationUnit(class)
|
|||
handleIdentifier(C, typeReference)
|
||||
handleNoTypeArguments({)
|
||||
handleType(C, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
beginMetadataStar(static)
|
||||
endMetadataStar(0)
|
||||
|
@ -72,6 +73,6 @@ beginCompilationUnit(class)
|
|||
endExtensionMethod(null, static, (, null, })
|
||||
endMember()
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
endExtensionDeclaration(extension, null, on, })
|
||||
endExtensionDeclaration(extension, null, on, null, null, })
|
||||
endTopLevelDeclaration()
|
||||
endCompilationUnit(3, )
|
||||
|
|
|
@ -74,6 +74,7 @@ parseUnit(class)
|
|||
listener: handleIdentifier(C, typeReference)
|
||||
listener: handleNoTypeArguments({)
|
||||
listener: handleType(C, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, static)
|
||||
|
@ -123,7 +124,7 @@ parseUnit(class)
|
|||
listener: endMember()
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
|
||||
listener: endExtensionDeclaration(extension, null, on, })
|
||||
listener: endExtensionDeclaration(extension, null, on, null, null, })
|
||||
listener: endTopLevelDeclaration()
|
||||
reportAllErrorTokens(class)
|
||||
listener: endCompilationUnit(3, )
|
||||
|
|
|
@ -7,6 +7,7 @@ beginCompilationUnit(extension)
|
|||
handleIdentifier(Symbol, typeReference)
|
||||
handleNoTypeArguments({)
|
||||
handleType(Symbol, null)
|
||||
handleExtensionShowHide(null, 0, null, 0)
|
||||
beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
beginMetadataStar(String)
|
||||
endMetadataStar(0)
|
||||
|
@ -59,7 +60,7 @@ beginCompilationUnit(extension)
|
|||
endExtensionMethod(null, String, (, null, ;)
|
||||
endMember()
|
||||
endClassOrMixinBody(DeclarationKind.Extension, 2, {, })
|
||||
endExtensionDeclaration(extension, null, on, })
|
||||
endExtensionDeclaration(extension, null, on, null, null, })
|
||||
endTopLevelDeclaration(void)
|
||||
beginMetadataStar(void)
|
||||
endMetadataStar(0)
|
||||
|
|
|
@ -15,6 +15,7 @@ parseUnit(extension)
|
|||
listener: handleIdentifier(Symbol, typeReference)
|
||||
listener: handleNoTypeArguments({)
|
||||
listener: handleType(Symbol, null)
|
||||
listener: handleExtensionShowHide(null, 0, null, 0)
|
||||
parseClassOrMixinOrExtensionBody(Symbol, DeclarationKind.Extension, null)
|
||||
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
|
||||
notEofOrValue(}, String)
|
||||
|
@ -122,7 +123,7 @@ parseUnit(extension)
|
|||
listener: endMember()
|
||||
notEofOrValue(}, })
|
||||
listener: endClassOrMixinBody(DeclarationKind.Extension, 2, {, })
|
||||
listener: endExtensionDeclaration(extension, null, on, })
|
||||
listener: endExtensionDeclaration(extension, null, on, null, null, })
|
||||
listener: endTopLevelDeclaration(void)
|
||||
parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
|
||||
parseMetadataStar(})
|
||||
|
|
|
@ -222,6 +222,18 @@ class ParserTestListener implements Listener {
|
|||
'$interfacesCount)');
|
||||
}
|
||||
|
||||
@override
|
||||
void handleExtensionShowHide(Token? showKeyword, int showElementCount,
|
||||
Token? hideKeyword, int hideElementCount) {
|
||||
seen(showKeyword);
|
||||
seen(hideKeyword);
|
||||
doPrint('handleExtensionShowHide('
|
||||
'$showKeyword, '
|
||||
'$showElementCount, '
|
||||
'$hideKeyword, '
|
||||
'$hideElementCount)');
|
||||
}
|
||||
|
||||
@override
|
||||
void handleClassHeader(Token begin, Token classKeyword, Token? nativeToken) {
|
||||
seen(begin);
|
||||
|
@ -300,16 +312,20 @@ class ParserTestListener implements Listener {
|
|||
|
||||
@override
|
||||
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
|
||||
Token onKeyword, Token endToken) {
|
||||
Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
|
||||
indent--;
|
||||
seen(extensionKeyword);
|
||||
seen(typeKeyword);
|
||||
seen(onKeyword);
|
||||
seen(showKeyword);
|
||||
seen(hideKeyword);
|
||||
seen(endToken);
|
||||
doPrint('endExtensionDeclaration('
|
||||
'$extensionKeyword, '
|
||||
'$typeKeyword, '
|
||||
'$onKeyword, '
|
||||
'$showKeyword, '
|
||||
'$hideKeyword, '
|
||||
'$endToken)');
|
||||
}
|
||||
|
||||
|
@ -2083,6 +2099,13 @@ class ParserTestListener implements Listener {
|
|||
doPrint('handleIdentifier(' '$token, ' '$context)');
|
||||
}
|
||||
|
||||
@override
|
||||
void handleShowHideIdentifier(Token? modifier, Token identifier) {
|
||||
seen(modifier);
|
||||
seen(identifier);
|
||||
doPrint('handleShowHideIdentifier(' '$modifier, ' '$identifier)');
|
||||
}
|
||||
|
||||
@override
|
||||
void handleIndexedExpression(
|
||||
Token? question, Token openSquareBracket, Token closeSquareBracket) {
|
||||
|
|
|
@ -3156,6 +3156,7 @@ unalias
|
|||
unaliased
|
||||
unaliasing
|
||||
unambiguous
|
||||
unambiguously
|
||||
unary
|
||||
unassignable
|
||||
unassigned
|
||||
|
|
17
pkg/front_end/testcases/extension_types/basic_show.dart
Normal file
17
pkg/front_end/testcases/extension_types/basic_show.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) 2021, 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.
|
||||
|
||||
extension E1 on int show num {} // Ok.
|
||||
|
||||
extension E2 on int {} // Ok.
|
||||
|
||||
extension E3 on int show {} // Error.
|
||||
|
||||
extension E4 on int show num, Comparable {} // Ok.
|
||||
|
||||
extension E5 on int show num, {} // Error.
|
||||
|
||||
extension E6 on int show , num {} // Error.
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E3 on int show {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E5 on int show num, {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
|
||||
// Try inserting an identifier before ','.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
}
|
||||
extension E2 on core::int {
|
||||
}
|
||||
extension E3 on core::int {
|
||||
}
|
||||
extension E4 on core::int {
|
||||
}
|
||||
extension E5 on core::int {
|
||||
}
|
||||
extension E6 on core::int {
|
||||
}
|
||||
static method num() → dynamic {}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E3 on int show {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E5 on int show num, {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
|
||||
// Try inserting an identifier before ','.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
}
|
||||
extension E2 on core::int {
|
||||
}
|
||||
extension E3 on core::int {
|
||||
}
|
||||
extension E4 on core::int {
|
||||
}
|
||||
extension E5 on core::int {
|
||||
}
|
||||
extension E6 on core::int {
|
||||
}
|
||||
static method num() → dynamic {}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,8 @@
|
|||
extension E1 on int show num {}
|
||||
extension E2 on int {}
|
||||
extension E3 on int show {}
|
||||
extension E4 on int show num, Comparable {}
|
||||
extension E5 on int show num, {}
|
||||
extension E6 on int show , {}
|
||||
num (){}
|
||||
main() {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E3 on int show {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E5 on int show num, {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
|
||||
// Try inserting an identifier before ','.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
}
|
||||
extension E2 on core::int {
|
||||
}
|
||||
extension E3 on core::int {
|
||||
}
|
||||
extension E4 on core::int {
|
||||
}
|
||||
extension E5 on core::int {
|
||||
}
|
||||
extension E6 on core::int {
|
||||
}
|
||||
static method num() → dynamic {}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,48 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E3 on int show {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E5 on int show num, {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
|
||||
// Try inserting an identifier before ','.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
}
|
||||
extension E2 on core::int {
|
||||
}
|
||||
extension E3 on core::int {
|
||||
}
|
||||
extension E4 on core::int {
|
||||
}
|
||||
extension E5 on core::int {
|
||||
}
|
||||
extension E6 on core::int {
|
||||
}
|
||||
static method num() → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E3 on int show {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
|
||||
// Try inserting an identifier before '{'.
|
||||
// extension E5 on int show num, {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
|
||||
// Try inserting an identifier before ','.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E6 on int show , num {} // Error.
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
}
|
||||
extension E2 on core::int {
|
||||
}
|
||||
extension E3 on core::int {
|
||||
}
|
||||
extension E4 on core::int {
|
||||
}
|
||||
extension E5 on core::int {
|
||||
}
|
||||
extension E6 on core::int {
|
||||
}
|
||||
static method num() → dynamic {}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) 2021, 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.
|
||||
|
||||
class A {
|
||||
void mixin() {}
|
||||
void as() {}
|
||||
}
|
||||
|
||||
extension type E1 on A show mixin, as {}
|
||||
extension type E2 on A hide mixin, as {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,16 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
method mixin() → void {}
|
||||
method as() → void {}
|
||||
}
|
||||
extension type E1 on self::A {
|
||||
}
|
||||
extension type E2 on self::A {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,16 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
method mixin() → void {}
|
||||
method as() → void {}
|
||||
}
|
||||
extension type E1 on self::A {
|
||||
}
|
||||
extension type E2 on self::A {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,7 @@
|
|||
class A {
|
||||
void mixin() {}
|
||||
void as() {}
|
||||
}
|
||||
extension type E1 on A show mixin, as {}
|
||||
extension type E2 on A hide mixin, as {}
|
||||
main() {}
|
|
@ -0,0 +1,16 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
method mixin() → void {}
|
||||
method as() → void {}
|
||||
}
|
||||
extension type E1 on self::A {
|
||||
}
|
||||
extension type E2 on self::A {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
;
|
||||
method mixin() → void
|
||||
;
|
||||
method as() → void
|
||||
;
|
||||
}
|
||||
extension type E1 on self::A {
|
||||
}
|
||||
extension type E2 on self::A {
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,16 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
method mixin() → void {}
|
||||
method as() → void {}
|
||||
}
|
||||
extension type E1 on self::A {
|
||||
}
|
||||
extension type E2 on self::A {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2021, 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.
|
||||
|
||||
class I1<X, Y> {}
|
||||
|
||||
class I2<X, Y, Z> {}
|
||||
|
||||
class A {}
|
||||
|
||||
class B extends A implements I1<int, int> {
|
||||
void methodB() {}
|
||||
void methodB2() {}
|
||||
int get getterB => throw 42;
|
||||
void set setterB(int value) {}
|
||||
B operator *(B other) => throw 42;
|
||||
}
|
||||
|
||||
class C extends B {}
|
||||
|
||||
class D extends C implements I2<int, int, int> {
|
||||
void methodD() {}
|
||||
int get getterD => throw 42;
|
||||
void set setterD(int value) {}
|
||||
D operator +(D other) => throw 42;
|
||||
}
|
||||
|
||||
extension type E on D
|
||||
show C, I2<int, int, int>, methodD, get getterD, set setterD, operator +
|
||||
hide A, I1<int, int>, methodB, methodB2, get getterB, set setterB, operator *
|
||||
{}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,50 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class B extends self::A implements self::I1<core::int, core::int> {
|
||||
synthetic constructor •() → self::B
|
||||
: super self::A::•()
|
||||
;
|
||||
method methodB() → void {}
|
||||
method methodB2() → void {}
|
||||
get getterB() → core::int
|
||||
return throw 42;
|
||||
set setterB(core::int value) → void {}
|
||||
operator *(self::B other) → self::B
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
}
|
||||
class D extends self::C implements self::I2<core::int, core::int, core::int> {
|
||||
synthetic constructor •() → self::D
|
||||
: super self::C::•()
|
||||
;
|
||||
method methodD() → void {}
|
||||
get getterD() → core::int
|
||||
return throw 42;
|
||||
set setterD(core::int value) → void {}
|
||||
operator +(self::D other) → self::D
|
||||
return throw 42;
|
||||
}
|
||||
extension type E on self::D {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,50 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class B extends self::A implements self::I1<core::int, core::int> {
|
||||
synthetic constructor •() → self::B
|
||||
: super self::A::•()
|
||||
;
|
||||
method methodB() → void {}
|
||||
method methodB2() → void {}
|
||||
get getterB() → core::int
|
||||
return throw 42;
|
||||
set setterB(core::int value) → void {}
|
||||
operator *(self::B other) → self::B
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
}
|
||||
class D extends self::C implements self::I2<core::int, core::int, core::int> {
|
||||
synthetic constructor •() → self::D
|
||||
: super self::C::•()
|
||||
;
|
||||
method methodD() → void {}
|
||||
get getterD() → core::int
|
||||
return throw 42;
|
||||
set setterD(core::int value) → void {}
|
||||
operator +(self::D other) → self::D
|
||||
return throw 42;
|
||||
}
|
||||
extension type E on self::D {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,19 @@
|
|||
class I1<X, Y> {}
|
||||
class I2<X, Y, Z> {}
|
||||
class A {}
|
||||
class B extends A implements I1<int, int> {
|
||||
void methodB() {}
|
||||
void methodB2() {}
|
||||
int get getterB => throw 42;
|
||||
void set setterB(int value) {}
|
||||
B operator *(B other) => throw 42;
|
||||
}
|
||||
class C extends B {}
|
||||
class D extends C implements I2<int, int, int> {
|
||||
void methodD() {}
|
||||
int get getterD => throw 42;
|
||||
void set setterD(int value) {}
|
||||
D operator +(D other) => throw 42;
|
||||
}
|
||||
extension type E on D show C, I2<int, int, int>, methodD, get getterD, set setterD, operator + hide A, I1<int, int>, methodB, methodB2, get getterB, set setterB, operator * {}
|
||||
main() {}
|
|
@ -0,0 +1,50 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class B extends self::A implements self::I1<core::int, core::int> {
|
||||
synthetic constructor •() → self::B
|
||||
: super self::A::•()
|
||||
;
|
||||
method methodB() → void {}
|
||||
method methodB2() → void {}
|
||||
get getterB() → core::int
|
||||
return throw 42;
|
||||
set setterB(core::int value) → void {}
|
||||
operator *(self::B other) → self::B
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
}
|
||||
class D extends self::C implements self::I2<core::int, core::int, core::int> {
|
||||
synthetic constructor •() → self::D
|
||||
: super self::C::•()
|
||||
;
|
||||
method methodD() → void {}
|
||||
get getterD() → core::int
|
||||
return throw 42;
|
||||
set setterD(core::int value) → void {}
|
||||
operator +(self::D other) → self::D
|
||||
return throw 42;
|
||||
}
|
||||
extension type E on self::D {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,50 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
|
||||
;
|
||||
}
|
||||
class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
|
||||
;
|
||||
}
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
;
|
||||
}
|
||||
class B extends self::A implements self::I1<core::int, core::int> {
|
||||
synthetic constructor •() → self::B
|
||||
;
|
||||
method methodB() → void
|
||||
;
|
||||
method methodB2() → void
|
||||
;
|
||||
get getterB() → core::int
|
||||
;
|
||||
set setterB(core::int value) → void
|
||||
;
|
||||
operator *(self::B other) → self::B
|
||||
;
|
||||
}
|
||||
class C extends self::B {
|
||||
synthetic constructor •() → self::C
|
||||
;
|
||||
}
|
||||
class D extends self::C implements self::I2<core::int, core::int, core::int> {
|
||||
synthetic constructor •() → self::D
|
||||
;
|
||||
method methodD() → void
|
||||
;
|
||||
get getterD() → core::int
|
||||
;
|
||||
set setterD(core::int value) → void
|
||||
;
|
||||
operator +(self::D other) → self::D
|
||||
;
|
||||
}
|
||||
extension type E on self::D {
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,50 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class B extends self::A implements self::I1<core::int, core::int> {
|
||||
synthetic constructor •() → self::B
|
||||
: super self::A::•()
|
||||
;
|
||||
method methodB() → void {}
|
||||
method methodB2() → void {}
|
||||
get getterB() → core::int
|
||||
return throw 42;
|
||||
set setterB(core::int value) → void {}
|
||||
operator *(self::B other) → self::B
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
}
|
||||
class D extends self::C implements self::I2<core::int, core::int, core::int> {
|
||||
synthetic constructor •() → self::D
|
||||
: super self::C::•()
|
||||
;
|
||||
method methodD() → void {}
|
||||
get getterD() → core::int
|
||||
return throw 42;
|
||||
set setterD(core::int value) → void {}
|
||||
operator +(self::D other) → self::D
|
||||
return throw 42;
|
||||
}
|
||||
extension type E on self::D {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -2,99 +2,6 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:25: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: Expected ';' after this.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:34: Error: 'num' is already declared in this scope.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Context: Previous declaration of 'num'.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: 'isEven' is already declared in this scope.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Context: Previous declaration of 'isEven'.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:51: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: Type 'show' not found.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:46: Error: Type 'hide' not found.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:9:3: Error: Undefined name 'e2'.
|
||||
// e2.floor(); // Ok.
|
||||
// ^^
|
||||
|
@ -109,10 +16,6 @@ library /*isNonNullableByDefault*/;
|
|||
// e1.isEven; // Error.
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: 'show' isn't a type.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
|
||||
// Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
|
||||
// e2.ceil(); // Error.
|
||||
|
@ -138,28 +41,6 @@ library /*isNonNullableByDefault*/;
|
|||
// e3.isEven; // Error.
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: 'show' isn't a type.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:7: Error: Expected ';' after this.
|
||||
// int get twice => 2 * this;
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:17: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// int get twice => 2 * this;
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
|
||||
// int get twice => 2 * this;
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
|
||||
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
|
||||
// m.twice; // OK, in the extension type.
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
|
||||
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
|
||||
// m.isEven; // OK, a shown instance member.
|
||||
|
@ -185,8 +66,8 @@ extension E2 on core::int {
|
|||
extension E3 on core::int {
|
||||
}
|
||||
extension type MyInt on core::int {
|
||||
get twice = self::MyInt|get#twice;
|
||||
}
|
||||
static method num() → invalid-type {}
|
||||
static method test1(self::E1 e1) → dynamic {
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:8:6: Error: The method 'ceil' isn't defined for the extension 'E1'.
|
||||
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
|
||||
|
@ -200,7 +81,6 @@ Try correcting the name to the name of an existing getter, or defining a getter
|
|||
e1.isEven; // Error.
|
||||
^^^^^^" in e1{<unresolved>}.isEven;
|
||||
}
|
||||
static method ceil() → invalid-type {}
|
||||
static method test2(self::E2 e2) → dynamic {
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
|
||||
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
|
||||
|
@ -215,7 +95,6 @@ Try correcting the name to the name of an existing getter, or defining a getter
|
|||
e2.isEven; // Error.
|
||||
^^^^^^" in e2{<unresolved>}.isEven;
|
||||
}
|
||||
static method isEven() → invalid-type {}
|
||||
static method test3(self::E3 e3) → dynamic {
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:24:6: Error: The getter 'isOdd' isn't defined for the extension 'E3'.
|
||||
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isOdd'.
|
||||
|
@ -226,19 +105,11 @@ Try correcting the name to the name of an existing getter, or defining a getter
|
|||
e3.isEven; // Error.
|
||||
^^^^^^" in e3{<unresolved>}.isEven;
|
||||
}
|
||||
static method floor() → invalid-type {
|
||||
core::int get;
|
||||
function twice() → core::double
|
||||
return 2.{core::num::*}(invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
|
||||
int get twice => 2 * this;
|
||||
^^^^"){(core::num) → core::double};
|
||||
}
|
||||
static method MyInt|get#twice(lowered final core::int #this) → core::int
|
||||
return 2.{core::num::*}(#this){(core::num) → core::int};
|
||||
static method test() → dynamic {
|
||||
self::MyInt m = 42;
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
|
||||
Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
|
||||
m.twice; // OK, in the extension type.
|
||||
^^^^^" in m{<unresolved>}.twice;
|
||||
self::MyInt|get#twice(m);
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
|
||||
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
|
||||
m.isEven; // OK, a shown instance member.
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
extension E1 on int {}
|
||||
show num (){}
|
||||
extension E1 on int show num {}
|
||||
test1(E1 e1) {}
|
||||
extension E2 on int {}
|
||||
show num ;
|
||||
hide ceil (){}
|
||||
extension E2 on int show num hide ceil {}
|
||||
test2(E2 e2) {}
|
||||
extension E3 on int {}
|
||||
hide isEven (){}
|
||||
extension E3 on int hide isEven {}
|
||||
test3(E3 e3) {}
|
||||
extension type MyInt on int {}
|
||||
show num, isEven ;
|
||||
hide floor (){}
|
||||
extension type MyInt on int show num, isEven hide floor {
|
||||
int get twice => 2 * this;
|
||||
}
|
||||
test() {}
|
||||
main() {}
|
||||
|
|
|
@ -2,99 +2,6 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:25: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: Expected ';' after this.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:34: Error: 'num' is already declared in this scope.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Context: Previous declaration of 'num'.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: 'isEven' is already declared in this scope.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Context: Previous declaration of 'isEven'.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:51: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: Type 'show' not found.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:46: Error: Type 'hide' not found.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:9:3: Error: Undefined name 'e2'.
|
||||
// e2.floor(); // Ok.
|
||||
// ^^
|
||||
|
@ -109,10 +16,6 @@ library /*isNonNullableByDefault*/;
|
|||
// e1.isEven; // Error.
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: 'show' isn't a type.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
|
||||
// Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
|
||||
// e2.ceil(); // Error.
|
||||
|
@ -138,28 +41,6 @@ library /*isNonNullableByDefault*/;
|
|||
// e3.isEven; // Error.
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: 'show' isn't a type.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:7: Error: Expected ';' after this.
|
||||
// int get twice => 2 * this;
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:17: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// int get twice => 2 * this;
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
|
||||
// int get twice => 2 * this;
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
|
||||
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
|
||||
// m.twice; // OK, in the extension type.
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
|
||||
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
|
||||
// m.isEven; // OK, a shown instance member.
|
||||
|
@ -185,8 +66,8 @@ extension E2 on core::int {
|
|||
extension E3 on core::int {
|
||||
}
|
||||
extension type MyInt on core::int {
|
||||
get twice = self::MyInt|get#twice;
|
||||
}
|
||||
static method num() → invalid-type {}
|
||||
static method test1(self::E1 e1) → dynamic {
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:8:6: Error: The method 'ceil' isn't defined for the extension 'E1'.
|
||||
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
|
||||
|
@ -200,7 +81,6 @@ Try correcting the name to the name of an existing getter, or defining a getter
|
|||
e1.isEven; // Error.
|
||||
^^^^^^" in e1{<unresolved>}.isEven;
|
||||
}
|
||||
static method ceil() → invalid-type {}
|
||||
static method test2(self::E2 e2) → dynamic {
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
|
||||
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
|
||||
|
@ -215,7 +95,6 @@ Try correcting the name to the name of an existing getter, or defining a getter
|
|||
e2.isEven; // Error.
|
||||
^^^^^^" in e2{<unresolved>}.isEven;
|
||||
}
|
||||
static method isEven() → invalid-type {}
|
||||
static method test3(self::E3 e3) → dynamic {
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:24:6: Error: The getter 'isOdd' isn't defined for the extension 'E3'.
|
||||
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isOdd'.
|
||||
|
@ -226,19 +105,11 @@ Try correcting the name to the name of an existing getter, or defining a getter
|
|||
e3.isEven; // Error.
|
||||
^^^^^^" in e3{<unresolved>}.isEven;
|
||||
}
|
||||
static method floor() → invalid-type {
|
||||
core::int get;
|
||||
function twice() → core::double
|
||||
return 2.{core::num::*}(invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
|
||||
int get twice => 2 * this;
|
||||
^^^^"){(core::num) → core::double};
|
||||
}
|
||||
static method MyInt|get#twice(lowered final core::int #this) → core::int
|
||||
return 2.{core::num::*}(#this){(core::num) → core::int};
|
||||
static method test() → dynamic {
|
||||
self::MyInt m = 42;
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
|
||||
Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
|
||||
m.twice; // OK, in the extension type.
|
||||
^^^^^" in m{<unresolved>}.twice;
|
||||
self::MyInt|get#twice(m);
|
||||
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
|
||||
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
|
||||
m.isEven; // OK, a shown instance member.
|
||||
|
|
|
@ -1,100 +1,4 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:25: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: Expected ';' after this.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:34: Error: 'num' is already declared in this scope.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Context: Previous declaration of 'num'.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: 'isEven' is already declared in this scope.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Context: Previous declaration of 'isEven'.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:51: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {}
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: Type 'show' not found.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:46: Error: Type 'hide' not found.
|
||||
// extension type MyInt on int show num, isEven hide floor {
|
||||
// ^^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
@ -105,20 +9,15 @@ extension E2 on core::int {
|
|||
extension E3 on core::int {
|
||||
}
|
||||
extension type MyInt on core::int {
|
||||
get twice = self::MyInt|get#twice;
|
||||
}
|
||||
static method num() → invalid-type
|
||||
;
|
||||
static method test1(self::E1 e1) → dynamic
|
||||
;
|
||||
static method ceil() → invalid-type
|
||||
;
|
||||
static method test2(self::E2 e2) → dynamic
|
||||
;
|
||||
static method isEven() → invalid-type
|
||||
;
|
||||
static method test3(self::E3 e3) → dynamic
|
||||
;
|
||||
static method floor() → invalid-type
|
||||
static method MyInt|get#twice(lowered final core::int #this) → core::int
|
||||
;
|
||||
static method test() → dynamic
|
||||
;
|
||||
|
|
|
@ -2,140 +2,58 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Error.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Ok.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int floor() {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
method ceil = self::E1|ceil;
|
||||
tearoff ceil = self::E1|get#ceil;
|
||||
}
|
||||
extension E2 on core::int {
|
||||
method ceil = self::E2|ceil;
|
||||
tearoff ceil = self::E2|get#ceil;
|
||||
method floor = self::E2|floor;
|
||||
tearoff floor = self::E2|get#floor;
|
||||
}
|
||||
extension E3 on core::int {
|
||||
get isOdd = self::E3|get#isOdd;
|
||||
get isEven = self::E3|get#isEven;
|
||||
}
|
||||
static method num() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
^" in null;
|
||||
}
|
||||
static method ceil() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E1|ceil(#this);
|
||||
static method E2|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Ok.
|
||||
^" in null;
|
||||
}
|
||||
function floor() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|ceil(#this);
|
||||
static method E2|floor(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int floor() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
}
|
||||
static method isEven() → invalid-type {
|
||||
core::bool get;
|
||||
function isOdd() → Never
|
||||
return throw 42;
|
||||
core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
bool get isEven => throw 42; // Ok.
|
||||
^^^";
|
||||
function isEven() → Never
|
||||
return throw 42;
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#floor(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|floor(#this);
|
||||
static method E3|get#isOdd(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method E3|get#isEven(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -2,140 +2,58 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Error.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Ok.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int floor() {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
method ceil = self::E1|ceil;
|
||||
tearoff ceil = self::E1|get#ceil;
|
||||
}
|
||||
extension E2 on core::int {
|
||||
method ceil = self::E2|ceil;
|
||||
tearoff ceil = self::E2|get#ceil;
|
||||
method floor = self::E2|floor;
|
||||
tearoff floor = self::E2|get#floor;
|
||||
}
|
||||
extension E3 on core::int {
|
||||
get isOdd = self::E3|get#isOdd;
|
||||
get isEven = self::E3|get#isEven;
|
||||
}
|
||||
static method num() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
^" in null;
|
||||
}
|
||||
static method ceil() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E1|ceil(#this);
|
||||
static method E2|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Ok.
|
||||
^" in null;
|
||||
}
|
||||
function floor() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|ceil(#this);
|
||||
static method E2|floor(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int floor() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
}
|
||||
static method isEven() → invalid-type {
|
||||
core::bool get;
|
||||
function isOdd() → Never
|
||||
return throw 42;
|
||||
core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
bool get isEven => throw 42; // Ok.
|
||||
^^^";
|
||||
function isEven() → Never
|
||||
return throw 42;
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#floor(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|floor(#this);
|
||||
static method E3|get#isOdd(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method E3|get#isEven(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
extension E1 on int {}
|
||||
|
||||
show num() {}
|
||||
|
||||
extension E2 on int {}
|
||||
|
||||
show num;
|
||||
hide ceil() {}
|
||||
|
||||
extension E3 on int {}
|
||||
|
||||
hide isEven() {}
|
||||
extension E1 on int show num {
|
||||
int ceil() {}
|
||||
}
|
||||
extension E2 on int show num hide ceil {
|
||||
int ceil() {}
|
||||
int floor() {}
|
||||
}
|
||||
extension E3 on int hide isEven {
|
||||
bool get isOdd => throw 42;
|
||||
bool get isEven => throw 42;
|
||||
}
|
||||
main() {}
|
||||
|
|
|
@ -2,140 +2,58 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Error.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Ok.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int floor() {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
method ceil = self::E1|ceil;
|
||||
tearoff ceil = self::E1|get#ceil;
|
||||
}
|
||||
extension E2 on core::int {
|
||||
method ceil = self::E2|ceil;
|
||||
tearoff ceil = self::E2|get#ceil;
|
||||
method floor = self::E2|floor;
|
||||
tearoff floor = self::E2|get#floor;
|
||||
}
|
||||
extension E3 on core::int {
|
||||
get isOdd = self::E3|get#isOdd;
|
||||
get isEven = self::E3|get#isEven;
|
||||
}
|
||||
static method num() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
^" in null;
|
||||
}
|
||||
static method ceil() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E1|ceil(#this);
|
||||
static method E2|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Ok.
|
||||
^" in null;
|
||||
}
|
||||
function floor() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|ceil(#this);
|
||||
static method E2|floor(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int floor() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
}
|
||||
static method isEven() → invalid-type {
|
||||
core::bool get;
|
||||
function isOdd() → Never
|
||||
return throw 42;
|
||||
core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
bool get isEven => throw 42; // Ok.
|
||||
^^^";
|
||||
function isEven() → Never
|
||||
return throw 42;
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#floor(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|floor(#this);
|
||||
static method E3|get#isOdd(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method E3|get#isEven(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -1,78 +1,36 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
method ceil = self::E1|ceil;
|
||||
tearoff ceil = self::E1|get#ceil;
|
||||
}
|
||||
extension E2 on core::int {
|
||||
method ceil = self::E2|ceil;
|
||||
tearoff ceil = self::E2|get#ceil;
|
||||
method floor = self::E2|floor;
|
||||
tearoff floor = self::E2|get#floor;
|
||||
}
|
||||
extension E3 on core::int {
|
||||
get isOdd = self::E3|get#isOdd;
|
||||
get isEven = self::E3|get#isEven;
|
||||
}
|
||||
static method num() → invalid-type
|
||||
static method E1|ceil(lowered final core::int #this) → core::int
|
||||
;
|
||||
static method ceil() → invalid-type
|
||||
static method E1|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E1|ceil(#this);
|
||||
static method E2|ceil(lowered final core::int #this) → core::int
|
||||
;
|
||||
static method isEven() → invalid-type
|
||||
static method E2|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|ceil(#this);
|
||||
static method E2|floor(lowered final core::int #this) → core::int
|
||||
;
|
||||
static method E2|get#floor(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|floor(#this);
|
||||
static method E3|get#isOdd(lowered final core::int #this) → core::bool
|
||||
;
|
||||
static method E3|get#isEven(lowered final core::int #this) → core::bool
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
||||
|
|
|
@ -2,140 +2,58 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
|
||||
// extension E1 on int show num {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
|
||||
// Try adding an empty body.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
|
||||
// extension E1 on int show num {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
|
||||
// extension E3 on int hide isEven {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Error.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
|
||||
// extension E2 on int show num hide ceil {
|
||||
// ^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int ceil() {} // Ok.
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
// int floor() {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
|
||||
// bool get isOdd => throw 42; // Error.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
|
||||
// Try adding a parameter list to the function declaration.
|
||||
// bool get isEven => throw 42; // Ok.
|
||||
// ^^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1 on core::int {
|
||||
method ceil = self::E1|ceil;
|
||||
tearoff ceil = self::E1|get#ceil;
|
||||
}
|
||||
extension E2 on core::int {
|
||||
method ceil = self::E2|ceil;
|
||||
tearoff ceil = self::E2|get#ceil;
|
||||
method floor = self::E2|floor;
|
||||
tearoff floor = self::E2|get#floor;
|
||||
}
|
||||
extension E3 on core::int {
|
||||
get isOdd = self::E3|get#isOdd;
|
||||
get isEven = self::E3|get#isEven;
|
||||
}
|
||||
static method num() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
^" in null;
|
||||
}
|
||||
static method ceil() → invalid-type {
|
||||
function ceil() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
static method E1|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E1|ceil(#this);
|
||||
static method E2|ceil(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int ceil() {} // Ok.
|
||||
^" in null;
|
||||
}
|
||||
function floor() → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#ceil(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|ceil(#this);
|
||||
static method E2|floor(lowered final core::int #this) → core::int {
|
||||
return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
|
||||
int floor() {} // Error.
|
||||
^" in null;
|
||||
}
|
||||
}
|
||||
static method isEven() → invalid-type {
|
||||
core::bool get;
|
||||
function isOdd() → Never
|
||||
return throw 42;
|
||||
core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
|
||||
bool get isEven => throw 42; // Ok.
|
||||
^^^";
|
||||
function isEven() → Never
|
||||
return throw 42;
|
||||
^" in null;
|
||||
}
|
||||
static method E2|get#floor(lowered final core::int #this) → () → core::int
|
||||
return () → core::int => self::E2|floor(#this);
|
||||
static method E3|get#isOdd(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method E3|get#isEven(lowered final core::int #this) → core::bool
|
||||
return throw 42;
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) 2021, 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 'dart:core' as prefixedCore;
|
||||
import 'dart:core';
|
||||
|
||||
extension type E0 on int hide operator * {}
|
||||
extension type E1 on int hide get isEven {}
|
||||
extension type E2<T> on List<T> hide set length {}
|
||||
extension type E3 on int hide num {}
|
||||
extension type E4 on List<int> hide prefixedCore.Iterable<int> {} // Error?
|
||||
extension type E5 on List hide prefixedCore.Iterable {} // Error?
|
||||
extension type E6 on List<int> hide Iterable<int> {}
|
||||
|
||||
abstract class A {
|
||||
A operator *(A other);
|
||||
}
|
||||
|
||||
class B<X> implements A {
|
||||
bool get foo => throw 42;
|
||||
A operator *(A other) => throw 42;
|
||||
}
|
||||
|
||||
class C extends B<int> {
|
||||
void set bar(int value) {}
|
||||
void baz() {}
|
||||
}
|
||||
|
||||
extension type E on C hide A, B<int>, operator *, get foo, set bar, baz {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,22 @@
|
|||
import 'dart:core' as prefixedCore;
|
||||
import 'dart:core';
|
||||
extension type E0 on int hide operator * {}
|
||||
extension type E1 on int hide get isEven {}
|
||||
extension type E2<T> on List<T> hide set length {}
|
||||
extension type E3 on int hide num {}
|
||||
extension type E4 on List<int> hide prefixedCore.Iterable<int> {}
|
||||
extension type E5 on List hide prefixedCore.Iterable {}
|
||||
extension type E6 on List<int> hide Iterable<int> {}
|
||||
abstract class A {
|
||||
A operator *(A other);
|
||||
}
|
||||
class B<X> implements A {
|
||||
bool get foo => throw 42;
|
||||
A operator *(A other) => throw 42;
|
||||
}
|
||||
class C extends B<int> {
|
||||
void set bar(int value) {}
|
||||
void baz() {}
|
||||
}
|
||||
extension type E on C hide A, B<int>, operator *, get foo, set bar, baz {}
|
||||
main() {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
;
|
||||
get foo() → core::bool
|
||||
;
|
||||
operator *(self::A other) → self::A
|
||||
;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
;
|
||||
set bar(core::int value) → void
|
||||
;
|
||||
method baz() → void
|
||||
;
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) 2021, 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 'dart:core' as prefixedCore;
|
||||
import 'dart:core';
|
||||
|
||||
extension type E0 on int show operator * {}
|
||||
extension type E1 on int show get isEven {}
|
||||
extension type E2<T> on List<T> show set length {}
|
||||
extension type E3 on int show num {}
|
||||
extension type E4 on List<int> show prefixedCore.Iterable<int> {} // Error?
|
||||
extension type E5 on List show prefixedCore.Iterable {} // Error?
|
||||
extension type E6 on List<int> show Iterable<int> {}
|
||||
|
||||
abstract class A {
|
||||
A operator *(A other);
|
||||
}
|
||||
|
||||
class B<X> implements A {
|
||||
bool get foo => throw 42;
|
||||
A operator *(A other) => throw 42;
|
||||
}
|
||||
|
||||
class C extends B<int> {
|
||||
void set bar(int value) {}
|
||||
void baz() {}
|
||||
}
|
||||
|
||||
extension type E on C show A, B<int>, operator *, get foo, set bar, baz {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,22 @@
|
|||
import 'dart:core' as prefixedCore;
|
||||
import 'dart:core';
|
||||
extension type E0 on int show operator * {}
|
||||
extension type E1 on int show get isEven {}
|
||||
extension type E2<T> on List<T> show set length {}
|
||||
extension type E3 on int show num {}
|
||||
extension type E4 on List<int> show prefixedCore.Iterable<int> {}
|
||||
extension type E5 on List show prefixedCore.Iterable {}
|
||||
extension type E6 on List<int> show Iterable<int> {}
|
||||
abstract class A {
|
||||
A operator *(A other);
|
||||
}
|
||||
class B<X> implements A {
|
||||
bool get foo => throw 42;
|
||||
A operator *(A other) => throw 42;
|
||||
}
|
||||
class C extends B<int> {
|
||||
void set bar(int value) {}
|
||||
void baz() {}
|
||||
}
|
||||
extension type E on C show A, B<int>, operator *, get foo, set bar, baz {}
|
||||
main() {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
;
|
||||
get foo() → core::bool
|
||||
;
|
||||
operator *(self::A other) → self::A
|
||||
;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
;
|
||||
set bar(core::int value) → void
|
||||
;
|
||||
method baz() → void
|
||||
;
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,46 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:core" as prefixedCore;
|
||||
import "dart:core";
|
||||
|
||||
abstract class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract operator *(self::A other) → self::A;
|
||||
}
|
||||
class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
get foo() → core::bool
|
||||
return throw 42;
|
||||
operator *(self::A other) → self::A
|
||||
return throw 42;
|
||||
}
|
||||
class C extends self::B<core::int> {
|
||||
synthetic constructor •() → self::C
|
||||
: super self::B::•()
|
||||
;
|
||||
set bar(core::int value) → void {}
|
||||
method baz() → void {}
|
||||
}
|
||||
extension type E0 on core::int {
|
||||
}
|
||||
extension type E1 on core::int {
|
||||
}
|
||||
extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
|
||||
}
|
||||
extension type E3 on core::int {
|
||||
}
|
||||
extension type E4 on core::List<core::int> {
|
||||
}
|
||||
extension type E5 on core::List<dynamic> {
|
||||
}
|
||||
extension type E6 on core::List<core::int> {
|
||||
}
|
||||
extension type E on self::C {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -27,11 +27,17 @@ constructor_tearoffs/issue46133: FormatterCrash
|
|||
constructor_tearoffs/issue47075: FormatterCrash
|
||||
dart2js/late_fields: FormatterCrash
|
||||
dart2js/late_statics: FormatterCrash
|
||||
extension_types/basic_show: FormatterCrash
|
||||
extension_types/keyword_in_show_hide_element: FormatterCrash
|
||||
extension_types/simple_getter_resolution: FormatterCrash
|
||||
extension_types/simple_method_resolution: FormatterCrash
|
||||
extension_types/simple_operator_resolution: FormatterCrash
|
||||
extension_types/simple_setter_resolution: FormatterCrash
|
||||
extension_types/simple_show_and_hide: FormatterCrash
|
||||
extension_types/simple_show_hide: FormatterCrash
|
||||
extension_types/simple_show_hide_conflicts: FormatterCrash
|
||||
extension_types/various_hide_elements: FormatterCrash
|
||||
extension_types/various_show_elements: FormatterCrash
|
||||
extensions/extension_constructor: FormatterCrash
|
||||
extensions/extension_field_with_type_parameter_usage: FormatterCrash
|
||||
extensions/issue38600: FormatterCrash
|
||||
|
|
Loading…
Reference in a new issue