diff --git a/build/esiur.js b/build/esiur.js index 8a74b8a..8daca58 100644 --- a/build/esiur.js +++ b/build/esiur.js @@ -10653,7 +10653,7 @@ var TemplateGenerator = /*#__PURE__*/function () { var descProps = template.properties.map(function (p) { var ptTypeName = _this.getTypeName(template, p.valueType, templates, dependencies); - return "new Esiur.Resource.Template.Prop('".concat(p.name, "', ").concat(ptTypeName, ", ").concat(_this._escape(p.readAnnotation), ", ").concat(_this._escape(p.writeAnnotation), ")"); + return "new Esiur.Resource.Template.Prop('".concat(p.name, "', ").concat(ptTypeName, ", ").concat(_this.toLiteral(p.readAnnotation), ", ").concat(_this.toLiteral(p.writeAnnotation), ")"); }); var cls = template.className.split('.'); var namespace = cls.slice(0, cls.length - 1).join('.'); @@ -10950,11 +10950,6 @@ var TemplateGenerator = /*#__PURE__*/function () { return getTemplate; }() - }, { - key: "_escape", - value: function _escape(str) { - if (str == null) return "null";else return "'".concat(str, "'"); - } }, { key: "generateEnum", value: function generateEnum(template, templates) { @@ -10972,7 +10967,7 @@ var TemplateGenerator = /*#__PURE__*/function () { var descConsts = template.constants.map(function (p) { var ctTypeName = _this4.getTypeName(template, p.valueType, templates, dependencies); - return "new Esiur.Resource.Template.Const('".concat(p.name, "', ").concat(ctTypeName, ", ").concat(p.value, ", ").concat(_this4._escape(p.annotation), ")"); + return "new Esiur.Resource.Template.Const('".concat(p.name, "', ").concat(ctTypeName, ", ").concat(p.value, ", ").concat(_this4.toLiteral(p.annotation), ")"); }); var cls = template.className.split('.'); var namespace = cls.slice(0, cls.length - 1).join('.'); @@ -11106,7 +11101,7 @@ var TemplateGenerator = /*#__PURE__*/function () { .map(function (p) { var ptTypeName = _this5.getTypeName(template, p.valueType, templates, dependencies); - return "new Esiur.Resource.Template.Prop('".concat(p.name, "', ").concat(ptTypeName, ", ").concat(_this5._escape(p.readAnnotation), ", ").concat(_this5._escape(p.writeAnnotation), ")"); + return "new Esiur.Resource.Template.Prop('".concat(p.name, "', ").concat(ptTypeName, ", ").concat(_this5.toLiteral(p.readAnnotation), ", ").concat(_this5.toLiteral(p.writeAnnotation), ")"); }); var descFuncs = template.functions.map(function (f) { var ftTypeName = _this5.getTypeName(template, f.returnType, templates, dependencies); @@ -11116,18 +11111,18 @@ var TemplateGenerator = /*#__PURE__*/function () { return "new Esiur.Resource.Template.Arg('".concat(a.name, "', ").concat(atTypeName, ", ").concat(a.optional, ")"); }).join(', '); - return "new Esiur.Resource.Template.Func('".concat(f.name, "', ").concat(ftTypeName, ", [").concat(args, "], ").concat(_this5._escape(f.annotation), ")"); + return "new Esiur.Resource.Template.Func('".concat(f.name, "', ").concat(ftTypeName, ", [").concat(args, "], ").concat(_this5.toLiteral(f.annotation), ")"); }); var descEvents = template.events //.where((e) => !e.inherited) @REVIEW .map(function (e) { var etTypeName = _this5.getTypeName(template, e.argumentType, templates, dependencies); - return "new Esiur.Resource.Template.Evt('".concat(e.name, "', ").concat(etTypeName, ", ").concat(e.listenable, ", ").concat(_this5._escape(e.annotation), ")"); + return "new Esiur.Resource.Template.Evt('".concat(e.name, "', ").concat(etTypeName, ", ").concat(e.listenable, ", ").concat(_this5.toLiteral(e.annotation), ")"); }); var descConsts = template.constants.map(function (p) { var ctTypeName = _this5.getTypeName(template, p.valueType, templates, dependencies); - return "new Esiur.Resource.Template.Const('".concat(p.name, "', ").concat(ctTypeName, ", ").concat(p.value, ", ").concat(_this5._escape(p.annotation), ")"); + return "new Esiur.Resource.Template.Const('".concat(p.name, "', ").concat(ctTypeName, ", ").concat(p.value, ", ").concat(_this5.toLiteral(p.annotation), ")"); }); var cls = template.className.split('.'); var namespace = cls.slice(0, cls.length - 1).join('.'); diff --git a/package.json b/package.json index cf8ab4f..89a8ff2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "esiur", - "version": "2.2.1", + "version": "2.2.2", "description": "Distributed Object Framework", "main": "esiur.js", "type": "module", diff --git a/src/Proxy/TemplateGenerator.js b/src/Proxy/TemplateGenerator.js index 7285624..7c9004e 100644 --- a/src/Proxy/TemplateGenerator.js +++ b/src/Proxy/TemplateGenerator.js @@ -83,7 +83,7 @@ export default class TemplateGenerator { var descProps = template.properties .map((p) => { var ptTypeName = this.getTypeName(template, p.valueType, templates, dependencies); - return `new Esiur.Resource.Template.Prop('${p.name}', ${ptTypeName}, ${this._escape(p.readAnnotation)}, ${this._escape(p.writeAnnotation)})`; + return `new Esiur.Resource.Template.Prop('${p.name}', ${ptTypeName}, ${this.toLiteral(p.readAnnotation)}, ${this.toLiteral(p.writeAnnotation)})`; }); @@ -325,12 +325,6 @@ export default class TemplateGenerator { } - static _escape(str) { - if (str == null) - return "null"; - else - return `'${str}'`; - } static generateEnum(template, templates) { let className = template.className.split('.').slice(-1)[0]; @@ -348,7 +342,7 @@ export default class TemplateGenerator { // add template var descConsts = template.constants.map((p) => { var ctTypeName = this.getTypeName(template, p.valueType, templates, dependencies); - return `new Esiur.Resource.Template.Const('${p.name}', ${ctTypeName}, ${p.value}, ${this._escape(p.annotation)})`; + return `new Esiur.Resource.Template.Const('${p.name}', ${ctTypeName}, ${p.value}, ${this.toLiteral(p.annotation)})`; }); @@ -482,7 +476,7 @@ export default class TemplateGenerator { var descProps = template.properties //.where((p) => !p.inherited) .map((p) => { var ptTypeName = this.getTypeName(template, p.valueType, templates, dependencies); - return `new Esiur.Resource.Template.Prop('${p.name}', ${ptTypeName}, ${this._escape(p.readAnnotation)}, ${this._escape(p.writeAnnotation)})`; + return `new Esiur.Resource.Template.Prop('${p.name}', ${ptTypeName}, ${this.toLiteral(p.readAnnotation)}, ${this.toLiteral(p.writeAnnotation)})`; }); var descFuncs = template.functions @@ -494,20 +488,20 @@ export default class TemplateGenerator { return `new Esiur.Resource.Template.Arg('${a.name}', ${atTypeName}, ${a.optional})`; }).join(', '); - return `new Esiur.Resource.Template.Func('${f.name}', ${ftTypeName}, [${args}], ${this._escape(f.annotation)})`; + return `new Esiur.Resource.Template.Func('${f.name}', ${ftTypeName}, [${args}], ${this.toLiteral(f.annotation)})`; }); var descEvents = template.events //.where((e) => !e.inherited) @REVIEW .map((e) => { var etTypeName = this.getTypeName(template, e.argumentType, templates, dependencies); - return `new Esiur.Resource.Template.Evt('${e.name}', ${etTypeName}, ${e.listenable}, ${this._escape(e.annotation)})`; + return `new Esiur.Resource.Template.Evt('${e.name}', ${etTypeName}, ${e.listenable}, ${this.toLiteral(e.annotation)})`; }); var descConsts = template.constants.map((p) => { var ctTypeName = this.getTypeName(template, p.valueType, templates, dependencies); - return `new Esiur.Resource.Template.Const('${p.name}', ${ctTypeName}, ${p.value}, ${this._escape(p.annotation)})`; + return `new Esiur.Resource.Template.Const('${p.name}', ${ctTypeName}, ${p.value}, ${this.toLiteral(p.annotation)})`; });