|
|
@ -27,6 +27,7 @@ export const required = [ |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
const RENDERER = create_renderer(); |
|
|
|
const RENDERER = create_renderer(); |
|
|
|
|
|
|
|
const CAPS_WORDS = ["BUG", "TODO", "WARNING", "FOOTGUN", "DEPRECATED"]; |
|
|
|
|
|
|
|
|
|
|
|
const slug = (instring) => slugify(instring, { lower: true, strict: true, trim: true}); |
|
|
|
const slug = (instring) => slugify(instring, { lower: true, strict: true, trim: true}); |
|
|
|
|
|
|
|
|
|
|
@ -93,6 +94,8 @@ class ParseWalker { |
|
|
|
comment: this.find_comment(meth_node.loc.start.line), |
|
|
|
comment: this.find_comment(meth_node.loc.start.line), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.has_CAPS(new_method); |
|
|
|
|
|
|
|
|
|
|
|
new_method.code = this.slice_code(new_method.range); |
|
|
|
new_method.code = this.slice_code(new_method.range); |
|
|
|
|
|
|
|
|
|
|
|
new_class.methods.push(new_method); |
|
|
|
new_class.methods.push(new_method); |
|
|
@ -127,11 +130,24 @@ class ParseWalker { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
Used to add information when something is mentioned in the |
|
|
|
|
|
|
|
comment like BUG, TODO, etc. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
has_CAPS(exp) { |
|
|
|
|
|
|
|
if(exp.comment) { |
|
|
|
|
|
|
|
exp.caps = CAPS_WORDS.filter(phrase => exp.comment.includes(phrase)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
exp.caps = []; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
add_export(id, exp) { |
|
|
|
add_export(id, exp) { |
|
|
|
exp.name = id.name; |
|
|
|
exp.name = id.name; |
|
|
|
exp.slug = exp.slug ? exp.slug : slug(id.name); |
|
|
|
exp.slug = exp.slug ? exp.slug : slug(id.name); |
|
|
|
exp.line_start = id.loc.start.line; |
|
|
|
exp.line_start = id.loc.start.line; |
|
|
|
exp.comment = this.find_comment(exp.line_start); |
|
|
|
exp.comment = this.find_comment(exp.line_start); |
|
|
|
|
|
|
|
this.has_CAPS(exp); |
|
|
|
exp.code = this.slice_code(exp.range); |
|
|
|
exp.code = this.slice_code(exp.range); |
|
|
|
this.exported.push(exp); |
|
|
|
this.exported.push(exp); |
|
|
|
} |
|
|
|
} |
|
|
|