added runs for compiler

pull/460/head
aniket-engg 4 years ago committed by Aniket
parent aac57736fc
commit d50bd16839
  1. 2
      libs/remix-solidity/src/compiler/compiler-input.ts
  2. 11
      libs/remix-solidity/src/compiler/compiler.ts
  3. 2
      libs/remix-solidity/src/compiler/types.ts

@ -9,7 +9,7 @@ export default (sources: Source, opts: CompilerInputOptions): string => {
settings: {
optimizer: {
enabled: opts.optimize === true || opts.optimize === 1,
runs: 200
runs: opts.runs
},
libraries: opts.libraries,
outputSelection: {

@ -23,6 +23,7 @@ export class Compiler {
worker: null,
currentVersion: null,
optimize: false,
runs: 200,
evmVersion: null,
language: 'Solidity',
compilationStartTime: null,
@ -109,7 +110,8 @@ export class Compiler {
let result: CompilationResult = {}
try {
if(source && source.sources) {
const input = compilerInput(source.sources, {optimize: this.state.optimize, evmVersion: this.state.evmVersion, language: this.state.language})
const {optimize, runs, evmVersion, language} = this.state
const input = compilerInput(source.sources, {optimize, runs, evmVersion, language})
result = JSON.parse(compiler.compile(input, { import: missingInputsCallback }))
}
} catch (exception) {
@ -247,15 +249,12 @@ export class Compiler {
this.state.compileJSON = (source: SourceWithTarget) => {
if(source && source.sources) {
const {optimize, runs, evmVersion, language} = this.state
jobs.push({sources: source})
this.state.worker.postMessage({
cmd: 'compile',
job: jobs.length - 1,
input: compilerInput(source.sources, {
optimize: this.state.optimize,
evmVersion: this.state.evmVersion,
language: this.state.language
})
input: compilerInput(source.sources, {optimize, runs, evmVersion, language})
})
}
}

@ -143,6 +143,7 @@ export interface Source {
export interface CompilerInputOptions {
optimize: boolean | number,
runs: number,
libraries?: {
[fileName: string]: Record<string, string>
},
@ -159,6 +160,7 @@ export interface CompilerState {
worker: any,
currentVersion: string| null| undefined,
optimize: boolean,
runs: number
evmVersion: EVMVersion| null,
language: Language,
compilationStartTime: number| null,

Loading…
Cancel
Save