Skip to content
Permalink
Browse files

[js] Fix indentation

  • Loading branch information...
pmurias committed Nov 1, 2018
1 parent 8a6c38b commit f460ad1a9c88e3fc332b64af28ffd74fade434cb
Showing with 23 additions and 23 deletions.
  1. +23 −23 src/vm/js/rakudo-library.js
@@ -14,43 +14,43 @@ nqp.run = function(code) {
let passedArgs;

nqp.args = function(calledFrom) {
if (calledFrom.parent === module) {
return passedArgs.map(arg => new nqp.NativeStrArg(arg));
}
return oldArgs(calledFrom);
if (calledFrom.parent === module) {
return passedArgs.map(arg => new nqp.NativeStrArg(arg));
}
return oldArgs(calledFrom);
};

const code = require('./rakudo.js');

const core = require('nqp-runtime/core.js');

module.exports = function(source) {
const tmpFile = tmp.tmpNameSync();
const tmpFile = tmp.tmpNameSync();

passedArgs = ['perl6-js', '--output', tmpFile, '--target=js', source];
passedArgs = ['perl6-js', '--output', tmpFile, '--target=js', source];

const oldWritefh = nqp.op.getstdout().constructor.prototype.$$writefh;
const output = [];
nqp.op.getstdout().constructor.prototype.$$writefh = function(buf) {
output.push(core.toRawBuffer(buf));
}
const oldWritefh = nqp.op.getstdout().constructor.prototype.$$writefh;
const output = [];
nqp.op.getstdout().constructor.prototype.$$writefh = function(buf) {
output.push(core.toRawBuffer(buf));
}

code();
code();

nqp.op.getstdout().constructor.prototype.$$writefh = oldWritefh;
const lines = Buffer.concat(output).toString().split(/\n/);
nqp.op.getstdout().constructor.prototype.$$writefh = oldWritefh;
const lines = Buffer.concat(output).toString().split(/\n/);

const loaded = [];
const loaded = [];

for (const line of lines) {
let match;
if (/^[A-Z0-9]{40}\0/.test(line)) {
} else if (match = line.match(/^load-unit: (.+)/)) {
loaded.push(match[1]);
} else {
}
for (const line of lines) {
let match;
if (/^[A-Z0-9]{40}\0/.test(line)) {
} else if (match = line.match(/^load-unit: (.+)/)) {
loaded.push(match[1]);
} else {
}
}


return {js: fs.readFileSync(tmpFile, 'utf8'), loaded: loaded};
return {js: fs.readFileSync(tmpFile, 'utf8'), loaded: loaded};
};

0 comments on commit f460ad1

Please sign in to comment.
You can’t perform that action at this time.