mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
isMinusPrefixUnaryExpression() -> isPrefixUnaryExpression() after code review
This commit is contained in:
@@ -21865,7 +21865,7 @@ namespace ts {
|
||||
diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
|
||||
}
|
||||
if (diagnosticMessage) {
|
||||
const withMinus = isMinusPrefixUnaryExpression(node.parent);
|
||||
const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.MinusToken;
|
||||
const literal = `${withMinus ? "-" : ""}0o${node.text}`;
|
||||
return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal);
|
||||
}
|
||||
|
||||
@@ -742,9 +742,8 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isMinusPrefixUnaryExpression(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.PrefixUnaryExpression &&
|
||||
(node as PrefixUnaryExpression).operator === SyntaxKind.MinusToken;
|
||||
export function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression {
|
||||
return node.kind === SyntaxKind.PrefixUnaryExpression;
|
||||
}
|
||||
|
||||
// Warning: This has the same semantics as the forEach family of functions,
|
||||
|
||||
Reference in New Issue
Block a user