Add nostdlib (#317)
This commit is contained in:
Родитель
4c67999669
Коммит
9094a8a7c8
|
@ -29,6 +29,11 @@ const args = yargs(process.argv.slice(2))
|
|||
type: "string",
|
||||
default: "./adl-output",
|
||||
describe: "The output path for generated artifacts. If it does not exist, it will be created."
|
||||
})
|
||||
.option("nostdlib", {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
describe: "Don't load the ADL standard library."
|
||||
});
|
||||
}
|
||||
)
|
||||
|
@ -95,7 +100,8 @@ async function getCompilerOptions(): Promise<CompilerOptions> {
|
|||
|
||||
return {
|
||||
outputPath,
|
||||
swaggerOutputFile: path.resolve(args["output-path"], "openapi.json")
|
||||
swaggerOutputFile: path.resolve(args["output-path"], "openapi.json"),
|
||||
nostdlib: args["nostdlib"]
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export interface CompilerOptions {
|
||||
outputPath?: string;
|
||||
swaggerOutputFile?: string;
|
||||
nostdlib?: boolean;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,11 @@ export async function compile(rootDir: string, options?: CompilerOptions) {
|
|||
|
||||
let virtualFileCount = 0;
|
||||
const binder = createBinder();
|
||||
await loadStandardLibrary(program);
|
||||
|
||||
if (!options?.nostdlib) {
|
||||
await loadStandardLibrary(program);
|
||||
}
|
||||
|
||||
await loadDirectory(program, rootDir);
|
||||
const checker = program.checker = createChecker(program);
|
||||
program.checker.checkProgram(program);
|
||||
|
|
Загрузка…
Ссылка в новой задаче