json parsing is fixed

pull/5370/head
lianahus 3 years ago committed by yann300
parent 3aba8f5f02
commit 946e853258
  1. 57
      apps/remix-ide/contracts/solidity_compiler_config.json
  2. 20
      libs/remix-solidity/src/compiler/compiler.ts
  3. 4
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -1,65 +1,16 @@
{
"language": "Solidity",
"settings": {
"remappings": [
":g=/dir"
],
"optimizer": {
"enabled": true,
"runs": 200,
"details": {
"peephole": true,
"inliner": true,
"jumpdestRemover": true,
"orderLiterals": false,
"deduplicate": false,
"cse": false,
"constantOptimizer": false,
"yul": false
}
},
"evmVersion": "byzantium",
"viaIR": true,
"debug": {
"revertStrings": "default"
},
"metadata": {
"useLiteralContent": true,
"bytecodeHash": "ipfs"
"runs": 260
},
"outputSelection": {
"*": {
"*": [
"metadata",
"evm.bytecode",
"evm.bytecode.sourceMap"
],
"": [
"ast"
]
},
"def": {
"MyContract": [
"abi",
"evm.bytecode.opcodes"
]
"": ["ast"],
"*": ["abi", "metadata", "devdoc", "userdoc", "storageLayout", "evm.legacyAssembly", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "evm.gasEstimates", "evm.assembly"]
}
},
"modelChecker": {
"divModNoSlacks": false,
"engine": "chc",
"showUnproved": true,
"solvers": [
"cvc4",
"smtlib2",
"z3"
],
"targets": [
"underflow",
"overflow",
"assert"
],
"timeout": 20000
}
"evmVersion": "byzantium"
}
}

@ -113,7 +113,7 @@ export class Compiler {
return { error: 'Deferred import' }
}
let result: CompilationResult = {}
let input
let input = ""
try {
if (source && source.sources) {
const { optimize, runs, evmVersion, language, useFileConfiguration, configFileContent } = this.state
@ -124,6 +124,7 @@ export class Compiler {
input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
}
console.log("input = ", input)
result = JSON.parse(compiler.compile(input, { import: missingInputsCallback }))
}
} catch (exception) {
@ -191,7 +192,7 @@ export class Compiler {
return { error: 'Deferred import' }
}
let result: CompilationResult = {}
let input: string
let input = ""
try {
if (source && source.sources) {
const { optimize, runs, evmVersion, language, useFileConfiguration, configFileContent } = this.state
@ -305,12 +306,17 @@ export class Compiler {
if (source && source.sources) {
const { optimize, runs, evmVersion, language, useFileConfiguration, configFileContent } = this.state
jobs.push({ sources: source })
let input
let input = ""
if (useFileConfiguration) {
input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent))
} else {
input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
try {
if (useFileConfiguration) {
input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent))
} else {
input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
}
} catch (exception) {
this.onCompilationFinished({ error: { formattedMessage: exception.messsage } })
return
}

@ -108,8 +108,8 @@ export class CompileTabLogic {
const sources = { [target]: { content } }
this.event.emit('removeAnnotations')
this.event.emit('startingCompilation')
this.api.readFile(this.configFilePath).then( content => {
this.compiler.set('configFileContent', content)
this.api.readFile(this.configFilePath).then( contentConfig => {
this.compiler.set('configFileContent', contentConfig)
})
// setTimeout fix the animation on chrome... (animation triggered by 'staringCompilation')
setTimeout(() => { this.compiler.compile(sources, target); resolve(true) }, 100)

Loading…
Cancel
Save