Update rustdoc-js tester tool to work with new kind of variables
This commit is contained in:
parent
3c95c0bd62
commit
0233abebc8
@ -85,8 +85,11 @@ function extractFunction(content, functionName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stupid function extractor for array.
|
// Stupid function extractor for array.
|
||||||
function extractArrayVariable(content, arrayName) {
|
function extractArrayVariable(content, arrayName, kind) {
|
||||||
var splitter = "var " + arrayName;
|
if (typeof kind === "undefined") {
|
||||||
|
kind = "let ";
|
||||||
|
}
|
||||||
|
var splitter = kind + arrayName;
|
||||||
while (true) {
|
while (true) {
|
||||||
var start = content.indexOf(splitter);
|
var start = content.indexOf(splitter);
|
||||||
if (start === -1) {
|
if (start === -1) {
|
||||||
@ -126,12 +129,18 @@ function extractArrayVariable(content, arrayName) {
|
|||||||
}
|
}
|
||||||
content = content.slice(start + 1);
|
content = content.slice(start + 1);
|
||||||
}
|
}
|
||||||
|
if (kind === "let ") {
|
||||||
|
return extractArrayVariable(content, arrayName, "const ");
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stupid function extractor for variable.
|
// Stupid function extractor for variable.
|
||||||
function extractVariable(content, varName) {
|
function extractVariable(content, varName, kind) {
|
||||||
var splitter = "var " + varName;
|
if (typeof kind === "undefined") {
|
||||||
|
kind = "let ";
|
||||||
|
}
|
||||||
|
var splitter = kind + varName;
|
||||||
while (true) {
|
while (true) {
|
||||||
var start = content.indexOf(splitter);
|
var start = content.indexOf(splitter);
|
||||||
if (start === -1) {
|
if (start === -1) {
|
||||||
@ -162,6 +171,9 @@ function extractVariable(content, varName) {
|
|||||||
}
|
}
|
||||||
content = content.slice(start + 1);
|
content = content.slice(start + 1);
|
||||||
}
|
}
|
||||||
|
if (kind === "let ") {
|
||||||
|
return extractVariable(content, varName, "const ");
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user