aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorF. Eugene Aumson <gene@aumson.org>2018-08-14 14:59:00 +0800
committerF. Eugene Aumson <gene@aumson.org>2018-08-15 02:42:06 +0800
commitdb6de490b21b6df8dd414c58657c3b48c39dd6d0 (patch)
treeb265aabf02043253a7362d5918f07cece27ead19
parent014d71d5ae4e6ec2f4841b5153d2116d3bbf25a6 (diff)
downloaddexon-sol-tools-db6de490b21b6df8dd414c58657c3b48c39dd6d0.tar
dexon-sol-tools-db6de490b21b6df8dd414c58657c3b48c39dd6d0.tar.gz
dexon-sol-tools-db6de490b21b6df8dd414c58657c3b48c39dd6d0.tar.bz2
dexon-sol-tools-db6de490b21b6df8dd414c58657c3b48c39dd6d0.tar.lz
dexon-sol-tools-db6de490b21b6df8dd414c58657c3b48c39dd6d0.tar.xz
dexon-sol-tools-db6de490b21b6df8dd414c58657c3b48c39dd6d0.tar.zst
dexon-sol-tools-db6de490b21b6df8dd414c58657c3b48c39dd6d0.zip
corrected whitespace (no functional changes)
-rw-r--r--packages/sol-compiler/src/compiler.ts80
1 files changed, 41 insertions, 39 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 63154f917..897ace9b6 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -154,46 +154,48 @@ export class Compiler {
} = {};
for (const contractName of contractNames) {
- const contractSource = this._resolver.resolve(contractName);
- contractData[contractSource.path] = {
- contractName,
- currentArtifactIfExists: await getContractArtifactIfExistsAsync(this._artifactsDir, contractName),
- sourceTreeHashHex: `0x${this._getSourceTreeHash(
- path.join(this._contractsDir, contractSource.path),
- ).toString('hex')}`,
- };
- let shouldCompile = false;
- if (_.isUndefined(contractData[contractSource.path].currentArtifactIfExists)) {
- shouldCompile = true;
- } else {
- const currentArtifact = contractData[contractSource.path].currentArtifactIfExists as ContractArtifact;
- const isUserOnLatestVersion = currentArtifact.schemaVersion === constants.LATEST_ARTIFACT_VERSION;
- const didCompilerSettingsChange = !_.isEqual(currentArtifact.compiler.settings, this._compilerSettings);
- const didSourceChange =
- currentArtifact.sourceTreeHashHex !== contractData[contractSource.path].sourceTreeHashHex;
- shouldCompile = !isUserOnLatestVersion || didCompilerSettingsChange || didSourceChange;
- }
- if (!shouldCompile) {
- continue;
- }
- let solcVersion = this._solcVersionIfExists;
- if (_.isUndefined(solcVersion)) {
- const solcVersionRange = parseSolidityVersionRange(contractSource.source);
- const availableCompilerVersions = _.keys(binPaths);
- solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange);
- }
- if (_.isUndefined(inputsByVersion[solcVersion])) {
- inputsByVersion[solcVersion] = {
- standardInput: {
- language: 'Solidity',
- sources: {},
- settings: this._compilerSettings,
- },
- contractsToCompile: [],
+ const contractSource = this._resolver.resolve(contractName);
+ contractData[contractSource.path] = {
+ contractName,
+ currentArtifactIfExists: await getContractArtifactIfExistsAsync(this._artifactsDir, contractName),
+ sourceTreeHashHex: `0x${this._getSourceTreeHash(
+ path.join(this._contractsDir, contractSource.path),
+ ).toString('hex')}`,
};
- }
- inputsByVersion[solcVersion].standardInput.sources[contractSource.path] = { content: contractSource.source };
- inputsByVersion[solcVersion].contractsToCompile.push(contractSource.path);
+ let shouldCompile = false;
+ if (_.isUndefined(contractData[contractSource.path].currentArtifactIfExists)) {
+ shouldCompile = true;
+ } else {
+ const currentArtifact = contractData[contractSource.path].currentArtifactIfExists as ContractArtifact;
+ const isUserOnLatestVersion = currentArtifact.schemaVersion === constants.LATEST_ARTIFACT_VERSION;
+ const didCompilerSettingsChange = !_.isEqual(currentArtifact.compiler.settings, this._compilerSettings);
+ const didSourceChange =
+ currentArtifact.sourceTreeHashHex !== contractData[contractSource.path].sourceTreeHashHex;
+ shouldCompile = !isUserOnLatestVersion || didCompilerSettingsChange || didSourceChange;
+ }
+ if (!shouldCompile) {
+ continue;
+ }
+ let solcVersion = this._solcVersionIfExists;
+ if (_.isUndefined(solcVersion)) {
+ const solcVersionRange = parseSolidityVersionRange(contractSource.source);
+ const availableCompilerVersions = _.keys(binPaths);
+ solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange);
+ }
+ if (_.isUndefined(inputsByVersion[solcVersion])) {
+ inputsByVersion[solcVersion] = {
+ standardInput: {
+ language: 'Solidity',
+ sources: {},
+ settings: this._compilerSettings,
+ },
+ contractsToCompile: [],
+ };
+ }
+ inputsByVersion[solcVersion].standardInput.sources[contractSource.path] = {
+ content: contractSource.source,
+ };
+ inputsByVersion[solcVersion].contractsToCompile.push(contractSource.path);
}
for (const solcVersion in inputsByVersion) {