Skip to content

Commit

Permalink
refs (redefine) document
Browse files Browse the repository at this point in the history
  • Loading branch information
tenbits committed Jun 14, 2021
1 parent 4ee9528 commit 24553eb
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions src/feature/decorators/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,55 @@ import { custom_Tags, custom_Statements } from '@core/custom/exports';
import { is_Function } from '@utils/is';
import { obj_create } from '@utils/obj';

export function _getDecorator (decoNode, model, ctx, ctr) {
var expr = decoNode.expression,
deco = expression_eval(expr, _store, null, ctr);
if (deco == null) {
error_withNode('Decorator not resolved', decoNode);
return null;
}
if (expr.indexOf('(') === -1 && isFactory(deco)) {
return initialize(deco);
}
return deco;
export function _getDecorator(decoNode, model, ctx, ctr) {
let expr = decoNode.expression;
let deco = expression_eval(expr, _store, null, ctr);
if (deco == null) {
error_withNode('Decorator not resolved', decoNode);
return null;
}
if (expr.indexOf('(') === -1 && isFactory(deco)) {
return initialize(deco);
}
return deco;

};
};

export function _getDecoType (node) {
var tagName = node.tagName,
type = node.type;
if (tagName === 'function' || tagName === 'slot' || tagName === 'event' || tagName === 'pipe') {
return 'METHOD';
}
if ((type === 1 || type === 15) && custom_Tags[tagName] != null) {
type = 4;
}
if (type === 1 && custom_Statements[tagName] != null) {
type = 15;
}
if (type === 1) {
return 'NODE';
}
if (type === 4) {
return 'COMPO';
}
return null;
};
export function _getDecoType(node) {
let tagName = node.tagName,
type = node.type;
if (tagName === 'function' || tagName === 'slot' || tagName === 'event' || tagName === 'pipe') {
return 'METHOD';
}
if ((type === 1 || type === 15) && custom_Tags[tagName] != null) {
type = 4;
}
if (type === 1 && custom_Statements[tagName] != null) {
type = 15;
}
if (type === 1) {
return 'NODE';
}
if (type === 4) {
return 'COMPO';
}
return null;
};

function isFactory (deco) {
return deco.isFactory === true;
}
function initialize(deco) {
if (is_Function(deco)) {
return new deco();
}
// is object
var self = obj_create(deco);
if (deco.hasOwnProperty('constructor')) {
var x = deco.constructor.call(self);
if (x != null)
return x;
}
return self;
}
function isFactory(deco) {
return deco.isFactory === true;
}
function initialize(deco) {
if (is_Function(deco)) {
return new deco();
}
// is object
let self = obj_create(deco);
if (deco.hasOwnProperty('constructor')) {
let x = deco.constructor.call(self);
if (x != null)
return x;
}
return self;
}

0 comments on commit 24553eb

Please sign in to comment.