From 8cd2068eabe0a79dcc73a9a15d3748523d74c48f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 28 May 2020 16:28:39 +0530 Subject: [PATCH] no doc version handling --- .../modules/staticAnalysisCommon.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts b/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts index e38d5fb4ed..f81d8210db 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts +++ b/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts @@ -1122,7 +1122,14 @@ function getTypeStringFromComponents(components: ABIParameter[]) { return typeString } +/** + * Get compiler version from compiler contract object + * This is used to redirect the user to specific version of Solidity documentation + * @param contractFiles compiled contract object + */ function getCompilerVersion(contractFiles: CompiledContractObj): string { + // Solidity documentation is not available for these versions + const noDocVersions = ['0.4.26', '0.5.16', '0.5.17'] let version = 'develop' const fileNames: string[] = Object.keys(contractFiles) const contracts = contractFiles[fileNames[0]] @@ -1130,7 +1137,11 @@ function getCompilerVersion(contractFiles: CompiledContractObj): string { const contract: CompiledContract = contracts[contractNames[0]] const metadata = JSON.parse(contract.metadata) const compilerVersion: string = metadata.compiler.version - if(!compilerVersion.includes('nightly')) version = 'v' + compilerVersion.split('+commit')[0] + if(!compilerVersion.includes('nightly')) { + const solVersion = compilerVersion.split('+commit')[0] + if(!noDocVersions.includes(solVersion)) + version = 'v' + solVersion + } return version }