From db6de490b21b6df8dd414c58657c3b48c39dd6d0 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 13 Aug 2018 23:59:00 -0700 Subject: corrected whitespace (no functional changes) --- packages/sol-compiler/src/compiler.ts | 80 ++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 39 deletions(-) (limited to 'packages/sol-compiler') 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) { -- cgit v1.2.3