@microsoft.azure/autorest.incubator
Version:
AutoRest incubator project
43 lines • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const text_manipulation_1 = require("../../../common/text-manipulation");
const statement_1 = require("../../../csharp/code-dom/statements/statement");
function Try(body, objectInitializer) {
return new TryStatement(body, objectInitializer);
}
exports.Try = Try;
class TryStatement extends statement_1.Statements {
constructor(body, objectInitializer) {
super(body);
this.apply(objectInitializer);
}
get implementation() {
return `
try
{
${text_manipulation_1.indent(super.implementation)}
}`.trim();
}
}
exports.TryStatement = TryStatement;
function Catch(parameter, body, objectInitializer) {
return new CatchStatement(parameter, body, objectInitializer);
}
exports.Catch = Catch;
class CatchStatement extends statement_1.Statements {
constructor(parameter, body, objectInitializer) {
super(body);
this.parameter = parameter;
this.apply(objectInitializer);
}
get implementation() {
const p = this.parameter ? ` (${this.parameter.declaration})` : '';
return `
catch${p}
{
${text_manipulation_1.indent(super.implementation)}
}`.trim();
}
}
exports.CatchStatement = CatchStatement;
//# sourceMappingURL=try.js.map