@microsoft.azure/autorest.incubator
Version:
AutoRest incubator project
50 lines • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const initializer_1 = require("../../common/initializer");
const expression_1 = require("../../csharp/code-dom/expression");
const parameter_modifier_1 = require("../../csharp/code-dom/parameter-modifier");
/** represents a method parameter */
class Parameter extends initializer_1.Initializer {
constructor(name, type, objectInitializer) {
super();
this.name = name;
this.type = type;
this.description = "";
this.genericParameters = new Array();
this.modifier = parameter_modifier_1.ParameterModifier.None;
this.attributes = new Array();
this.apply(objectInitializer);
}
get attributeDeclaration() {
return this.attributes.length > 0 ? `${this.attributes.joinWith(each => `${expression_1.valueOf(each)}`, " ")} ` : '';
}
get comment() {
return `<param name="${this.name}"> ${this.description} </param>`;
}
get declaration() {
return `${this.attributeDeclaration}${this.modifier} ${this.type.declaration} ${this.name} ${this.defaultInitializer || ''}`.trim();
}
get use() {
return this.name;
}
get value() {
return `${this.name}`;
}
toString() {
return this.value;
}
assign(expression) {
return `${this.name} = ${expression_1.valueOf(expression)};`;
}
assignPrivate(expression) {
return this.assign(expression);
}
get declarationExpression() {
return this;
}
get declarationStatement() {
throw new Error(`Property can not be a declaration statement`);
}
}
exports.Parameter = Parameter;
//# sourceMappingURL=parameter.js.map