微调了dependencyBuilder
This commit is contained in:
parent
4acbd88c55
commit
64ca940278
|
|
@ -588,9 +588,17 @@ function outputFeatureIndex(dependencies, briefNames, sourceFile, printer, filen
|
|||
importStatements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("FeatureDict"), factory.createIdentifier(fdName))])), factory.createStringLiteral(dep), undefined));
|
||||
fdNames.push(fdName);
|
||||
});
|
||||
const stmt4 = statements[4], stmt5 = statements[5];
|
||||
(0, assert_1.default)(ts.isImportDeclaration(stmt4) && ts.isFunctionDeclaration(stmt5));
|
||||
const { name, parameters } = stmt5;
|
||||
let i = 0;
|
||||
while (true) {
|
||||
const stmt = statements[i];
|
||||
if (ts.isFunctionDeclaration(stmt)) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
const stmt3 = statements[i - 1], stmt4 = statements[i];
|
||||
(0, assert_1.default)(ts.isImportDeclaration(stmt3) && ts.isFunctionDeclaration(stmt4));
|
||||
const { name, parameters } = stmt4;
|
||||
(0, assert_1.default)(ts.isIdentifier(name) && name.text === 'create' && parameters.length === 1);
|
||||
const [param] = parameters;
|
||||
const { name: paramName, type } = param;
|
||||
|
|
@ -604,9 +612,9 @@ function outputFeatureIndex(dependencies, briefNames, sourceFile, printer, filen
|
|||
])
|
||||
});
|
||||
statements2 = [
|
||||
...statements.slice(0, 5),
|
||||
...statements.slice(0, i),
|
||||
...importStatements,
|
||||
...statements.slice(5)
|
||||
...statements.slice(i)
|
||||
];
|
||||
if (isModule) {
|
||||
statements2.push(factory.createFunctionDeclaration([
|
||||
|
|
|
|||
|
|
@ -1108,9 +1108,17 @@ function outputFeatureIndex(
|
|||
}
|
||||
);
|
||||
|
||||
const stmt4 = statements[4], stmt5 = statements[5];
|
||||
assert(ts.isImportDeclaration(stmt4) && ts.isFunctionDeclaration(stmt5));
|
||||
const { name, parameters } = stmt5;
|
||||
let i = 0;
|
||||
while (true) {
|
||||
const stmt = statements[i];
|
||||
if (ts.isFunctionDeclaration(stmt)) {
|
||||
break;
|
||||
}
|
||||
i ++;
|
||||
}
|
||||
const stmt3 = statements[i-1], stmt4 = statements[i];
|
||||
assert(ts.isImportDeclaration(stmt3) && ts.isFunctionDeclaration(stmt4));
|
||||
const { name, parameters } = stmt4;
|
||||
assert(ts.isIdentifier(name!) && name.text === 'create' && parameters.length === 1);
|
||||
const [param] = parameters;
|
||||
const { name: paramName, type } = param;
|
||||
|
|
@ -1127,9 +1135,9 @@ function outputFeatureIndex(
|
|||
});
|
||||
|
||||
statements2 = [
|
||||
...statements.slice(0, 5),
|
||||
...statements.slice(0, i),
|
||||
...importStatements,
|
||||
...statements.slice(5)
|
||||
...statements.slice(i)
|
||||
];
|
||||
if (isModule) {
|
||||
statements2.push(
|
||||
|
|
|
|||
Loading…
Reference in New Issue