aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-resolver
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-15 00:34:37 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-23 06:20:33 +0800
commit60b1fdd367101047d433d4b9c1c47925925296a2 (patch)
treeea5bac8544b92959bc3b71c7014d761a0f87a9a4 /packages/sol-resolver
parent842f2ea5cc75c66397597a21202f4b8cf3082ed6 (diff)
downloaddexon-sol-tools-60b1fdd367101047d433d4b9c1c47925925296a2.tar
dexon-sol-tools-60b1fdd367101047d433d4b9c1c47925925296a2.tar.gz
dexon-sol-tools-60b1fdd367101047d433d4b9c1c47925925296a2.tar.bz2
dexon-sol-tools-60b1fdd367101047d433d4b9c1c47925925296a2.tar.lz
dexon-sol-tools-60b1fdd367101047d433d4b9c1c47925925296a2.tar.xz
dexon-sol-tools-60b1fdd367101047d433d4b9c1c47925925296a2.tar.zst
dexon-sol-tools-60b1fdd367101047d433d4b9c1c47925925296a2.zip
Only look at *.sol files in NameResolver
Diffstat (limited to 'packages/sol-resolver')
-rw-r--r--packages/sol-resolver/src/resolvers/name_resolver.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts
index 76bed802e..586fad86a 100644
--- a/packages/sol-resolver/src/resolvers/name_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/name_resolver.ts
@@ -6,6 +6,8 @@ import { ContractSource } from '../types';
import { EnumerableResolver } from './enumerable_resolver';
+const SOLIDITY_FILE_EXTENSION = '.sol';
+
export class NameResolver extends EnumerableResolver {
private _contractsDir: string;
constructor(contractsDir: string) {
@@ -13,7 +15,6 @@ export class NameResolver extends EnumerableResolver {
this._contractsDir = contractsDir;
}
public resolveIfExists(lookupContractName: string): ContractSource | undefined {
- const SOLIDITY_FILE_EXTENSION = '.sol';
let contractSource: ContractSource | undefined;
const onFile = (filePath: string) => {
const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION);
@@ -32,7 +33,6 @@ export class NameResolver extends EnumerableResolver {
return contractSource;
}
public getAll(): ContractSource[] {
- const SOLIDITY_FILE_EXTENSION = '.sol';
const contractSources: ContractSource[] = [];
const onFile = (filePath: string) => {
const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION);
@@ -56,6 +56,9 @@ export class NameResolver extends EnumerableResolver {
throw new Error(`No directory found at ${dirPath}`);
}
for (const fileName of dirContents) {
+ if (!fileName.endsWith(SOLIDITY_FILE_EXTENSION)) {
+ continue;
+ }
const absoluteEntryPath = path.join(dirPath, fileName);
const isDirectory = fs.lstatSync(absoluteEntryPath).isDirectory();
const entryPath = path.relative(this._contractsDir, absoluteEntryPath);