aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler/src/compiler.ts
diff options
context:
space:
mode:
authorF. Eugene Aumson <gene@aumson.org>2018-08-14 14:09:07 +0800
committerF. Eugene Aumson <gene@aumson.org>2018-08-15 02:42:06 +0800
commit783bc873db04a9f712300e57a346ce803b85590c (patch)
tree818a8de4950c5139688ab3f0004bb0e02cac0681 /packages/sol-compiler/src/compiler.ts
parent478bf14289d1555753353b837e4efc63b2c776fe (diff)
downloaddexon-sol-tools-783bc873db04a9f712300e57a346ce803b85590c.tar
dexon-sol-tools-783bc873db04a9f712300e57a346ce803b85590c.tar.gz
dexon-sol-tools-783bc873db04a9f712300e57a346ce803b85590c.tar.bz2
dexon-sol-tools-783bc873db04a9f712300e57a346ce803b85590c.tar.lz
dexon-sol-tools-783bc873db04a9f712300e57a346ce803b85590c.tar.xz
dexon-sol-tools-783bc873db04a9f712300e57a346ce803b85590c.tar.zst
dexon-sol-tools-783bc873db04a9f712300e57a346ce803b85590c.zip
extract method _verifyAndPersistCompilationAsync()
Diffstat (limited to 'packages/sol-compiler/src/compiler.ts')
-rw-r--r--packages/sol-compiler/src/compiler.ts19
1 files changed, 18 insertions, 1 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 83caa2a19..f301b697b 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -176,6 +176,23 @@ export class Compiler {
settings: this._compilerSettings,
};
const compiled: solc.StandardOutput = this._compile(solcInstance, standardInput);
+ return this._verifyAndPersistCompilationAsync(
+ contractSource,
+ contractName,
+ fullSolcVersion,
+ compiled,
+ sourceTreeHashHex,
+ currentArtifactIfExists,
+ );
+ }
+ private async _verifyAndPersistCompilationAsync(
+ contractSource: { path: string },
+ contractName: string,
+ fullSolcVersion: string,
+ compiled: solc.StandardOutput,
+ sourceTreeHashHex: string,
+ currentArtifactIfExists: ContractArtifact | void,
+ ): Promise<void> {
const compiledData = compiled.contracts[contractSource.path][contractName];
if (_.isUndefined(compiledData)) {
throw new Error(
@@ -251,7 +268,7 @@ export class Compiler {
const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
logUtils.log(chalk.red(normalizedErrMsg));
});
- throw new Error("Compilation errors encountered");
+ throw new Error('Compilation errors encountered');
} else {
warnings.forEach(warning => {
const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);