initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
56
github/codeql-action-v2/node_modules/ts-poet/build/ConditionalOutput.js
generated
vendored
Normal file
56
github/codeql-action-v2/node_modules/ts-poet/build/ConditionalOutput.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MaybeOutput = exports.ConditionalOutput = void 0;
|
||||
const Node_1 = require("./Node");
|
||||
/**
|
||||
* Helps output conditional helper methods.
|
||||
*
|
||||
* The `ConditionalOutput` concept is split into a usage site and a declaration
|
||||
* site, i.e. declaring a `function someHelper() { ... }`, and calling it
|
||||
* like `someHelper()`.
|
||||
*
|
||||
* While generating code, you can make usage says by using `someHelper` as
|
||||
* a placeholder, and then output the declaration with `someHelper.ifUsed`
|
||||
* to output the declaration conditionally only if `someHelper` has been
|
||||
* seen in the tree.
|
||||
*
|
||||
* ```typescript
|
||||
* const someHelper = conditionalOutput(
|
||||
* "someHelper",
|
||||
* code`function someHelper() { return 1 } `
|
||||
* );
|
||||
*
|
||||
* const code = code`
|
||||
* ${someHelper}
|
||||
*
|
||||
* ${someHelper.ifUsed}
|
||||
* `
|
||||
* ```
|
||||
*/
|
||||
class ConditionalOutput extends Node_1.Node {
|
||||
// A given ConditionalOutput const could be used in multiple code
|
||||
// parents, and so we don't want to use instance state to store
|
||||
// "should I be output or not", b/c it depends on the containing tree.
|
||||
constructor(usageSiteName, declarationSiteCode) {
|
||||
super();
|
||||
this.usageSiteName = usageSiteName;
|
||||
this.declarationSiteCode = declarationSiteCode;
|
||||
}
|
||||
get childNodes() {
|
||||
return [this.declarationSiteCode];
|
||||
}
|
||||
toCodeString() {
|
||||
return this.usageSiteName;
|
||||
}
|
||||
get ifUsed() {
|
||||
return new MaybeOutput(this, this.declarationSiteCode);
|
||||
}
|
||||
}
|
||||
exports.ConditionalOutput = ConditionalOutput;
|
||||
class MaybeOutput {
|
||||
constructor(parent, code) {
|
||||
this.parent = parent;
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
exports.MaybeOutput = MaybeOutput;
|
||||
Loading…
Add table
Add a link
Reference in a new issue