aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-resolver/src/resolvers/fallthrough_resolver.ts')
-rw-r--r--packages/sol-resolver/src/resolvers/fallthrough_resolver.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts b/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
new file mode 100644
index 000000000..8f6af9be0
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
@@ -0,0 +1,21 @@
+import * as _ from 'lodash';
+
+import { ContractSource } from '../types';
+
+import { Resolver } from './resolver';
+
+export class FallthroughResolver extends Resolver {
+ private _resolvers: Resolver[] = [];
+ public appendResolver(resolver: Resolver): void {
+ this._resolvers.push(resolver);
+ }
+ public resolveIfExists(importPath: string): ContractSource | undefined {
+ for (const resolver of this._resolvers) {
+ const contractSourceIfExists = resolver.resolveIfExists(importPath);
+ if (!_.isUndefined(contractSourceIfExists)) {
+ return contractSourceIfExists;
+ }
+ }
+ return undefined;
+ }
+}