mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-06 18:56:40 +01:00
Isolate code generation to output different languages
This commit is contained in:
15
src/utils.js
15
src/utils.js
@@ -15,11 +15,18 @@ module.exports.isDefined = isDefined;
|
||||
module.exports.accSizes2Str = accSizes2Str;
|
||||
|
||||
function ident(text) {
|
||||
let lines = text.split("\n");
|
||||
for (let i=0; i<lines.length; i++) {
|
||||
if (lines[i]) lines[i] = " "+lines[i];
|
||||
if (typeof text === "string") {
|
||||
let lines = text.split("\n");
|
||||
for (let i=0; i<lines.length; i++) {
|
||||
if (lines[i]) lines[i] = " "+lines[i];
|
||||
}
|
||||
return lines.join("\n");
|
||||
} else if (Array.isArray(text)) {
|
||||
for (let i=0; i<text.length; i++ ) {
|
||||
text[i] = ident(text[i]);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
function extractSizes (o) {
|
||||
|
||||
Reference in New Issue
Block a user