no doc version handling

pull/5370/head
aniket-engg 5 years ago committed by Aniket
parent 164959003c
commit 8cd2068eab
  1. 13
      remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts

@ -1122,7 +1122,14 @@ function getTypeStringFromComponents(components: ABIParameter[]) {
return typeString 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 { 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' let version = 'develop'
const fileNames: string[] = Object.keys(contractFiles) const fileNames: string[] = Object.keys(contractFiles)
const contracts = contractFiles[fileNames[0]] const contracts = contractFiles[fileNames[0]]
@ -1130,7 +1137,11 @@ function getCompilerVersion(contractFiles: CompiledContractObj): string {
const contract: CompiledContract = contracts[contractNames[0]] const contract: CompiledContract = contracts[contractNames[0]]
const metadata = JSON.parse(contract.metadata) const metadata = JSON.parse(contract.metadata)
const compilerVersion: string = metadata.compiler.version 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 return version
} }

Loading…
Cancel
Save