Commit 188d4fd7 authored by Dave Hoover's avatar Dave Hoover

Extract noise to editor.hasFile; And a couple fixes

parent 41df6899
......@@ -45,7 +45,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
gatherImports(files, missingInputs, function(input, error) {
outputField.empty();
if (input === null) {
render.error(error);
renderer.error(error);
} else {
var optimize = queryParams.get().optimize;
compileJSON(input, optimize ? 1 : 0);
......@@ -122,7 +122,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
}
if (missingInputs !== undefined && missingInputs.length > 0)
this.compile(missingInputs);
compile(missingInputs);
else if (noFatalErrors && !hidingRHP())
renderer.contracts(data, editor.getValue());
}
......@@ -171,10 +171,10 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
while (importHints.length > 0) {
var m = importHints.pop();
if (m in files) continue;
if (editor.getFiles().indexOf(utils.fileKey(m)) !== -1) {
if (editor.hasFile(m)) {
files[m] = window.localStorage[utils.fileKey(m)];
reloop = true;
} else if (m.startsWith('./') && editor.getFiles().indexOf(utils.fileKey(m.slice(2))) !== -1) {
} else if (m.startsWith('./') && editor.hasFile(m.slice(2))) {
files[m] = window.localStorage[utils.fileKey(m.slice(2))];
reloop = true;
} else if (m in cachedRemoteFiles) {
......
......@@ -38,7 +38,10 @@ function Editor(loadingFromGist) {
this.resetSession = function() {
editor.setSession( sessions[SOL_CACHE_FILE] );
editor.focus();
};
this.hasFile = function(name) {
return this.getFiles().indexOf(utils.fileKey(name)) !== -1
};
this.getFiles = function() {
......
......@@ -66,7 +66,7 @@ function Renderer(web3, editor, compiler, updateFiles) {
});
}
$error.click(function(ev){
if (errFile != '' && errFile != editor.getCacheFile() && editor.getFiles().indexOf(utils.fileKey(errFile)) !== -1) {
if (errFile != '' && errFile != editor.getCacheFile() && editor.hasFile(errFile)) {
// Switch to file
editor.setCacheFile(errFile);
updateFiles();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment