@atomist/rug
Version:
TypeScript model for Atomist Rugs, see http://docs.atomist.com/
30 lines (29 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function union(eng, root, pe1, pe2) {
var hits1 = eng.save(root, pe1);
var hits2 = eng.save(root, pe2);
return hits1.concat(hits2);
}
exports.union = union;
/**
* Convenient class to wrap Java methods, hiding AST navigation.
*/
var Method = (function () {
function Method(eng, methodDeclaration) {
this.eng = eng;
this.methodDeclaration = methodDeclaration;
this.annotations = [];
this.filePath = this.methodDeclaration.containingFile().path;
this.name = this.nameNode().value();
this.annotations = union(eng, this.methodDeclaration, "/methodHeader//annotation", "//methodModifier//annotation");
}
Method.prototype.rename = function (newName) {
this.nameNode().update(newName);
};
Method.prototype.nameNode = function () {
return this.eng.scalar(this.methodDeclaration, "/methodHeader/methodDeclarator/Identifier");
};
return Method;
}());
exports.Method = Method;