gitea push
This commit is contained in:
+28
-11
@@ -1946,7 +1946,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
}
|
||||
flowParseDeclareVariable(node) {
|
||||
this.next();
|
||||
node.id = this.flowParseTypeAnnotatableIdentifier(true);
|
||||
node.id = this.flowParseTypeAnnotatableIdentifier();
|
||||
this.scope.declareName(node.id.name, 5, node.id.loc.start);
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "DeclareVariable");
|
||||
@@ -2120,9 +2120,14 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
reservedType: word
|
||||
});
|
||||
}
|
||||
flowParseRestrictedIdentifier(liberal, declaration) {
|
||||
flowParseRestrictedIdentifierName(liberal, declaration) {
|
||||
this.checkReservedType(this.state.value, this.state.startLoc, declaration);
|
||||
return this.parseIdentifier(liberal);
|
||||
return this.parseIdentifierName(liberal);
|
||||
}
|
||||
flowParseRestrictedIdentifier(liberal, declaration) {
|
||||
const node = this.startNode();
|
||||
const name = this.flowParseRestrictedIdentifierName(liberal, declaration);
|
||||
return this.createIdentifier(node, name);
|
||||
}
|
||||
flowParseTypeAlias(node) {
|
||||
node.id = this.flowParseRestrictedIdentifier(false, true);
|
||||
@@ -2156,14 +2161,21 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "OpaqueType");
|
||||
}
|
||||
flowParseTypeParameterBound() {
|
||||
if (this.match(14) || this.isContextual(81)) {
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
node.typeAnnotation = this.flowParseType();
|
||||
return this.finishNode(node, "TypeAnnotation");
|
||||
}
|
||||
}
|
||||
flowParseTypeParameter(requireDefault = false) {
|
||||
const nodeStartLoc = this.state.startLoc;
|
||||
const node = this.startNode();
|
||||
const variance = this.flowParseVariance();
|
||||
const ident = this.flowParseTypeAnnotatableIdentifier();
|
||||
node.name = ident.name;
|
||||
node.name = this.flowParseRestrictedIdentifierName();
|
||||
node.variance = variance;
|
||||
node.bound = ident.typeAnnotation;
|
||||
node.bound = this.flowParseTypeParameterBound();
|
||||
if (this.match(29)) {
|
||||
this.eat(29);
|
||||
node.default = this.flowParseType();
|
||||
@@ -2860,13 +2872,13 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
node.typeAnnotation = this.flowParseTypeInitialiser();
|
||||
return this.finishNode(node, "TypeAnnotation");
|
||||
}
|
||||
flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) {
|
||||
const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier();
|
||||
flowParseTypeAnnotatableIdentifier() {
|
||||
const node = this.startNode();
|
||||
const name = this.parseIdentifierName();
|
||||
if (this.match(14)) {
|
||||
ident.typeAnnotation = this.flowParseTypeAnnotation();
|
||||
this.resetEndLocation(ident);
|
||||
node.typeAnnotation = this.flowParseTypeAnnotation();
|
||||
}
|
||||
return ident;
|
||||
return this.createIdentifier(node, name);
|
||||
}
|
||||
typeCastToParameter(node) {
|
||||
node.expression.typeAnnotation = node.typeAnnotation;
|
||||
@@ -5093,6 +5105,7 @@ class CommentsParser extends BaseParser {
|
||||
adjustInnerComments(node, node.properties, commentWS);
|
||||
break;
|
||||
case "CallExpression":
|
||||
case "NewExpression":
|
||||
case "OptionalCallExpression":
|
||||
adjustInnerComments(node, node.arguments, commentWS);
|
||||
break;
|
||||
@@ -5105,6 +5118,7 @@ class CommentsParser extends BaseParser {
|
||||
case "ObjectMethod":
|
||||
case "ClassMethod":
|
||||
case "ClassPrivateMethod":
|
||||
case "TSTypeParameterDeclaration":
|
||||
adjustInnerComments(node, node.params, commentWS);
|
||||
break;
|
||||
case "ArrayExpression":
|
||||
@@ -5121,6 +5135,9 @@ class CommentsParser extends BaseParser {
|
||||
case "TSEnumBody":
|
||||
adjustInnerComments(node, node.members, commentWS);
|
||||
break;
|
||||
case "TSInterfaceBody":
|
||||
adjustInnerComments(node, node.body, commentWS);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (node.type === "RecordExpression") {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user