Permalink
Browse files

tools, feat: support multiple idl folders.

  • Loading branch information...
xicilion committed Jun 11, 2018
1 parent ef4441f commit 69b25bb8a5ef03690a616f8651adb6536feafb57
Showing with 13 additions and 11 deletions.
  1. +3 −3 tools/util/gen_code.js
  2. +10 −8 tools/util/parser.js
View
@@ -852,7 +852,7 @@ module.exports = function (defs, baseFolder) {
}
}
for (var cls in defs) {
gen_code(cls, defs[cls]);
}
for (var cls in defs)
if (!defs[cls].__skip)
gen_code(cls, defs[cls]);
}
View
@@ -404,23 +404,25 @@ function parser_comment(comment) {
return doc;
}
module.exports = function (baseFolder) {
var defs = {};
module.exports = function (baseFolder, defs) {
defs = defs || {};
for (var n in defs)
defs[n].__skip = true;
fs.readdir(baseFolder).sort().forEach(f => {
if (path.extname(f) == '.idl') {
f = path.join(baseFolder, f);
var def = parser.parse(fs.readTextFile(f));
def.declare.doc = parser_comment(def.declare.comments);
for (var m in def.members)
def.members[m].doc = parser_comment(def.members[m].comments);
defs[def.declare.name] = def;
}
});
for (var n in defs) {
defs[n].declare.doc = parser_comment(defs[n].declare.comments);
for (var m in defs[n].members)
defs[n].members[m].doc = parser_comment(defs[n].members[m].comments);
}
delete defs['object'].declare.extend;
return defs;

0 comments on commit 69b25bb

Please sign in to comment.