add back missing class type parsing
This commit is contained in:
parent
ac4fdac04a
commit
78923eae15
21
acorn.js
21
acorn.js
@ -3581,6 +3581,13 @@
|
|||||||
next();
|
next();
|
||||||
node.id = tokType === _name ? parseIdent() : isStatement ? unexpected() : null;
|
node.id = tokType === _name ? parseIdent() : isStatement ? unexpected() : null;
|
||||||
node.superClass = eat(_extends) ? parseExprSubscripts() : null;
|
node.superClass = eat(_extends) ? parseExprSubscripts() : null;
|
||||||
|
if (node.superClass && tokType === _lt) {
|
||||||
|
node.superTypeParameters = parseTypeParameterInstantiation();
|
||||||
|
}
|
||||||
|
if (tokType === _name && tokVal === "implements") {
|
||||||
|
next();
|
||||||
|
node.implements = parseClassImplements();
|
||||||
|
}
|
||||||
var classBody = startNode();
|
var classBody = startNode();
|
||||||
classBody.body = [];
|
classBody.body = [];
|
||||||
expect(_braceL);
|
expect(_braceL);
|
||||||
@ -3617,8 +3624,20 @@
|
|||||||
} else {
|
} else {
|
||||||
method.kind = "";
|
method.kind = "";
|
||||||
}
|
}
|
||||||
|
if (tokType === _colon) {
|
||||||
|
method.typeAnnotation = parseTypeAnnotation();
|
||||||
|
semicolon();
|
||||||
|
classBody.body.push(finishNode(method, "ClassProperty"));
|
||||||
|
} else {
|
||||||
|
var typeParameters;
|
||||||
|
if (tokType === _lt) {
|
||||||
|
typeParameters = parseTypeParameterDeclaration();
|
||||||
|
}
|
||||||
method.value = parseMethod(isGenerator, isAsync);
|
method.value = parseMethod(isGenerator, isAsync);
|
||||||
|
method.value.typeParameters = typeParameters;
|
||||||
classBody.body.push(finishNode(method, "MethodDefinition"));
|
classBody.body.push(finishNode(method, "MethodDefinition"));
|
||||||
|
eat(_semi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
node.body = finishNode(classBody, "ClassBody");
|
node.body = finishNode(classBody, "ClassBody");
|
||||||
return finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
|
return finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
|
||||||
@ -4276,7 +4295,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseObjectPropertyKey() {
|
function parseObjectPropertyKey() {
|
||||||
return (tokType === _num || tokType === _string) ? parseExprAtom() : parseIdent(true);;
|
return (tokType === _num || tokType === _string) ? parseExprAtom() : parseIdent(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseObjectTypeIndexer(node, isStatic) {
|
function parseObjectTypeIndexer(node, isStatic) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user