|
|
@ -111,16 +111,17 @@ export class Compiler { |
|
|
|
return { error: 'Deferred import' } |
|
|
|
return { error: 'Deferred import' } |
|
|
|
} |
|
|
|
} |
|
|
|
let result: CompilationResult = {} |
|
|
|
let result: CompilationResult = {} |
|
|
|
|
|
|
|
let input |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (source && source.sources) { |
|
|
|
if (source && source.sources) { |
|
|
|
const { optimize, runs, evmVersion, language } = this.state |
|
|
|
const { optimize, runs, evmVersion, language } = this.state |
|
|
|
const input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) |
|
|
|
input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) |
|
|
|
result = JSON.parse(compiler.compile(input, { import: missingInputsCallback })) |
|
|
|
result = JSON.parse(compiler.compile(input, { import: missingInputsCallback })) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (exception) { |
|
|
|
} catch (exception) { |
|
|
|
result = { error: { formattedMessage: 'Uncaught JavaScript exception:\n' + exception, severity: 'error', mode: 'panic' } } |
|
|
|
result = { error: { formattedMessage: 'Uncaught JavaScript exception:\n' + exception, severity: 'error', mode: 'panic' } } |
|
|
|
} |
|
|
|
} |
|
|
|
this.onCompilationFinished(result, missingInputs, source) |
|
|
|
this.onCompilationFinished(result, missingInputs, source, input, this.state.currentVersion) |
|
|
|
} |
|
|
|
} |
|
|
|
this.onCompilerLoaded(compiler.version()) |
|
|
|
this.onCompilerLoaded(compiler.version()) |
|
|
|
} |
|
|
|
} |
|
|
@ -133,7 +134,7 @@ export class Compiler { |
|
|
|
* @param source Source |
|
|
|
* @param source Source |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
onCompilationFinished (data: CompilationResult, missingInputs?: string[], source?: SourceWithTarget): void { |
|
|
|
onCompilationFinished (data: CompilationResult, missingInputs?: string[], source?: SourceWithTarget, input?, version?): void { |
|
|
|
let noFatalErrors = true // ie warnings are ok
|
|
|
|
let noFatalErrors = true // ie warnings are ok
|
|
|
|
|
|
|
|
|
|
|
|
const checkIfFatalError = (error: CompilationError) => { |
|
|
|
const checkIfFatalError = (error: CompilationError) => { |
|
|
@ -159,7 +160,7 @@ export class Compiler { |
|
|
|
source: source |
|
|
|
source: source |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.event.trigger('compilationFinished', [true, data, source]) |
|
|
|
this.event.trigger('compilationFinished', [true, data, source, input, version]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -182,16 +183,17 @@ export class Compiler { |
|
|
|
return { error: 'Deferred import' } |
|
|
|
return { error: 'Deferred import' } |
|
|
|
} |
|
|
|
} |
|
|
|
let result: CompilationResult = {} |
|
|
|
let result: CompilationResult = {} |
|
|
|
|
|
|
|
let input |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (source && source.sources) { |
|
|
|
if (source && source.sources) { |
|
|
|
const { optimize, runs, evmVersion, language } = this.state |
|
|
|
const { optimize, runs, evmVersion, language } = this.state |
|
|
|
const input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) |
|
|
|
input = compilerInput(source.sources, { optimize, runs, evmVersion, language }) |
|
|
|
result = JSON.parse(remoteCompiler.compile(input, { import: missingInputsCallback })) |
|
|
|
result = JSON.parse(remoteCompiler.compile(input, { import: missingInputsCallback })) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (exception) { |
|
|
|
} catch (exception) { |
|
|
|
result = { error: { formattedMessage: 'Uncaught JavaScript exception:\n' + exception, severity: 'error', mode: 'panic' } } |
|
|
|
result = { error: { formattedMessage: 'Uncaught JavaScript exception:\n' + exception, severity: 'error', mode: 'panic' } } |
|
|
|
} |
|
|
|
} |
|
|
|
this.onCompilationFinished(result, missingInputs, source) |
|
|
|
this.onCompilationFinished(result, missingInputs, source, input, version) |
|
|
|
} |
|
|
|
} |
|
|
|
this.onCompilerLoaded(version) |
|
|
|
this.onCompilerLoaded(version) |
|
|
|
} |
|
|
|
} |
|
|
@ -273,7 +275,7 @@ export class Compiler { |
|
|
|
sources = jobs[data.job].sources |
|
|
|
sources = jobs[data.job].sources |
|
|
|
delete jobs[data.job] |
|
|
|
delete jobs[data.job] |
|
|
|
} |
|
|
|
} |
|
|
|
this.onCompilationFinished(result, data.missingInputs, sources) |
|
|
|
this.onCompilationFinished(result, data.missingInputs, sources, data.input, this.state.currentVersion) |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|