From 437121f22328e965b865edaf2d9b52a2b39e38ed Mon Sep 17 00:00:00 2001 From: Esiur Project Date: Thu, 16 Jun 2022 04:51:26 +0300 Subject: [PATCH] Annotations --- analysis_options.yaml | 22 +- lib/src/Net/IIP/DistributedConnection.dart | 40 ++- lib/src/Proxy/TemplateGenerator.dart | 70 ++++- .../Resource/Template/ConstantTemplate.dart | 8 +- lib/src/Resource/Template/EventTemplate.dart | 8 +- .../Resource/Template/FunctionTemplate.dart | 8 +- .../Resource/Template/PropertyTemplate.dart | 22 +- .../Resource/Template/TemplateDescriber.dart | 5 +- lib/src/Resource/Template/TypeTemplate.dart | 290 ++++-------------- pubspec.yaml | 2 +- 10 files changed, 189 insertions(+), 286 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 6c612a5..0f2709c 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,14 +1,14 @@ -analyzer: - exclude: [build/**] - language: - strict-raw-types: true - strict-casts: true - strict-inference: true +# analyzer: +# exclude: [build/**] +# language: +# strict-raw-types: true +# strict-casts: true +# strict-inference: true - strong-mode: - implicit-casts: false +# strong-mode: +# implicit-casts: false -linter: - rules: - - cancel_subscriptions +# linter: +# rules: +# - cancel_subscriptions diff --git a/lib/src/Net/IIP/DistributedConnection.dart b/lib/src/Net/IIP/DistributedConnection.dart index 2dbbf62..9041c0e 100644 --- a/lib/src/Net/IIP/DistributedConnection.dart +++ b/lib/src/Net/IIP/DistributedConnection.dart @@ -22,6 +22,8 @@ SOFTWARE. */ +import 'package:collection/collection.dart'; + import '../../Data/IntType.dart'; import '../../Data/DataDeserializer.dart'; @@ -126,7 +128,10 @@ class DistributedConnection extends NetworkConnection with IStore { KeyList> _templateRequests = new KeyList>(); - //KeyList> _pathRequests = new KeyList>(); + + KeyList> _templateByNameRequests = + new KeyList>(); + Map _templates = new Map(); KeyList> _requests = new KeyList>(); @@ -2255,6 +2260,39 @@ class DistributedConnection extends NetworkConnection with IStore { }); } + AsyncReply getTemplateByClassName(String className) { + var template = + _templates.values.firstWhereOrNull((x) => x.className == className); + if (template != null) return AsyncReply.ready(template); + + if (_templateByNameRequests.containsKey(className)) + return _templateByNameRequests[className] as AsyncReply; + + var reply = new AsyncReply(); + _templateByNameRequests.add(className, reply); + + var classNameBytes = DC.stringToBytes(className); + + (sendRequest(IIPPacketAction.TemplateFromClassName) + ..addUint8(classNameBytes.length) + ..addDC(classNameBytes)) + .done() + ..then((rt) { + _templateByNameRequests.remove(className); + if (rt != null) { + _templates[(rt[0] as TypeTemplate).classId] = rt[0] as TypeTemplate; + Warehouse.putTemplate(rt[0] as TypeTemplate); + reply.trigger(rt[0]); + } else + reply.triggerError(Exception("Null response")); + }) + ..error((ex) { + reply.triggerError(ex); + }); + + return reply; + } + /// /// Get the TypeTemplate for a given class Id. /// diff --git a/lib/src/Proxy/TemplateGenerator.dart b/lib/src/Proxy/TemplateGenerator.dart index 3b1128d..8f8cafe 100644 --- a/lib/src/Proxy/TemplateGenerator.dart +++ b/lib/src/Proxy/TemplateGenerator.dart @@ -12,6 +12,56 @@ class TemplateGenerator { // static RegExp urlRegex = RegExp("^(?:([\S]*)://([^/]*)/?)"); static final _urlRegex = RegExp(r'^(?:([^\s|:]*):\/\/([^\/]*)\/?(.*))'); + static String toLiteral(String? input) { + if (input == null) return "null"; + + String literal = ""; + + literal += "\""; + + input.runes.forEach((int code) { + var c = String.fromCharCode(code); + switch (c) { + case '\"': + literal += "\\\""; + break; + case '\\': + literal += "\\\\"; + break; + case '\0': + literal += "\\0"; + break; + case '\a': + literal += "\\a"; + break; + case '\b': + literal += "\\b"; + break; + case '\f': + literal += "\\f"; + break; + case '\n': + literal += "\\n"; + break; + case '\r': + literal += "\\r"; + break; + case '\t': + literal += "\\t"; + break; + case '\v': + literal += "\\v"; + break; + default: + literal += c; + break; + } + }); + + literal += "\""; + return literal; + } + static String generateRecord( TypeTemplate template, List templates) { var className = template.className.split('.').last; @@ -64,15 +114,15 @@ class TemplateGenerator { var descProps = template.properties //.where((p) => !p.inherited) .map((p) { var ptTypeName = getTypeName(template, p.valueType, templates); - return "Prop('${p.name}', getTypeOf<${ptTypeName}>(), ${_escape(p.readExpansion)}, ${_escape(p.writeExpansion)})"; + return "Prop('${p.name}', getTypeOf<${ptTypeName}>(), ${_escape(p.readAnnotation)}, ${_escape(p.writeAnnotation)})"; }).join(', '); if (parentName != null) rt.writeln("""@override - TemplateDescriber get template => TemplateDescriber('${template.className}', parent: ${parentName}, properties: [${descProps}]);"""); + TemplateDescriber get template => TemplateDescriber('${template.className}', parent: ${parentName}, properties: [${descProps}], annotation: ${toLiteral(template.annotation)});"""); else rt.writeln("""@override - TemplateDescriber get template => TemplateDescriber('${template.className}', properties: [${descProps}]);"""); + TemplateDescriber get template => TemplateDescriber('${template.className}', properties: [${descProps}], annotation: ${toLiteral(template.annotation)});"""); rt.writeln("\r\n}"); @@ -353,11 +403,11 @@ class TemplateGenerator { // add template var descConsts = template.constants.map((p) { var ctTypeName = getTypeName(template, p.valueType, templates); - return "Const('${p.name}', getTypeOf<${ctTypeName}>(), ${p.value}, ${_escape(p.expansion)})"; + return "Const('${p.name}', getTypeOf<${ctTypeName}>(), ${p.value}, ${_escape(p.annotation)})"; }).join(', '); rt.writeln("""@override - TemplateDescriber get template => TemplateDescriber('${template.className}', constants: [${descConsts}]);"""); + TemplateDescriber get template => TemplateDescriber('${template.className}', constants: [${descConsts}], annotation: ${toLiteral(template.annotation)});"""); rt.writeln("\r\n}"); @@ -469,7 +519,7 @@ class TemplateGenerator { var descProps = template.properties //.where((p) => !p.inherited) .map((p) { var ptTypeName = getTypeName(template, p.valueType, templates); - return "Prop('${p.name}', getTypeOf<${ptTypeName}>(), ${_escape(p.readExpansion)}, ${_escape(p.writeExpansion)})"; + return "Prop('${p.name}', getTypeOf<${ptTypeName}>(), ${_escape(p.readAnnotation)}, ${_escape(p.writeAnnotation)})"; }).join(', '); var descFuncs = template.functions //.where((f) => !f.inherited) @@ -481,22 +531,22 @@ class TemplateGenerator { return "Arg('${a.name}', getTypeOf<${atTypeName}>(), ${a.optional})"; }).join(', '); - return "Func('${f.name}', getTypeOf<${ftTypeName}>(), [${args}], ${_escape(f.expansion)})"; + return "Func('${f.name}', getTypeOf<${ftTypeName}>(), [${args}], ${_escape(f.annotation)})"; }).join(', '); var descEvents = template.events //.where((e) => !e.inherited) .map((e) { var etTypeName = getTypeName(template, e.argumentType, templates); - return "Evt('${e.name}', getTypeOf<${etTypeName}>(), ${e.listenable}, ${_escape(e.expansion)})"; + return "Evt('${e.name}', getTypeOf<${etTypeName}>(), ${e.listenable}, ${_escape(e.annotation)})"; }).join(', '); if (parentName != null) rt.writeln( - "TemplateDescriber get template => TemplateDescriber('${template.className}', parent: ${parentName}, properties: [${descProps}], functions: [${descFuncs}], events: [$descEvents]);"); + "TemplateDescriber get template => TemplateDescriber('${template.className}', parent: ${parentName}, properties: [${descProps}], functions: [${descFuncs}], events: [$descEvents], annotation: ${toLiteral(template.annotation)});"); else rt.writeln( - "TemplateDescriber get template => TemplateDescriber('${template.className}', properties: [${descProps}], functions: [${descFuncs}], events: [$descEvents]);"); + "TemplateDescriber get template => TemplateDescriber('${template.className}', properties: [${descProps}], functions: [${descFuncs}], events: [$descEvents], annotation: ${toLiteral(template.annotation)});"); rt.writeln("\r\n}"); diff --git a/lib/src/Resource/Template/ConstantTemplate.dart b/lib/src/Resource/Template/ConstantTemplate.dart index 8078e1f..c3d7922 100644 --- a/lib/src/Resource/Template/ConstantTemplate.dart +++ b/lib/src/Resource/Template/ConstantTemplate.dart @@ -8,19 +8,19 @@ import 'TypeTemplate.dart'; class ConstantTemplate extends MemberTemplate { final dynamic value; - final String? expansion; + final String? annotation; final RepresentationType valueType; ConstantTemplate(TypeTemplate template, int index, String name, - bool inherited, this.valueType, this.value, this.expansion) + bool inherited, this.valueType, this.value, this.annotation) : super(template, index, name, inherited) {} DC compose() { var name = super.compose(); var hdr = inherited ? 0x80 : 0; - if (expansion != null) { - var exp = DC.stringToBytes(expansion!); + if (annotation != null) { + var exp = DC.stringToBytes(annotation!); hdr |= 0x70; return (BinaryList() ..addUint8(hdr) diff --git a/lib/src/Resource/Template/EventTemplate.dart b/lib/src/Resource/Template/EventTemplate.dart index a73fcc6..f7dfb48 100644 --- a/lib/src/Resource/Template/EventTemplate.dart +++ b/lib/src/Resource/Template/EventTemplate.dart @@ -6,7 +6,7 @@ import 'MemberType.dart'; import '../../Data/RepresentationType.dart'; class EventTemplate extends MemberTemplate { - final String? expansion; + final String? annotation; final bool listenable; final RepresentationType argumentType; @@ -17,8 +17,8 @@ class EventTemplate extends MemberTemplate { if (listenable) hdr |= 0x8; - if (expansion != null) { - var exp = DC.stringToBytes(expansion as String); + if (annotation != null) { + var exp = DC.stringToBytes(annotation as String); hdr |= 0x50; return (BinaryList() ..addUint8(hdr) @@ -41,6 +41,6 @@ class EventTemplate extends MemberTemplate { EventTemplate(TypeTemplate template, int index, String name, bool inherited, this.argumentType, - [this.expansion = null, this.listenable = false]) + [this.annotation = null, this.listenable = false]) : super(template, index, name, inherited) {} } diff --git a/lib/src/Resource/Template/FunctionTemplate.dart b/lib/src/Resource/Template/FunctionTemplate.dart index a633909..6f24efa 100644 --- a/lib/src/Resource/Template/FunctionTemplate.dart +++ b/lib/src/Resource/Template/FunctionTemplate.dart @@ -7,7 +7,7 @@ import 'ArgumentTemplate.dart'; import '../../Data/RepresentationType.dart'; class FunctionTemplate extends MemberTemplate { - String? expansion; + String? annotation; // bool isVoid; List arguments; @@ -24,8 +24,8 @@ class FunctionTemplate extends MemberTemplate { for (var i = 0; i < arguments.length; i++) bl.addDC(arguments[i].compose()); - if (expansion != null) { - var exp = DC.stringToBytes(expansion as String); + if (annotation != null) { + var exp = DC.stringToBytes(annotation as String); bl ..addInt32(exp.length) ..addDC(exp); @@ -38,6 +38,6 @@ class FunctionTemplate extends MemberTemplate { FunctionTemplate(TypeTemplate template, int index, String name, bool inherited, this.arguments, this.returnType, - [this.expansion = null]) + [this.annotation = null]) : super(template, index, name, inherited) {} } diff --git a/lib/src/Resource/Template/PropertyTemplate.dart b/lib/src/Resource/Template/PropertyTemplate.dart index fa2bb56..5c1788d 100644 --- a/lib/src/Resource/Template/PropertyTemplate.dart +++ b/lib/src/Resource/Template/PropertyTemplate.dart @@ -13,9 +13,9 @@ class PropertyTemplate extends MemberTemplate { bool recordable; - String? readExpansion; + String? readAnnotation; - String? writeExpansion; + String? writeAnnotation; DC compose() { var name = super.compose(); @@ -23,9 +23,9 @@ class PropertyTemplate extends MemberTemplate { if (inherited) pv |= 0x80; - if (writeExpansion != null && readExpansion != null) { - var rexp = DC.stringToBytes(readExpansion as String); - var wexp = DC.stringToBytes(writeExpansion as String); + if (writeAnnotation != null && readAnnotation != null) { + var rexp = DC.stringToBytes(readAnnotation as String); + var wexp = DC.stringToBytes(writeAnnotation as String); return (BinaryList() ..addUint8(0x38 | pv) ..addUint8(name.length) @@ -36,8 +36,8 @@ class PropertyTemplate extends MemberTemplate { ..addInt32(rexp.length) ..addDC(rexp)) .toDC(); - } else if (writeExpansion != null) { - var wexp = DC.stringToBytes(writeExpansion as String); + } else if (writeAnnotation != null) { + var wexp = DC.stringToBytes(writeAnnotation as String); return (BinaryList() ..addUint8(0x30 | pv) ..addUint8(name.length) @@ -46,8 +46,8 @@ class PropertyTemplate extends MemberTemplate { ..addInt32(wexp.length) ..addDC(wexp)) .toDC(); - } else if (readExpansion != null) { - var rexp = DC.stringToBytes(readExpansion as String); + } else if (readAnnotation != null) { + var rexp = DC.stringToBytes(readAnnotation as String); return (BinaryList() ..addUint8(0x28 | pv) ..addUint8(name.length) @@ -67,8 +67,8 @@ class PropertyTemplate extends MemberTemplate { PropertyTemplate(TypeTemplate template, int index, String name, bool inherited, this.valueType, - [this.readExpansion = null, - this.writeExpansion = null, + [this.readAnnotation = null, + this.writeAnnotation = null, this.recordable = false]) : super(template, index, name, inherited) {} } diff --git a/lib/src/Resource/Template/TemplateDescriber.dart b/lib/src/Resource/Template/TemplateDescriber.dart index 4aafee2..2cf3223 100644 --- a/lib/src/Resource/Template/TemplateDescriber.dart +++ b/lib/src/Resource/Template/TemplateDescriber.dart @@ -1,4 +1,3 @@ - class TemplateDescriber { final List? properties; final List? events; @@ -8,6 +7,7 @@ class TemplateDescriber { final String nameSpace; final int version; final Type? parent; + final String? annotation; const TemplateDescriber(this.nameSpace, {this.parent, @@ -15,7 +15,8 @@ class TemplateDescriber { this.functions, this.events, this.constants, - this.version = 0}); + this.version = 0, + this.annotation = null}); } // class Property { diff --git a/lib/src/Resource/Template/TypeTemplate.dart b/lib/src/Resource/Template/TypeTemplate.dart index d6183a2..65474a7 100644 --- a/lib/src/Resource/Template/TypeTemplate.dart +++ b/lib/src/Resource/Template/TypeTemplate.dart @@ -26,6 +26,8 @@ class TypeTemplate { late Guid _classId; Guid? _parentId = null; + String? _annotation; + late String _className; List _members = []; List _functions = []; @@ -40,6 +42,8 @@ class TypeTemplate { late DC _content; + String? get annotation => _annotation; + DC get content => _content; TemplateType get type => _templateType; @@ -155,6 +159,8 @@ class TypeTemplate { _version = describer.version; + _annotation = describer.annotation; + if (addToWarehouse) Warehouse.putTemplate(this); // _templates.add(template.classId, template); @@ -253,10 +259,19 @@ class TypeTemplate { // bake it binarily var b = BinaryList() - ..addUint8(_templateType.index) + ..addUint8((_annotation != null ? 0x40 : 0x0) | _templateType.index) ..addGuid(classId) ..addUint8(className.length) - ..addString(className) + ..addString(className); + + if (_annotation != null) { + var classAnnotationBytes = DC.stringToBytes(_annotation!); + b + ..addUint16(classAnnotationBytes.length) + ..addDC(classAnnotationBytes); + } + + b ..addInt32(_version) ..addUint16(_members.length); @@ -267,219 +282,6 @@ class TypeTemplate { _content = b.toDC(); } - // static Guid getTypeGuid(Type type) => getTypeGuid(type.toString()); - - // static Guid getTypeGuid(String typeName) - // { - // var tn = Encoding.UTF8.GetBytes(typeName); - // var hash = SHA256.Create().ComputeHash(tn).Clip(0, 16); - - // return new Guid(hash); - // } - - // static Type GetElementType(Type type) => type switch - // { - // { IsArray: true } => type.GetElementType(), - // { IsEnum: true } => type.GetEnumUnderlyingType(), - // (_) => type - // }; - - // static TypeTemplate[] GetRuntimeTypes(TypeTemplate template) - // { - - // List list = []; - - // list.add(template); - - // var getRuntimeTypes = null; - - // getRuntimeTypes = (TypeTemplate tmp, List bag) - // { - // if (template.resourceType == null) - // return; - - // // functions - // tmp.functions.foreach((f){ - - // var frtt = Warehouse.GetTemplate(getElementType(f.MethodInfo.ReturnType)); - // if (frtt != null) - // { - // if (!bag.Contains(frtt)) - // { - // list.Add(frtt); - // getRuntimeTypes(frtt, bag); - // } - // } - - // var args = f.MethodInfo.GetParameters(); - - // for(var i = 0; i < args.Length - 1; i++) - // { - // var fpt = Warehouse.GetTemplate(GetElementType(args[i].ParameterType)); - // if (fpt != null) - // { - // if (!bag.Contains(fpt)) - // { - // bag.Add(fpt); - // getRuntimeTypes(fpt, bag); - // } - // } - // } - - // // skip DistributedConnection argument - // if (args.Length > 0) - // { - // var last = args.Last(); - // if (last.ParameterType != typeof(DistributedConnection)) - // { - // var fpt = Warehouse.GetTemplate(GetElementType(last.ParameterType)); - // if (fpt != null) - // { - // if (!bag.Contains(fpt)) - // { - // bag.Add(fpt); - // getRuntimeTypes(fpt, bag); - // } - // } - // } - // } - - // }); - - // // properties - // foreach (var p in tmp.properties) - // { - // var pt = Warehouse.GetTemplate(GetElementType(p.PropertyInfo.PropertyType)); - // if (pt != null) - // { - // if (!bag.Contains(pt)) - // { - // bag.Add(pt); - // getRuntimeTypes(pt, bag); - // } - // } - // } - - // // events - // foreach (var e in tmp.events) - // { - // var et = Warehouse.GetTemplate(GetElementType(e.EventInfo.EventHandlerType.GenericTypeArguments[0])); - - // if (et != null) - // { - // if (!bag.Contains(et)) - // { - // bag.Add(et); - // getRuntimeTypes(et, bag); - // } - // } - // } - // }; - - // getRuntimeTypes(template, list); - // return list.ToArray(); - // } - - // @TODO Create template from type - // TypeTemplate.fromType(Type type) { - - // } - -/* - TypeTemplate(Type type) - { - - type = ResourceProxy.GetBaseType(type); - - // set guid - - var typeName = Encoding.UTF8.GetBytes(type.FullName); - var hash = SHA256.Create().ComputeHash(typeName).Clip(0, 16); - - classId = new Guid(hash); - className = type.FullName; - - -#if NETSTANDARD1_5 - PropertyInfo[] propsInfo = type.GetTypeInfo().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); - EventInfo[] eventsInfo = type.GetTypeInfo().GetEvents(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); - MethodInfo[] methodsInfo = type.GetTypeInfo().GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); - -#else - PropertyInfo[] propsInfo = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); - EventInfo[] eventsInfo = type.GetEvents(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); - MethodInfo[] methodsInfo = type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); -#endif - - //byte currentIndex = 0; - - byte i = 0; - - foreach (var pi in propsInfo) - { - var ps = (ResourceProperty[])pi.GetCustomAttributes(typeof(ResourceProperty), true); - if (ps.Length > 0) - { - var pt = new PropertyTemplate(this, i++, pi.Name, ps[0].ReadExpansion, ps[0].WriteExpansion, ps[0].Storage); - pt.Info = pi; - properties.Add(pt); - } - } - - i = 0; - - foreach (var ei in eventsInfo) - { - var es = (ResourceEvent[])ei.GetCustomAttributes(typeof(ResourceEvent), true); - if (es.Length > 0) - { - var et = new EventTemplate(this, i++, ei.Name, es[0].Expansion); - events.Add(et); - } - } - - i = 0; - foreach (MethodInfo mi in methodsInfo) - { - var fs = (ResourceFunction[])mi.GetCustomAttributes(typeof(ResourceFunction), true); - if (fs.Length > 0) - { - var ft = new FunctionTemplate(this, i++, mi.Name, mi.ReturnType == typeof(void), fs[0].Expansion); - functions.Add(ft); - } - } - - // append signals - for (i = 0; i < events.Count; i++) - members.Add(events[i]); - // append slots - for (i = 0; i < functions.Count; i++) - members.Add(functions[i]); - // append properties - for (i = 0; i < properties.Count; i++) - members.Add(properties[i]); - - // bake it binarily - var b = new BinaryList(); - b.AddGuid(classId) - .AddUInt8((byte)className.Length) - .AddString(className) - .AddInt32(version) - .AddUInt16((ushort)members.Count); - - - foreach (var ft in functions) - b.AddUInt8Array(ft.Compose()); - foreach (var pt in properties) - b.AddUInt8Array(pt.Compose()); - foreach (var et in events) - b.AddUInt8Array(et.Compose()); - - content = b.ToArray(); - } - -*/ - TypeTemplate.parse(DC data, [int offset = 0, int? contentLength]) { // cool Dart feature contentLength ??= data.length; @@ -494,6 +296,7 @@ class TypeTemplate { _content = data.clip(offset, contentLength); var hasParent = (data.getUint8(offset) & 0x80) > 0; + var hasClassAnnotation = (data.getUint8(offset) & 0x40) > 0; _templateType = TemplateType.values[data.getUint8(offset++) & 0xF]; @@ -502,11 +305,22 @@ class TypeTemplate { _className = data.getString(offset + 1, data[offset]); offset += data[offset] + 1; + //print(" annotation : ${_className} ${hasAnnotation}"); + if (hasParent) { _parentId = data.getGuid(offset); offset += 16; } + if (hasClassAnnotation) { + var len = data.getUint16(offset); + offset += 2; + _annotation = data.getString(offset, len); + offset += len; + + //print("Has annotation ${_annotation}"); + } + _version = data.getInt32(offset); offset += 4; @@ -524,8 +338,8 @@ class TypeTemplate { if (type == 0) // function { - String? expansion = null; - var hasExpansion = ((data[offset++] & 0x10) == 0x10); + String? annotation = null; + var hasAnnotation = ((data[offset++] & 0x10) == 0x10); var name = data.getString(offset + 1, data[offset]); offset += data[offset] + 1; @@ -543,24 +357,24 @@ class TypeTemplate { offset += art.size; } - if (hasExpansion) // expansion ? + if (hasAnnotation) // annotation ? { var cs = data.getUint32(offset); offset += 4; - expansion = data.getString(offset, cs); + annotation = data.getString(offset, cs); offset += cs; } var ft = new FunctionTemplate(this, functionIndex++, name, inherited, - arguments, dt.type, expansion); + arguments, dt.type, annotation); _functions.add(ft); } else if (type == 1) // property { - String? readExpansion = null, writeExpansion = null; + String? readAnnotation = null, writeAnnotation = null; - var hasReadExpansion = ((data[offset] & 0x8) == 0x8); - var hasWriteExpansion = ((data[offset] & 0x10) == 0x10); + var hasReadAnnotation = ((data[offset] & 0x8) == 0x8); + var hasWriteAnnotation = ((data[offset] & 0x10) == 0x10); var recordable = ((data[offset] & 1) == 1); var permission = (data[offset++] >> 1) & 0x3; var name = data.getString(offset + 1, data[offset]); @@ -571,30 +385,30 @@ class TypeTemplate { offset += dt.size; - if (hasReadExpansion) // expansion ? + if (hasReadAnnotation) // annotation ? { var cs = data.getUint32(offset); offset += 4; - readExpansion = data.getString(offset, cs); + readAnnotation = data.getString(offset, cs); offset += cs; } - if (hasWriteExpansion) // expansion ? + if (hasWriteAnnotation) // annotation ? { var cs = data.getUint32(offset); offset += 4; - writeExpansion = data.getString(offset, cs); + writeAnnotation = data.getString(offset, cs); offset += cs; } var pt = new PropertyTemplate(this, propertyIndex++, name, inherited, - dt.type, readExpansion, writeExpansion, recordable); + dt.type, readAnnotation, writeAnnotation, recordable); _properties.add(pt); } else if (type == 2) // Event { - String? expansion = null; - var hasExpansion = ((data[offset] & 0x10) == 0x10); + String? annotation = null; + var hasAnnotation = ((data[offset] & 0x10) == 0x10); var listenable = ((data[offset++] & 0x8) == 0x8); var name = data.getString(offset + 1, data[offset]); @@ -604,21 +418,21 @@ class TypeTemplate { offset += dt.size; - if (hasExpansion) // expansion ? + if (hasAnnotation) // annotation ? { var cs = data.getUint32(offset); offset += 4; - expansion = data.getString(offset, cs); + annotation = data.getString(offset, cs); offset += cs; } var et = new EventTemplate(this, eventIndex++, name, inherited, dt.type, - expansion, listenable); + annotation, listenable); _events.add(et); } else if (type == 3) { - String? expansion = null; - var hasExpansion = ((data[offset++] & 0x10) == 0x10); + String? annotation = null; + var hasAnnotation = ((data[offset++] & 0x10) == 0x10); var name = data.getString(offset + 1, data[offset]); offset += data[offset] + 1; @@ -631,16 +445,16 @@ class TypeTemplate { offset += parsed.size; - if (hasExpansion) // expansion ? + if (hasAnnotation) // annotation ? { var cs = data.getUint32(offset); offset += 4; - expansion = data.getString(offset, cs); + annotation = data.getString(offset, cs); offset += cs; } var ct = new ConstantTemplate(this, constantIndex++, name, inherited, - dt.type, parsed.reply.result, expansion); + dt.type, parsed.reply.result, annotation); _constants.add(ct); } diff --git a/pubspec.yaml b/pubspec.yaml index df0193d..bfbcce1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: esiur description: Distributed Object Framework. -version: 2.0.2 +version: 2.0.3 #author: Ahmed Zamil homepage: https://github.com/esiur/esiur-dart