mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode e558dc6ea73a75bd69d7a0b485f0e7e4194c66bf (#6864)
This commit is contained in:
@@ -19,18 +19,23 @@ class AbstractGlobalsRuleWalker extends Lint.RuleWalker {
|
||||
const checker = this.program.getTypeChecker();
|
||||
const symbol = checker.getSymbolAtLocation(node);
|
||||
if (symbol) {
|
||||
const valueDeclaration = symbol.valueDeclaration;
|
||||
if (valueDeclaration) {
|
||||
const parent = valueDeclaration.parent;
|
||||
if (parent) {
|
||||
const sourceFile = parent.getSourceFile();
|
||||
if (sourceFile) {
|
||||
const fileName = sourceFile.fileName;
|
||||
if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) {
|
||||
this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`);
|
||||
const declarations = symbol.declarations;
|
||||
if (Array.isArray(declarations) && symbol.declarations.some(declaration => {
|
||||
if (declaration) {
|
||||
const parent = declaration.parent;
|
||||
if (parent) {
|
||||
const sourceFile = parent.getSourceFile();
|
||||
if (sourceFile) {
|
||||
const fileName = sourceFile.fileName;
|
||||
if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})) {
|
||||
this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,18 +30,24 @@ export abstract class AbstractGlobalsRuleWalker extends Lint.RuleWalker {
|
||||
const checker = this.program.getTypeChecker();
|
||||
const symbol = checker.getSymbolAtLocation(node);
|
||||
if (symbol) {
|
||||
const valueDeclaration = symbol.valueDeclaration;
|
||||
if (valueDeclaration) {
|
||||
const parent = valueDeclaration.parent;
|
||||
if (parent) {
|
||||
const sourceFile = parent.getSourceFile();
|
||||
if (sourceFile) {
|
||||
const fileName = sourceFile.fileName;
|
||||
if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) {
|
||||
this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`);
|
||||
const declarations = symbol.declarations;
|
||||
if (Array.isArray(declarations) && symbol.declarations.some(declaration => {
|
||||
if (declaration) {
|
||||
const parent = declaration.parent;
|
||||
if (parent) {
|
||||
const sourceFile = parent.getSourceFile();
|
||||
if (sourceFile) {
|
||||
const fileName = sourceFile.fileName;
|
||||
if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
})) {
|
||||
this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user