source: trip-planner-front/node_modules/less/lib/less/tree/property.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var node_1 = tslib_1.__importDefault(require("./node"));
5var declaration_1 = tslib_1.__importDefault(require("./declaration"));
6var Property = function (name, index, currentFileInfo) {
7 this.name = name;
8 this._index = index;
9 this._fileInfo = currentFileInfo;
10};
11Property.prototype = Object.assign(new node_1.default(), {
12 type: 'Property',
13 eval: function (context) {
14 var property;
15 var name = this.name;
16 // TODO: shorten this reference
17 var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;
18 if (this.evaluating) {
19 throw { type: 'Name', message: "Recursive property reference for " + name, filename: this.fileInfo().filename,
20 index: this.getIndex() };
21 }
22 this.evaluating = true;
23 property = this.find(context.frames, function (frame) {
24 var v;
25 var vArr = frame.property(name);
26 if (vArr) {
27 for (var i = 0; i < vArr.length; i++) {
28 v = vArr[i];
29 vArr[i] = new declaration_1.default(v.name, v.value, v.important, v.merge, v.index, v.currentFileInfo, v.inline, v.variable);
30 }
31 mergeRules(vArr);
32 v = vArr[vArr.length - 1];
33 if (v.important) {
34 var importantScope = context.importantScope[context.importantScope.length - 1];
35 importantScope.important = v.important;
36 }
37 v = v.value.eval(context);
38 return v;
39 }
40 });
41 if (property) {
42 this.evaluating = false;
43 return property;
44 }
45 else {
46 throw { type: 'Name', message: "Property '" + name + "' is undefined", filename: this.currentFileInfo.filename,
47 index: this.index };
48 }
49 },
50 find: function (obj, fun) {
51 for (var i = 0, r = void 0; i < obj.length; i++) {
52 r = fun.call(obj, obj[i]);
53 if (r) {
54 return r;
55 }
56 }
57 return null;
58 }
59});
60exports.default = Property;
61//# sourceMappingURL=property.js.map
Note: See TracBrowser for help on using the repository browser.