Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
0fcf0ca0
Commit
0fcf0ca0
authored
Sep 06, 2016
by
chriseth
Committed by
GitHub
Sep 06, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #213 from ethereum/fixsource
Parse source into json for event.
parents
cb05660b
ff13c102
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
compiler-worker.js
src/app/compiler-worker.js
+1
-1
compiler.js
src/app/compiler.js
+13
-4
No files found.
src/app/compiler-worker.js
View file @
0fcf0ca0
...
...
@@ -34,7 +34,7 @@ module.exports = function (self) {
break
;
case
'compile'
:
missingInputs
.
length
=
0
;
self
.
postMessage
({
cmd
:
'compiled'
,
data
:
compileJSON
(
data
.
source
,
data
.
optimize
),
missingInputs
:
missingInputs
,
source
:
data
.
source
});
self
.
postMessage
({
cmd
:
'compiled'
,
job
:
data
.
job
,
data
:
compileJSON
(
data
.
source
,
data
.
optimize
),
missingInputs
:
missingInputs
});
break
;
}
},
false
);
...
...
src/app/compiler.js
View file @
0fcf0ca0
...
...
@@ -52,7 +52,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
files
[
utils
.
fileNameFromKey
(
editor
.
getCacheFile
())]
=
input
;
gatherImports
(
files
,
missingInputs
,
function
(
input
,
error
)
{
if
(
input
===
null
)
{
self
.
event
.
trigger
(
'compilationFinished'
,
[
false
,
[
error
],
editor
.
getValue
()
]);
self
.
event
.
trigger
(
'compilationFinished'
,
[
false
,
[
error
],
files
]);
}
else
{
var
optimize
=
queryParams
.
get
().
optimize
;
compileJSON
(
input
,
optimize
?
1
:
0
);
...
...
@@ -144,7 +144,9 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
function
loadInternal
(
url
)
{
delete
window
.
Module
;
// Set a safe fallback until the new one is loaded
setCompileJSON
(
function
(
source
,
optimize
)
{
compilationFinished
(
'{}'
);
});
setCompileJSON
(
function
(
source
,
optimize
)
{
compilationFinished
({
error
:
'Compiler not yet loaded.'
});
});
var
newScript
=
document
.
createElement
(
'script'
);
newScript
.
type
=
'text/javascript'
;
...
...
@@ -164,6 +166,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
worker
.
terminate
();
}
worker
=
webworkify
(
require
(
'./compiler-worker.js'
));
var
jobs
=
[];
worker
.
addEventListener
(
'message'
,
function
(
msg
)
{
var
data
=
msg
.
data
;
switch
(
data
.
cmd
)
{
...
...
@@ -178,7 +181,12 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
}
catch
(
exception
)
{
result
=
{
'error'
:
'Invalid JSON output from the compiler: '
+
exception
};
}
compilationFinished
(
result
,
data
.
missingInputs
,
data
.
source
);
var
sources
=
{};
if
(
data
.
job
in
jobs
!==
undefined
)
{
sources
=
jobs
[
data
.
job
].
sources
;
delete
jobs
[
data
.
job
];
}
compilationFinished
(
result
,
data
.
missingInputs
,
sources
);
break
;
}
});
...
...
@@ -189,7 +197,8 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
compilationFinished
({
error
:
'Worker error: '
+
msg
.
data
});
});
compileJSON
=
function
(
source
,
optimize
)
{
worker
.
postMessage
({
cmd
:
'compile'
,
source
:
JSON
.
stringify
(
source
),
optimize
:
optimize
});
jobs
.
push
({
sources
:
source
});
worker
.
postMessage
({
cmd
:
'compile'
,
job
:
jobs
.
length
-
1
,
source
:
JSON
.
stringify
(
source
),
optimize
:
optimize
});
};
worker
.
postMessage
({
cmd
:
'loadVersion'
,
data
:
url
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment