@travetto/transformer
Advanced tools
Comparing version 5.0.0-rc.2 to 5.0.0-rc.3
{ | ||
"name": "@travetto/transformer", | ||
"version": "5.0.0-rc.2", | ||
"version": "5.0.0-rc.3", | ||
"description": "Functionality for AST transformations, with transformer registration, and general utils", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -107,7 +107,6 @@ <!-- This file was generated by @travetto/doc and should not be modified directly --> | ||
const tslib_1 = require("tslib"); | ||
const Ⲑ_decorator_1 = tslib_1.__importStar(require("@travetto/registry/src/decorator.js")); | ||
const Ⲑ_function_1 = tslib_1.__importStar(require("@travetto/runtime/src/function.js")); | ||
var ᚕm = ["@travetto/transformer", "doc/upper"]; | ||
let TEST = class TEST { | ||
static Ⲑinit = Ⲑ_function_1.register(TEST, ᚕm, { hash: 649563175, lines: [1, 9] }, { COMPUTEAGE: { hash: 1286718349, lines: [6, 8] } }, false, false); | ||
class TEST { | ||
static Ⲑinit = Ⲑ_function_1.registerFunction(TEST, ᚕm, { hash: 649563175, lines: [1, 9] }, { COMPUTEAGE: { hash: 1286718349, lines: [6, 8, 7] } }, false, false); | ||
NAME; | ||
@@ -119,7 +118,4 @@ AGE; | ||
} | ||
}; | ||
} | ||
exports.TEST = TEST; | ||
exports.TEST = TEST = tslib_1.__decorate([ | ||
Ⲑ_decorator_1.Register() | ||
], TEST); | ||
``` |
@@ -9,2 +9,18 @@ import ts from 'typescript'; | ||
static #getIdentFromExpression(e: ts.Expression): ts.Identifier { | ||
if (ts.isCallExpression(e) && ts.isIdentifier(e.expression)) { | ||
return e.expression; | ||
} else if (ts.isIdentifier(e)) { | ||
return e; | ||
} else if (ts.isCallExpression(e) && ts.isPropertyAccessExpression(e.expression) && ts.isIdentifier(e.expression.expression)) { | ||
return e.expression.expression; | ||
} else if (ts.isPropertyAccessExpression(e) && ts.isCallExpression(e.expression) && ts.isIdentifier(e.expression.expression)) { | ||
return e.expression.expression; | ||
} else if (ts.isParenthesizedExpression(e)) { | ||
return this.#getIdentFromExpression(e.expression); | ||
} else { | ||
throw new Error('No Identifier'); | ||
} | ||
} | ||
/** | ||
@@ -14,12 +30,7 @@ * Get identifier for a decorator | ||
static getDecoratorIdent(d: ts.Decorator): ts.Identifier { | ||
if (ts.isCallExpression(d.expression) && ts.isIdentifier(d.expression.expression)) { | ||
return d.expression.expression; | ||
} else if (ts.isIdentifier(d.expression)) { | ||
return d.expression; | ||
} else if (ts.isCallExpression(d.expression) && ts.isPropertyAccessExpression(d.expression.expression) && ts.isIdentifier(d.expression.expression.expression)) { | ||
return d.expression.expression.expression; | ||
} else if (ts.isPropertyAccessExpression(d.expression) && ts.isCallExpression(d.expression.expression) && ts.isIdentifier(d.expression.expression.expression)) { | ||
return d.expression.expression.expression; | ||
const ident = this.#getIdentFromExpression(d.expression); | ||
if (!ident) { | ||
throw new Error('No Identifier'); | ||
} else { | ||
throw new Error('No Identifier'); | ||
return ident; | ||
} | ||
@@ -26,0 +37,0 @@ } |
94148
2375
120