mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 20:37:46 -05:00
Update preferConstRule to use getCombined*X*Flags
now that they are exported.
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
"ts-node": "latest",
|
||||
"tsd": "latest",
|
||||
"tslint": "next",
|
||||
"typescript": "2.1.0-dev.20160906"
|
||||
"typescript": "next"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "jake tests",
|
||||
|
||||
@@ -21,32 +21,12 @@ function walkUpBindingElementsAndPatterns(node: ts.Node): ts.Node {
|
||||
return node;
|
||||
}
|
||||
|
||||
function getCombinedNodeFlags(node: ts.Node): ts.NodeFlags {
|
||||
node = walkUpBindingElementsAndPatterns(node);
|
||||
|
||||
let flags = node.flags;
|
||||
if (node.kind === ts.SyntaxKind.VariableDeclaration) {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
if (node && node.kind === ts.SyntaxKind.VariableDeclarationList) {
|
||||
flags |= node.flags;
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
if (node && node.kind === ts.SyntaxKind.VariableStatement) {
|
||||
flags |= node.flags;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
function isLet(node: ts.Node) {
|
||||
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Let);
|
||||
return !!(ts.getCombinedNodeFlags(node) & ts.NodeFlags.Let);
|
||||
}
|
||||
|
||||
function isExported(node: ts.Node) {
|
||||
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Export);
|
||||
return !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export);
|
||||
}
|
||||
|
||||
function isAssignmentOperator(token: ts.SyntaxKind): boolean {
|
||||
|
||||
Reference in New Issue
Block a user