ranger-compiler 3.0.4 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rgrc.js CHANGED
@@ -399,7 +399,7 @@ class RangerAppHashValue {
399
399
  class RangerAppValue {
400
400
  constructor() {
401
401
  this.double_value = 0.0; /** note: unused */
402
- this.string_value = ""; /** note: unused */
402
+ this.string_value = "";
403
403
  this.int_value = 0; /** note: unused */
404
404
  this.boolean_value = false; /** note: unused */
405
405
  }
@@ -862,6 +862,9 @@ class RangerAppClassDesc extends RangerAppParamDesc {
862
862
  this.is_system_union = false;
863
863
  this.is_template = false;
864
864
  this.is_serialized = false;
865
+ this.is_process = false;
866
+ this.process_path = "";
867
+ this.is_singleton = false;
865
868
  this.is_trait = false;
866
869
  this.is_operator_class = false;
867
870
  this.is_generic_instance = false;
@@ -1034,10 +1037,70 @@ class RangerAppClassDesc extends RangerAppParamDesc {
1034
1037
  };
1035
1038
  return res;
1036
1039
  };
1040
+ isSingletonClass () {
1041
+ if ( this.is_singleton ) {
1042
+ return true;
1043
+ }
1044
+ if ( (typeof(this.nameNode) === "undefined") == false ) {
1045
+ if ( this.nameNode.hasFlag("singleton") ) {
1046
+ return true;
1047
+ }
1048
+ }
1049
+ if ( (typeof(this.classNode) === "undefined") == false ) {
1050
+ if ( this.classNode.hasBooleanProperty("singleton") ) {
1051
+ return true;
1052
+ }
1053
+ }
1054
+ return false;
1055
+ };
1056
+ buildSingletonAccessor () {
1057
+ let res;
1058
+ if ( this.isSingletonClass() == false ) {
1059
+ return res;
1060
+ }
1061
+ let nodeForFactory;
1062
+ if ( (typeof(this.classNode) === "undefined") == false ) {
1063
+ nodeForFactory = this.classNode;
1064
+ } else {
1065
+ nodeForFactory = this.nameNode;
1066
+ }
1067
+ if ( typeof(nodeForFactory) === "undefined" ) {
1068
+ return res;
1069
+ }
1070
+ const factoryNode = nodeForFactory;
1071
+ const m = new RangerAppFunctionDesc();
1072
+ m.name = "__singleton";
1073
+ m.compiledName = "__singleton";
1074
+ m.is_static = true;
1075
+ m.container_class = this;
1076
+ const methodNameNode = factoryNode.newVRefNode("__singleton");
1077
+ methodNameNode.type_name = this.name;
1078
+ methodNameNode.value_type = 11;
1079
+ m.nameNode = methodNameNode;
1080
+ if ( this.has_constructor ) {
1081
+ const constr = this.constructor_fn;
1082
+ for ( let i = 0; i < constr.params.length; i++) {
1083
+ var arg = constr.params[i];
1084
+ m.params.push(arg);
1085
+ };
1086
+ }
1087
+ res = m;
1088
+ return res;
1089
+ };
1037
1090
  hasStaticMethod (m_name) {
1091
+ if ( m_name == "__singleton" ) {
1092
+ if ( this.isSingletonClass() ) {
1093
+ return true;
1094
+ }
1095
+ }
1038
1096
  return ( typeof(this.defined_static_methods[m_name] ) != "undefined" && this.defined_static_methods.hasOwnProperty(m_name) );
1039
1097
  };
1040
1098
  findStaticMethod (f_name) {
1099
+ if ( f_name == "__singleton" ) {
1100
+ if ( this.isSingletonClass() ) {
1101
+ return this.buildSingletonAccessor();
1102
+ }
1103
+ }
1041
1104
  let e;
1042
1105
  for ( let i = 0; i < this.static_methods.length; i++) {
1043
1106
  var m = this.static_methods[i];
@@ -2952,7 +3015,7 @@ class RangerAppWriterContext {
2952
3015
  this.expr_restart = false;
2953
3016
  this.expr_restart_block = false;
2954
3017
  this.in_lhs_of_assignment = false;
2955
- this.in_method = false; /** note: unused */
3018
+ this.in_method = false;
2956
3019
  this.method_stack = [];
2957
3020
  this.typeNames = []; /** note: unused */
2958
3021
  this.typeClasses = {};
@@ -5081,6 +5144,70 @@ class RangerLispParser {
5081
5144
  };
5082
5145
  return 0;
5083
5146
  };
5147
+ isComparisonOpPred (pred) {
5148
+ if ( pred == 10 ) {
5149
+ return true;
5150
+ }
5151
+ if ( pred == 11 ) {
5152
+ return true;
5153
+ }
5154
+ return false;
5155
+ };
5156
+ isDotVRef (n) {
5157
+ if ( n.parsed_type != 11 ) {
5158
+ return false;
5159
+ }
5160
+ if ( (n.vref.indexOf(".")) >= 0 ) {
5161
+ return true;
5162
+ }
5163
+ if ( (n.ns.length) >= 2 ) {
5164
+ return true;
5165
+ }
5166
+ return false;
5167
+ };
5168
+ isDotCallPairOnNode (node) {
5169
+ if ( (node.children.length) != 2 ) {
5170
+ return false;
5171
+ }
5172
+ const ch0 = node.children[0];
5173
+ return this.isDotVRef(ch0);
5174
+ };
5175
+ foldDotCallPairToGroup (node) {
5176
+ if ( this.isDotCallPairOnNode(node) == false ) {
5177
+ return;
5178
+ }
5179
+ const ch0 = node.children.splice(0, 1).pop();
5180
+ const ch1 = node.children.splice(0, 1).pop();
5181
+ const callGroup = new CodeNode(this.code, ch0.sp, ch1.ep);
5182
+ callGroup.expression = true;
5183
+ ch0.parent = callGroup;
5184
+ ch1.parent = callGroup;
5185
+ callGroup.children.push(ch0);
5186
+ callGroup.children.push(ch1);
5187
+ node.children.push(callGroup);
5188
+ };
5189
+ tryCloseCallArgParenBeforeInfix () {
5190
+ const pr = this.curr_node.parent;
5191
+ if ( typeof(pr) === "undefined" ) {
5192
+ return false;
5193
+ }
5194
+ if ( (this.curr_node.children.length) < 1 ) {
5195
+ return false;
5196
+ }
5197
+ const prCnt = pr.children.length;
5198
+ if ( prCnt < 2 ) {
5199
+ return false;
5200
+ }
5201
+ const prevCh = pr.children[(prCnt - 2)];
5202
+ if ( this.isDotVRef(prevCh) == false ) {
5203
+ return false;
5204
+ }
5205
+ this.paren_cnt = this.paren_cnt - 1;
5206
+ this.parents.pop();
5207
+ this.curr_node.ep = this.i;
5208
+ this.curr_node = pr;
5209
+ return true;
5210
+ };
5084
5211
  insert_node (p_node) {
5085
5212
  let push_target = this.curr_node;
5086
5213
  if ( this.curr_node.infix_operator ) {
@@ -5805,6 +5932,15 @@ class RangerLispParser {
5805
5932
  this.curr_node.infix_operator = false;
5806
5933
  continue;
5807
5934
  }
5935
+ if ( this.isComparisonOpPred(op_pred) ) {
5936
+ this.tryCloseCallArgParenBeforeInfix();
5937
+ }
5938
+ if ( this.isComparisonOpPred(op_pred) && (false == this.curr_node.infix_operator) ) {
5939
+ const cn = this.curr_node;
5940
+ if ( this.isDotCallPairOnNode(cn) ) {
5941
+ this.foldDotCallPairToGroup(cn);
5942
+ }
5943
+ }
5808
5944
  let pTarget = this.curr_node;
5809
5945
  if ( this.curr_node.infix_operator ) {
5810
5946
  const iNode = this.curr_node.infix_node;
@@ -7332,6 +7468,369 @@ class RangerImmutableExtension {
7332
7468
  wr.out("}", true);
7333
7469
  };
7334
7470
  }
7471
+ class RangerProcessLifecycle {
7472
+ constructor() {
7473
+ }
7474
+ emitInvokeMethods (cl, wr, regName) {
7475
+ if ( cl.hasMethod("start") ) {
7476
+ wr.out("fn __rangerInvokeStart:void () {", true);
7477
+ wr.indent(1);
7478
+ wr.out("this.start()", true);
7479
+ wr.indent(-1);
7480
+ wr.out("}", true);
7481
+ }
7482
+ if ( cl.hasMethod("stop") ) {
7483
+ wr.out("fn __rangerInvokeStop:void () {", true);
7484
+ wr.indent(1);
7485
+ wr.out("this.stop()", true);
7486
+ wr.indent(-1);
7487
+ wr.out("}", true);
7488
+ }
7489
+ if ( cl.hasMethod("hibernate") ) {
7490
+ wr.out("fn __rangerInvokeHibernate:string () {", true);
7491
+ wr.indent(1);
7492
+ wr.out("return this.hibernate()", true);
7493
+ wr.indent(-1);
7494
+ wr.out("}", true);
7495
+ }
7496
+ if ( cl.hasMethod("wakeup") ) {
7497
+ wr.out("fn __rangerInvokeWakeup:void (state:string) {", true);
7498
+ wr.indent(1);
7499
+ wr.out("this.wakeup(state)", true);
7500
+ wr.indent(-1);
7501
+ wr.out("}", true);
7502
+ }
7503
+ };
7504
+ emitStopSubtree (cl, wr, regName) {
7505
+ wr.out("fn __rangerStopSubtree:void () {", true);
7506
+ wr.indent(1);
7507
+ wr.out("if (this.__rangerId == 0) {", true);
7508
+ wr.indent(1);
7509
+ wr.out("return", true);
7510
+ wr.indent(-1);
7511
+ wr.out("}", true);
7512
+ wr.out("def __rgrIdx 0", true);
7513
+ wr.out("while (__rgrIdx < (size this.__rangerChildren)) {", true);
7514
+ wr.indent(1);
7515
+ wr.out("def __rgrChild:RangerProcessBase (at this.__rangerChildren __rgrIdx)", true);
7516
+ wr.out("__rgrChild.__rangerStopSubtree()", true);
7517
+ wr.out("__rgrIdx = __rgrIdx + 1", true);
7518
+ wr.indent(-1);
7519
+ wr.out("}", true);
7520
+ if ( cl.hasMethod("stop") ) {
7521
+ wr.out("this.__rangerInvokeStop()", true);
7522
+ }
7523
+ wr.out(regName + ".__singleton().untrack(this)", true);
7524
+ wr.out("this.__rangerUnregister()", true);
7525
+ wr.out("this.__rangerClearChildren()", true);
7526
+ wr.indent(-1);
7527
+ wr.out("}", true);
7528
+ };
7529
+ }
7530
+ class RangerProcessClass {
7531
+ constructor() {
7532
+ }
7533
+ emitAssignProcessId (wr) {
7534
+ wr.out("def __rgrIdReg (ProcessIdRegistry.__singleton())", true);
7535
+ wr.out("def __rgrNewId ( __rgrIdReg.allocate() )", true);
7536
+ wr.out("this.__rangerId = __rgrNewId", true);
7537
+ };
7538
+ createProcessExtension (cl, ctx, wr, typeId) {
7539
+ wr.out("Import \"RangerProcess.rgr\"", true);
7540
+ const regName = cl.name + "__Registry";
7541
+ const life = new RangerProcessLifecycle();
7542
+ wr.out(("class " + regName) + " @singleton(true) {", true);
7543
+ wr.indent(1);
7544
+ wr.out(("def items:[" + cl.name) + "]", true);
7545
+ wr.out(("fn track:void (inst:" + cl.name) + ") {", true);
7546
+ wr.indent(1);
7547
+ wr.out("push items inst", true);
7548
+ wr.indent(-1);
7549
+ wr.out("}", true);
7550
+ wr.out(("fn untrack:void (inst:" + cl.name) + ") {", true);
7551
+ wr.indent(1);
7552
+ wr.out(("def kept:[" + cl.name) + "]", true);
7553
+ wr.out(("for items x:" + cl.name) + " i {", true);
7554
+ wr.indent(1);
7555
+ wr.out("if (x.__rangerId != inst.__rangerId) {", true);
7556
+ wr.indent(1);
7557
+ wr.out("push kept x", true);
7558
+ wr.indent(-1);
7559
+ wr.out("}", true);
7560
+ wr.indent(-1);
7561
+ wr.out("}", true);
7562
+ wr.out("items = kept", true);
7563
+ wr.indent(-1);
7564
+ wr.out("}", true);
7565
+ wr.out(("fn all:[" + cl.name) + "] () {", true);
7566
+ wr.indent(1);
7567
+ wr.out("return items", true);
7568
+ wr.indent(-1);
7569
+ wr.out("}", true);
7570
+ wr.out("fn stopAllInstances:void () {", true);
7571
+ wr.indent(1);
7572
+ wr.out("def n (size items)", true);
7573
+ wr.out("def i (n - 1)", true);
7574
+ wr.out("while (i >= 0) {", true);
7575
+ wr.indent(1);
7576
+ wr.out(("def inst:" + cl.name) + " (at items i)", true);
7577
+ wr.out("if (inst.__rangerId != 0) {", true);
7578
+ wr.indent(1);
7579
+ wr.out("inst.__rangerStopSubtree()", true);
7580
+ wr.indent(-1);
7581
+ wr.out("}", true);
7582
+ wr.out("i = i - 1", true);
7583
+ wr.indent(-1);
7584
+ wr.out("}", true);
7585
+ wr.indent(-1);
7586
+ wr.out("}", true);
7587
+ wr.indent(-1);
7588
+ wr.out("}", true);
7589
+ wr.out(("extension " + cl.name) + " {", true);
7590
+ wr.indent(1);
7591
+ wr.out("fn __rangerRegisterRoot () {", true);
7592
+ wr.indent(1);
7593
+ wr.out(("this.__rangerClassName = \"" + cl.name) + "\"", true);
7594
+ wr.out("this.__rangerTypeId = " + ("" + typeId), true);
7595
+ this.emitAssignProcessId(wr);
7596
+ wr.out(regName + ".__singleton().track(this)", true);
7597
+ wr.indent(-1);
7598
+ wr.out("}", true);
7599
+ wr.out("fn __rangerRegisterChild (parent:RangerProcessBase) {", true);
7600
+ wr.indent(1);
7601
+ wr.out(("this.__rangerClassName = \"" + cl.name) + "\"", true);
7602
+ wr.out("this.__rangerTypeId = " + ("" + typeId), true);
7603
+ wr.out("this.__rangerParent = parent", true);
7604
+ wr.out("this.__rangerParentId = parent.__rangerId", true);
7605
+ this.emitAssignProcessId(wr);
7606
+ wr.out("parent.__rangerTrackChild(this)", true);
7607
+ wr.out(regName + ".__singleton().track(this)", true);
7608
+ wr.indent(-1);
7609
+ wr.out("}", true);
7610
+ wr.out("fn __rangerUnregister:void () {", true);
7611
+ wr.indent(1);
7612
+ wr.out("this.__rangerId = 0", true);
7613
+ wr.out("this.__rangerParentId = 0", true);
7614
+ wr.indent(-1);
7615
+ wr.out("}", true);
7616
+ life.emitInvokeMethods(cl, wr, regName);
7617
+ life.emitStopSubtree(cl, wr, regName);
7618
+ this.emitStaticHelpers(cl, typeId, wr, regName);
7619
+ if ( (cl.process_path.length) > 0 ) {
7620
+ wr.out("sfn processPath:string () {", true);
7621
+ wr.indent(1);
7622
+ wr.out(("return \"" + cl.process_path) + "\"", true);
7623
+ wr.indent(-1);
7624
+ wr.out("}", true);
7625
+ }
7626
+ wr.out("sfn stopAllLive:void () {", true);
7627
+ wr.indent(1);
7628
+ wr.out(((("def __rgrReg:" + regName) + " (") + regName) + ".__singleton())", true);
7629
+ wr.out("__rgrReg.stopAllInstances()", true);
7630
+ wr.indent(-1);
7631
+ wr.out("}", true);
7632
+ wr.indent(-1);
7633
+ wr.out("}", true);
7634
+ };
7635
+ emitStaticHelpers (cl, typeId, wr, regName) {
7636
+ wr.out(("sfn allInstances:[" + cl.name) + "] () {", true);
7637
+ wr.indent(1);
7638
+ wr.out(((("def __rgrReg:" + regName) + " (") + regName) + ".__singleton())", true);
7639
+ wr.out("return __rgrReg.items", true);
7640
+ wr.indent(-1);
7641
+ wr.out("}", true);
7642
+ wr.out("sfn tryStopByProcessId:boolean (processId:int) {", true);
7643
+ wr.indent(1);
7644
+ wr.out(((("def __rgrReg:" + regName) + " (") + regName) + ".__singleton())", true);
7645
+ wr.out(("for __rgrReg.items inst:" + cl.name) + " i {", true);
7646
+ wr.indent(1);
7647
+ wr.out("if (inst.__rangerId == processId) {", true);
7648
+ wr.indent(1);
7649
+ wr.out("if (inst.__rangerId != 0) {", true);
7650
+ wr.indent(1);
7651
+ wr.out("inst.__rangerStopSubtree()", true);
7652
+ wr.out("return true", true);
7653
+ wr.indent(-1);
7654
+ wr.out("}", true);
7655
+ wr.indent(-1);
7656
+ wr.out("}", true);
7657
+ wr.indent(-1);
7658
+ wr.out("}", true);
7659
+ wr.out("return false", true);
7660
+ wr.indent(-1);
7661
+ wr.out("}", true);
7662
+ wr.out("sfn parentIdOf:int (child:RangerProcessBase) {", true);
7663
+ wr.indent(1);
7664
+ wr.out("def cur@(optional):RangerProcessBase (child.__rangerParent)", true);
7665
+ wr.out("while ((null? cur) == false) {", true);
7666
+ wr.indent(1);
7667
+ wr.out("def node:RangerProcessBase (unwrap cur)", true);
7668
+ wr.out("def __rgrExpectType:int " + ("" + typeId), true);
7669
+ wr.out("if (node.__rangerTypeId != __rgrExpectType) {", true);
7670
+ wr.indent(1);
7671
+ wr.out("cur = node.__rangerParent", true);
7672
+ wr.indent(-1);
7673
+ wr.out("} {", true);
7674
+ wr.indent(1);
7675
+ wr.out("return node.__rangerId", true);
7676
+ wr.indent(-1);
7677
+ wr.out("}", true);
7678
+ wr.indent(-1);
7679
+ wr.out("}", true);
7680
+ wr.out("return 0", true);
7681
+ wr.indent(-1);
7682
+ wr.out("}", true);
7683
+ };
7684
+ emitProcessNameRegistryExtension (processClasses, wr) {
7685
+ wr.out("Import \"RangerProcess.rgr\"", true);
7686
+ wr.out("extension ProcessNameRegistry {", true);
7687
+ wr.indent(1);
7688
+ wr.out("fn bindIfConfigured:void (proc:RangerProcessBase) {", true);
7689
+ wr.indent(1);
7690
+ wr.out("if (proc.__rangerId == 0) {", true);
7691
+ wr.indent(1);
7692
+ wr.out("return", true);
7693
+ wr.indent(-1);
7694
+ wr.out("}", true);
7695
+ let hasNamed = false;
7696
+ for ( let i = 0; i < processClasses.length; i++) {
7697
+ var cl = processClasses[i];
7698
+ if ( (cl.process_path.length) > 0 ) {
7699
+ hasNamed = true;
7700
+ }
7701
+ };
7702
+ if ( hasNamed ) {
7703
+ for ( let i_1 = 0; i_1 < processClasses.length; i_1++) {
7704
+ var cl_1 = processClasses[i_1];
7705
+ if ( (cl_1.process_path.length) == 0 ) {
7706
+ continue;
7707
+ }
7708
+ const typeId = i_1 + 1;
7709
+ wr.out(("if (proc.__rangerTypeId == " + ("" + typeId)) + ") {", true);
7710
+ wr.indent(1);
7711
+ wr.out(("proc.__rangerPath = \"" + cl_1.process_path) + "\"", true);
7712
+ wr.out(("this.register(\"" + cl_1.process_path) + "\" proc)", true);
7713
+ wr.out("return", true);
7714
+ wr.indent(-1);
7715
+ wr.out("}", true);
7716
+ };
7717
+ }
7718
+ wr.indent(-1);
7719
+ wr.out("}", true);
7720
+ wr.out("fn findProcess@(optional):RangerProcessBase (path:string) {", true);
7721
+ wr.indent(1);
7722
+ wr.out("if (this.hasLive(path)) {", true);
7723
+ wr.indent(1);
7724
+ wr.out("return (this.findByPath(path))", true);
7725
+ wr.indent(-1);
7726
+ wr.out("}", true);
7727
+ wr.out("return (get byPath \"__rgr_no_such_process__\")", true);
7728
+ wr.indent(-1);
7729
+ wr.out("}", true);
7730
+ wr.indent(-1);
7731
+ wr.out("}", true);
7732
+ };
7733
+ emitProcessRuntimeExtension (processClasses, wr) {
7734
+ wr.out("Import \"RangerProcess.rgr\"", true);
7735
+ wr.out("extension ProcessRuntime {", true);
7736
+ wr.indent(1);
7737
+ wr.out("sfn collectAllLiveRoots:[RangerProcessBase] () {", true);
7738
+ wr.indent(1);
7739
+ wr.out("def roots:[RangerProcessBase]", true);
7740
+ for ( let i = 0; i < processClasses.length; i++) {
7741
+ var cl = processClasses[i];
7742
+ wr.out(((("def __rgr_" + cl.name) + "_all ( ") + cl.name) + ".allInstances() )", true);
7743
+ wr.out(((("for __rgr_" + cl.name) + "_all __rgrRoot:") + cl.name) + " i {", true);
7744
+ wr.indent(1);
7745
+ wr.out("if (__rgrRoot.__rangerId != 0 && __rgrRoot.__rangerParentId == 0) {", true);
7746
+ wr.indent(1);
7747
+ wr.out("push roots __rgrRoot", true);
7748
+ wr.indent(-1);
7749
+ wr.out("}", true);
7750
+ wr.indent(-1);
7751
+ wr.out("}", true);
7752
+ };
7753
+ wr.out("return roots", true);
7754
+ wr.indent(-1);
7755
+ wr.out("}", true);
7756
+ wr.out("sfn printProcessTree:void () {", true);
7757
+ wr.indent(1);
7758
+ wr.out("def __rgrTreeView (new ProcessTreeView)", true);
7759
+ wr.out("def __rgrRoots (ProcessRuntime.collectAllLiveRoots())", true);
7760
+ wr.out("def __rgrTitle \"\"", true);
7761
+ wr.out("__rgrTreeView.renderRoots(__rgrRoots __rgrTitle)", true);
7762
+ wr.indent(-1);
7763
+ wr.out("}", true);
7764
+ wr.out("sfn printProcessTreeTitled:void (title:string) {", true);
7765
+ wr.indent(1);
7766
+ wr.out("def __rgrTreeView (new ProcessTreeView)", true);
7767
+ wr.out("def __rgrRoots (ProcessRuntime.collectAllLiveRoots())", true);
7768
+ wr.out("__rgrTreeView.renderRoots(__rgrRoots title)", true);
7769
+ wr.indent(-1);
7770
+ wr.out("}", true);
7771
+ wr.out("sfn stopByProcessId:void (processId:int) {", true);
7772
+ wr.indent(1);
7773
+ for ( let i_1 = 0; i_1 < processClasses.length; i_1++) {
7774
+ var cl_1 = processClasses[i_1];
7775
+ wr.out(("if (" + cl_1.name) + ".tryStopByProcessId(processId)) {", true);
7776
+ wr.indent(1);
7777
+ wr.out("return", true);
7778
+ wr.indent(-1);
7779
+ wr.out("}", true);
7780
+ };
7781
+ wr.indent(-1);
7782
+ wr.out("}", true);
7783
+ wr.out("sfn stopByClassName:void (name:string) {", true);
7784
+ wr.indent(1);
7785
+ for ( let i_2 = 0; i_2 < processClasses.length; i_2++) {
7786
+ var cl_2 = processClasses[i_2];
7787
+ wr.out(("if (name == \"" + cl_2.name) + "\") {", true);
7788
+ wr.indent(1);
7789
+ wr.out(cl_2.name + ".stopAllLive()", true);
7790
+ wr.out("return", true);
7791
+ wr.indent(-1);
7792
+ wr.out("}", true);
7793
+ };
7794
+ wr.indent(-1);
7795
+ wr.out("}", true);
7796
+ wr.indent(-1);
7797
+ wr.out("}", true);
7798
+ };
7799
+ emitProcessTypeScriptHelpers (processClasses, wr) {
7800
+ let namedPaths = [];
7801
+ let namedClasses = [];
7802
+ for ( let i = 0; i < processClasses.length; i++) {
7803
+ var cl = processClasses[i];
7804
+ if ( (cl.process_path.length) > 0 ) {
7805
+ namedPaths.push(cl.process_path);
7806
+ namedClasses.push(cl);
7807
+ }
7808
+ };
7809
+ if ( (namedPaths.length) == 0 ) {
7810
+ return;
7811
+ }
7812
+ wr.raw("", true);
7813
+ wr.raw("// @process named-path helpers (generated)", true);
7814
+ wr.raw("export type ProcessPath = ", false);
7815
+ let pathIdx = 0;
7816
+ for ( let i_1 = 0; i_1 < namedPaths.length; i_1++) {
7817
+ var p = namedPaths[i_1];
7818
+ if ( pathIdx > 0 ) {
7819
+ wr.raw(" | ", false);
7820
+ }
7821
+ wr.raw(("\"" + p) + "\"", false);
7822
+ pathIdx = pathIdx + 1;
7823
+ };
7824
+ wr.raw(";", true);
7825
+ wr.raw("export interface ProcessNameRegistry {", true);
7826
+ for ( let i_2 = 0; i_2 < namedClasses.length; i_2++) {
7827
+ var cl_1 = namedClasses[i_2];
7828
+ wr.raw((((" findProcess(path: \"" + cl_1.process_path) + "\"): ") + cl_1.name) + " | undefined;", true);
7829
+ };
7830
+ wr.raw(" findProcess(path: string): RangerProcessBase | undefined;", true);
7831
+ wr.raw("}", true);
7832
+ };
7833
+ }
7335
7834
  class RangerServiceBuilder {
7336
7835
  constructor() {
7337
7836
  }
@@ -7589,6 +8088,7 @@ class RangerFlowParser {
7589
8088
  this.walkAlso = [];
7590
8089
  this.serializedClasses = [];
7591
8090
  this.immutableClasses = [];
8091
+ this.processClasses = [];
7592
8092
  this.classesWithTraits = [];
7593
8093
  this.collectedIntefaces = [];
7594
8094
  this.definedInterfaces = {}; /** note: unused */
@@ -10505,16 +11005,82 @@ class RangerFlowParser {
10505
11005
  await this.WalkCollectMethods(rn_1, cl_2.ctx, wr);
10506
11006
  this.walkAlso.push(rn_1);
10507
11007
  };
10508
- for ( let i_8 = 0; i_8 < ctx.definedClassList.length; i_8++) {
10509
- var cname = ctx.definedClassList[i_8];
11008
+ if ( (this.processClasses.length) > 0 ) {
11009
+ const baseDesc = ctx.findClass("RangerProcessBase");
11010
+ if ( (typeof(baseDesc) === "undefined") == false ) {
11011
+ const baseCl = baseDesc;
11012
+ baseCl.is_extended_by_children = true;
11013
+ }
11014
+ this.validateProcessPaths(this.processClasses, ctx);
11015
+ const procRtGen = new RangerProcessClass();
11016
+ const rtWr = new CodeWriter();
11017
+ const nameRegWr = new CodeWriter();
11018
+ procRtGen.emitProcessNameRegistryExtension(this.processClasses, nameRegWr);
11019
+ const nameRegCode = nameRegWr.getCode();
11020
+ const nameRegSrc = new SourceCode(nameRegCode);
11021
+ nameRegSrc.filename = "extension ProcessNameRegistry";
11022
+ const nameRegParser = new RangerLispParser(nameRegSrc);
11023
+ nameRegParser.parse(ctx.hasCompilerFlag("no-op-transform"));
11024
+ const nameRegRn = nameRegParser.rootNode;
11025
+ await this.WalkCollectMethods(nameRegRn, ctx, wr);
11026
+ this.walkAlso.push(nameRegRn);
11027
+ procRtGen.emitProcessRuntimeExtension(this.processClasses, rtWr);
11028
+ const rtCode = rtWr.getCode();
11029
+ const rtSrc = new SourceCode(rtCode);
11030
+ rtSrc.filename = "extension ProcessRuntime";
11031
+ const rtParser = new RangerLispParser(rtSrc);
11032
+ rtParser.parse(ctx.hasCompilerFlag("no-op-transform"));
11033
+ const rtRn = rtParser.rootNode;
11034
+ await this.WalkCollectMethods(rtRn, ctx, wr);
11035
+ this.walkAlso.push(rtRn);
11036
+ if ( ctx.hasCompilerFlag("typescript") ) {
11037
+ const tsWr = new CodeWriter();
11038
+ procRtGen.emitProcessTypeScriptHelpers(this.processClasses, tsWr);
11039
+ ctx.compilerSettings["processTsHelpers"] = tsWr.getCode();
11040
+ }
11041
+ }
11042
+ for ( let i_8 = 0; i_8 < this.processClasses.length; i_8++) {
11043
+ var cl_3 = this.processClasses[i_8];
11044
+ cl_3.is_process = true;
11045
+ let hasProcessBase = false;
11046
+ for ( let i_9 = 0; i_9 < cl_3.extends_classes.length; i_9++) {
11047
+ var extName = cl_3.extends_classes[i_9];
11048
+ if ( extName == "RangerProcessBase" ) {
11049
+ hasProcessBase = true;
11050
+ }
11051
+ };
11052
+ if ( hasProcessBase == false ) {
11053
+ cl_3.extends_classes.push("RangerProcessBase");
11054
+ const parentDesc = ctx.findClass("RangerProcessBase");
11055
+ if ( (typeof(parentDesc) === "undefined") == false ) {
11056
+ const parentCl = parentDesc;
11057
+ parentCl.is_extended_by_children = true;
11058
+ parentCl.is_inherited = true;
11059
+ }
11060
+ }
11061
+ const procGen = new RangerProcessClass();
11062
+ const extWr_2 = new CodeWriter();
11063
+ const processTypeId = i_8 + 1;
11064
+ procGen.createProcessExtension(cl_3, cl_3.ctx, extWr_2, processTypeId);
11065
+ const theCode_2 = extWr_2.getCode();
11066
+ const code_2 = new SourceCode(theCode_2);
11067
+ code_2.filename = "extension " + cl_3.name;
11068
+ const parser_2 = new RangerLispParser(code_2);
11069
+ parser_2.parse(ctx.hasCompilerFlag("no-op-transform"));
11070
+ const rn_2 = parser_2.rootNode;
11071
+ await this.WalkCollectMethods(rn_2, cl_3.ctx, wr);
11072
+ this.walkAlso.push(rn_2);
11073
+ };
11074
+ for ( let i_10 = 0; i_10 < ctx.definedClassList.length; i_10++) {
11075
+ var cname = ctx.definedClassList[i_10];
10510
11076
  allTypes.push(cname);
10511
11077
  const c = (( ctx.definedClasses.hasOwnProperty(cname) ? ctx.definedClasses[cname] : undefined ));
10512
11078
  if ( ((c.is_system || c.is_interface) || c.is_template) || c.is_trait ) {
10513
11079
  continue;
10514
11080
  }
10515
11081
  let varNames = {};
10516
- for ( let i_9 = 0; i_9 < c.variables.length; i_9++) {
10517
- var p = c.variables[i_9];
11082
+ for ( let i_11 = 0; i_11 < c.variables.length; i_11++) {
11083
+ var p = c.variables[i_11];
10518
11084
  ctx.hadValidType(p.nameNode);
10519
11085
  varNames[p.name] = true;
10520
11086
  };
@@ -10526,8 +11092,8 @@ class RangerFlowParser {
10526
11092
  }));
10527
11093
  }));
10528
11094
  };
10529
- for ( let i_10 = 0; i_10 < ctx.definedClassList.length; i_10++) {
10530
- var cname_1 = ctx.definedClassList[i_10];
11095
+ for ( let i_12 = 0; i_12 < ctx.definedClassList.length; i_12++) {
11096
+ var cname_1 = ctx.definedClassList[i_12];
10531
11097
  allTypes.push(cname_1);
10532
11098
  };
10533
11099
  allTypes.push("int");
@@ -10542,8 +11108,8 @@ class RangerFlowParser {
10542
11108
  rootCtx.addClass("Any", new_class);
10543
11109
  new_class.is_union = true;
10544
11110
  let did_push = {};
10545
- for ( let i_11 = 0; i_11 < allTypes.length; i_11++) {
10546
- var typeName_1 = allTypes[i_11];
11111
+ for ( let i_13 = 0; i_13 < allTypes.length; i_13++) {
11112
+ var typeName_1 = allTypes[i_13];
10547
11113
  if ( ( typeof(did_push[typeName_1] ) != "undefined" && did_push.hasOwnProperty(typeName_1) ) ) {
10548
11114
  continue;
10549
11115
  }
@@ -10999,6 +11565,10 @@ class RangerFlowParser {
10999
11565
  this.immutableClasses.push(new_class_6);
11000
11566
  new_class_6.is_immutable = true;
11001
11567
  }
11568
+ this.applyProcessClassMeta(new_class_6, classNameNode_1, node, ctx);
11569
+ if ( node.hasBooleanProperty("singleton") ) {
11570
+ new_class_6.is_singleton = true;
11571
+ }
11002
11572
  const third = node.getThird();
11003
11573
  if ( third.vref == "extends" ) {
11004
11574
  if ( node.chlen() >= 4 ) {
@@ -11327,6 +11897,22 @@ class RangerFlowParser {
11327
11897
  if ( node.hasBooleanProperty("serialize") ) {
11328
11898
  this.serializedClasses.push(ctx.currentClass);
11329
11899
  }
11900
+ if ( node.hasBooleanProperty("process") ) {
11901
+ const procCl = ctx.currentClass;
11902
+ procCl.is_process = true;
11903
+ const procNameNode = procCl.nameNode;
11904
+ if ( (typeof(procNameNode) === "undefined") == false ) {
11905
+ const pn = procNameNode;
11906
+ const procPath = this.readProcessPathFromClassTree(node);
11907
+ if ( (procPath.length) > 0 ) {
11908
+ procCl.process_path = procPath;
11909
+ }
11910
+ }
11911
+ }
11912
+ if ( node.hasBooleanProperty("singleton") ) {
11913
+ const singletonCl = ctx.currentClass;
11914
+ singletonCl.is_singleton = true;
11915
+ }
11330
11916
  };
11331
11917
  findFunctionDesc (obj, ctx, wr) {
11332
11918
  let varDesc;
@@ -11714,6 +12300,142 @@ class RangerFlowParser {
11714
12300
  ctx.addError(n1, msg);
11715
12301
  }
11716
12302
  };
12303
+ readProcessPathFromClassTree (root) {
12304
+ const path = root.getStringProperty("name");
12305
+ if ( (path.length) > 0 ) {
12306
+ return path;
12307
+ }
12308
+ if ( root.hasExpressionProperty("name") ) {
12309
+ const ann = root.getExpressionProperty("name");
12310
+ if ( (typeof(ann) === "undefined") == false ) {
12311
+ const an = ann;
12312
+ if ( (an.children.length) > 0 ) {
12313
+ const fc = an.children[0];
12314
+ if ( fc.value_type == 4 ) {
12315
+ return fc.string_value;
12316
+ }
12317
+ }
12318
+ if ( an.value_type == 4 ) {
12319
+ return an.string_value;
12320
+ }
12321
+ }
12322
+ }
12323
+ for ( let i = 0; i < root.children.length; i++) {
12324
+ var ch = root.children[i];
12325
+ const childPath = this.readProcessPathFromClassTree(ch);
12326
+ if ( (childPath.length) > 0 ) {
12327
+ return childPath;
12328
+ }
12329
+ };
12330
+ return "";
12331
+ };
12332
+ applyProcessClassMeta (cl, classNameNode, node, ctx) {
12333
+ let isProc = false;
12334
+ if ( classNameNode.hasFlag("process") ) {
12335
+ isProc = true;
12336
+ }
12337
+ if ( node.hasBooleanProperty("process") ) {
12338
+ isProc = true;
12339
+ }
12340
+ const procPathOnly = this.readProcessPathFromClassTree(node);
12341
+ if ( isProc == false ) {
12342
+ if ( (procPathOnly.length) > 0 ) {
12343
+ ctx.addError(classNameNode, "@name is only allowed on @process classes");
12344
+ }
12345
+ return;
12346
+ }
12347
+ this.processClasses.push(cl);
12348
+ cl.is_process = true;
12349
+ if ( (procPathOnly.length) > 0 ) {
12350
+ cl.process_path = procPathOnly;
12351
+ }
12352
+ };
12353
+ resolveProcessPathFromFields (cl) {
12354
+ for ( let i = 0; i < cl.variables.length; i++) {
12355
+ var v = cl.variables[i];
12356
+ if ( v.name != "__rangerProcessName" ) {
12357
+ continue;
12358
+ }
12359
+ if ( v.def_value.value_type == 4 ) {
12360
+ cl.process_path = v.def_value.string_value;
12361
+ return;
12362
+ }
12363
+ if ( (v.value.string_value.length) > 0 ) {
12364
+ cl.process_path = v.value.string_value;
12365
+ return;
12366
+ }
12367
+ };
12368
+ };
12369
+ validateProcessPaths (processClasses, ctx) {
12370
+ for ( let i = 0; i < processClasses.length; i++) {
12371
+ var cl = processClasses[i];
12372
+ if ( (cl.process_path.length) == 0 ) {
12373
+ const classNode = cl.node;
12374
+ if ( (typeof(classNode) === "undefined") == false ) {
12375
+ const cn = classNode;
12376
+ const resolvedCn = this.readProcessPathFromClassTree(cn);
12377
+ if ( (resolvedCn.length) > 0 ) {
12378
+ cl.process_path = resolvedCn;
12379
+ }
12380
+ }
12381
+ const nameNode = cl.nameNode;
12382
+ if ( (cl.process_path.length) == 0 ) {
12383
+ if ( (typeof(nameNode) === "undefined") == false ) {
12384
+ const nn = nameNode;
12385
+ const resolvedNn = this.readProcessPathFromClassTree(nn);
12386
+ if ( (resolvedNn.length) > 0 ) {
12387
+ cl.process_path = resolvedNn;
12388
+ }
12389
+ }
12390
+ }
12391
+ if ( (cl.process_path.length) == 0 ) {
12392
+ this.resolveProcessPathFromFields(cl);
12393
+ }
12394
+ }
12395
+ };
12396
+ let seen = {};
12397
+ for ( let i_1 = 0; i_1 < processClasses.length; i_1++) {
12398
+ var cl_1 = processClasses[i_1];
12399
+ if ( (cl_1.process_path.length) == 0 ) {
12400
+ continue;
12401
+ }
12402
+ const path = cl_1.process_path;
12403
+ const prev = ( seen.hasOwnProperty(path) ? seen[path] : undefined );
12404
+ if ( (typeof(prev) === "undefined") == false ) {
12405
+ const errNode = cl_1.nameNode;
12406
+ if ( (typeof(errNode) === "undefined") == false ) {
12407
+ const en = errNode;
12408
+ ctx.addError(en, "Duplicate @process @name path: " + path);
12409
+ }
12410
+ continue;
12411
+ }
12412
+ seen[path] = "1";
12413
+ if ( this.isValidProcessPath(path) == false ) {
12414
+ const errNode2 = cl_1.nameNode;
12415
+ if ( (typeof(errNode2) === "undefined") == false ) {
12416
+ const en2 = errNode2;
12417
+ ctx.addError(en2, "Invalid @name process path: " + path);
12418
+ }
12419
+ }
12420
+ };
12421
+ };
12422
+ isValidProcessPath (pathStr) {
12423
+ const n = pathStr.length;
12424
+ if ( n == 0 ) {
12425
+ return false;
12426
+ }
12427
+ if ( pathStr == "." ) {
12428
+ return false;
12429
+ }
12430
+ const parts = pathStr.split(".");
12431
+ for ( let i = 0; i < parts.length; i++) {
12432
+ var seg = parts[i];
12433
+ if ( (seg.length) == 0 ) {
12434
+ return false;
12435
+ }
12436
+ };
12437
+ return true;
12438
+ };
11717
12439
  async findLanguageOper (details, ctx, opDef) {
11718
12440
  const langName = operatorsOf_21.getTargetLang_22(ctx);
11719
12441
  let rv;
@@ -12713,6 +13435,114 @@ class NodeEvalState {
12713
13435
  this.ask_eval_end = 0; /** note: unused */
12714
13436
  }
12715
13437
  }
13438
+ class RangerProcessCodegen {
13439
+ constructor() {
13440
+ }
13441
+ shouldWrapProcessNew (procNewNode, procNewCtx) {
13442
+ if ( procNewNode.hasNewOper == false ) {
13443
+ return false;
13444
+ }
13445
+ const cl = procNewNode.clDesc;
13446
+ return cl.is_process;
13447
+ };
13448
+ hasParentRegister (procNewCtx) {
13449
+ if ( procNewCtx.in_method && (procNewCtx.in_static_method == false) ) {
13450
+ return true;
13451
+ }
13452
+ return false;
13453
+ };
13454
+ async writeNewArgs (node, ctx, wr, writer) {
13455
+ const givenArgs = node.getThird();
13456
+ const constr = node.clDesc.constructor_fn;
13457
+ if ( (typeof(constr) === "undefined") == false ) {
13458
+ const i = 0;
13459
+ for ( let i_1 = 0; i_1 < constr.params.length; i_1++) {
13460
+ var arg = constr.params[i_1];
13461
+ const argNode = givenArgs.children[i_1];
13462
+ if ( i_1 > 0 ) {
13463
+ wr.out(", ", false);
13464
+ }
13465
+ await writer.walkNewArgForProcess(argNode, ctx, wr);
13466
+ i_1 = i_1 + 1;
13467
+ };
13468
+ }
13469
+ };
13470
+ writeProcessInstanceRegisterCall (wr, lang) {
13471
+ if ( lang == "kotlin" ) {
13472
+ wr.out("if (this is RangerProcessBase && (this as RangerProcessBase).__rangerId != 0) { __rgr_proc.__rangerRegisterChild(this as RangerProcessBase) } else { __rgr_proc.__rangerRegisterRoot() }", false);
13473
+ return;
13474
+ }
13475
+ if ( (lang == "swift6") || (lang == "swift3") ) {
13476
+ wr.out("if let __rgr_parent = self as? RangerProcessBase, __rgr_parent.__rangerId != 0 { __rgr_proc.__rangerRegisterChild(parent: __rgr_parent) } else { __rgr_proc.__rangerRegisterRoot() }", false);
13477
+ return;
13478
+ }
13479
+ wr.out("if (typeof this !== 'undefined' && this.__rangerId) { __rgr_proc.__rangerRegisterChild(this) } else { __rgr_proc.__rangerRegisterRoot() }", false);
13480
+ };
13481
+ shouldUseProcessInstanceRegister (procNewCtx, newCl) {
13482
+ if ( newCl.is_process == false ) {
13483
+ return false;
13484
+ }
13485
+ if ( procNewCtx.in_static_method ) {
13486
+ return false;
13487
+ }
13488
+ const currCl = procNewCtx.getCurrentClass();
13489
+ if ( typeof(currCl) === "undefined" ) {
13490
+ return false;
13491
+ }
13492
+ const hostCl = currCl;
13493
+ return hostCl.is_process;
13494
+ };
13495
+ writeRegisterCall (procNewCtx, wr, lang, newCl) {
13496
+ if ( this.shouldUseProcessInstanceRegister(procNewCtx, newCl) ) {
13497
+ this.writeProcessInstanceRegisterCall(wr, lang);
13498
+ } else {
13499
+ wr.out("__rgr_proc.__rangerRegisterRoot()", false);
13500
+ }
13501
+ };
13502
+ async writeWrappedNewCallEs6 (node, ctx, wr, writer) {
13503
+ const cl = node.clDesc;
13504
+ wr.out("(() => { const __rgr_proc = new ", false);
13505
+ wr.out(cl.name, false);
13506
+ wr.out("(", false);
13507
+ await this.writeNewArgs(node, ctx, wr, writer);
13508
+ wr.out("); ", false);
13509
+ this.writeRegisterCall(ctx, wr, "es6", cl);
13510
+ wr.out("; return __rgr_proc; })()", false);
13511
+ };
13512
+ async writeWrappedNewCallKotlin (node, ctx, wr, writer) {
13513
+ const cl = node.clDesc;
13514
+ wr.out("run { val __rgr_proc = ", false);
13515
+ wr.out(cl.name, false);
13516
+ wr.out("(", false);
13517
+ await this.writeNewArgs(node, ctx, wr, writer);
13518
+ wr.out("); ", false);
13519
+ this.writeRegisterCall(ctx, wr, "kotlin", cl);
13520
+ wr.out("; __rgr_proc }", false);
13521
+ };
13522
+ async writeWrappedNewCallSwift6 (node, ctx, wr, writer) {
13523
+ const cl = node.clDesc;
13524
+ wr.out("({ () -> ", false);
13525
+ wr.out(cl.name, false);
13526
+ wr.out(" in let __rgr_proc = ", false);
13527
+ wr.out(cl.name, false);
13528
+ wr.out("(", false);
13529
+ await this.writeNewArgs(node, ctx, wr, writer);
13530
+ wr.out("); ", false);
13531
+ this.writeRegisterCall(ctx, wr, "swift6", cl);
13532
+ wr.out("; return __rgr_proc }())", false);
13533
+ };
13534
+ async writeWrappedNewCall (node, ctx, wr, lang, writer) {
13535
+ if ( lang == "kotlin" ) {
13536
+ await this.writeWrappedNewCallKotlin(node, ctx, wr, writer);
13537
+ return;
13538
+ }
13539
+ if ( (lang == "swift6") || (lang == "swift3") ) {
13540
+ await this.writeWrappedNewCallSwift6(node, ctx, wr, writer);
13541
+ return;
13542
+ }
13543
+ await this.writeWrappedNewCallEs6(node, ctx, wr, writer);
13544
+ };
13545
+ }
12716
13546
  class RangerGenericClassWriter {
12717
13547
  constructor() {
12718
13548
  this.compFlags = {};
@@ -12902,6 +13732,27 @@ class RangerGenericClassWriter {
12902
13732
  adjustType (tn) {
12903
13733
  return tn;
12904
13734
  };
13735
+ defValueHasSideEffects (value) {
13736
+ if ( value.has_call ) {
13737
+ return true;
13738
+ }
13739
+ if ( value.hasFnCall ) {
13740
+ return true;
13741
+ }
13742
+ if ( value.is_direct_method_call ) {
13743
+ return true;
13744
+ }
13745
+ return false;
13746
+ };
13747
+ async writeSideEffectOnlyStmt (value, ctx, wr) {
13748
+ ctx.setInExpr();
13749
+ await this.WalkNode(value, ctx, wr);
13750
+ ctx.unsetInExpr();
13751
+ if ( ctx.expressionLevel() == 0 ) {
13752
+ wr.out(";", true);
13753
+ }
13754
+ wr.newline();
13755
+ };
12905
13756
  async WriteVRef (node, ctx, wr) {
12906
13757
  if ( node.eval_type == 13 ) {
12907
13758
  if ( (node.ns.length) > 1 ) {
@@ -13143,7 +13994,26 @@ class RangerGenericClassWriter {
13143
13994
  }
13144
13995
  }
13145
13996
  };
13997
+ async walkNewArgForProcess (n, ctx, wr) {
13998
+ await this.WalkNode(n, ctx, wr);
13999
+ };
14000
+ async tryWriteProcessNewCall (procNewNode, procNewCtx, outWr) {
14001
+ if ( procNewNode.hasNewOper == false ) {
14002
+ return false;
14003
+ }
14004
+ const procCl = procNewNode.clDesc;
14005
+ if ( procCl.is_process == false ) {
14006
+ return false;
14007
+ }
14008
+ const pc = new RangerProcessCodegen();
14009
+ const lang = operatorsOf_21.getTargetLang_22(procNewCtx);
14010
+ await pc.writeWrappedNewCall(procNewNode, procNewCtx, outWr, lang, this);
14011
+ return true;
14012
+ };
13146
14013
  async writeNewCall (node, ctx, wr) {
14014
+ if ( await this.tryWriteProcessNewCall(node, ctx, wr) ) {
14015
+ return;
14016
+ }
13147
14017
  if ( node.hasNewOper ) {
13148
14018
  const cl = node.clDesc;
13149
14019
  const fc = node.getSecond();
@@ -15357,6 +16227,13 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15357
16227
  }
15358
16228
  }
15359
16229
  if ( (p.ref_cnt == 0) && (p.is_class_variable == false) ) {
16230
+ if ( (node.children.length) > 2 ) {
16231
+ const value = node.getThird();
16232
+ if ( this.defValueHasSideEffects(value) ) {
16233
+ await this.writeSideEffectOnlyStmt(value, ctx, wr);
16234
+ return;
16235
+ }
16236
+ }
15360
16237
  wr.out("/** unused: ", false);
15361
16238
  }
15362
16239
  if ( p.is_static ) {
@@ -15371,8 +16248,8 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15371
16248
  if ( (node.children.length) > 2 ) {
15372
16249
  wr.out(" = ", false);
15373
16250
  ctx.setInExpr();
15374
- const value = node.getThird();
15375
- await this.WalkNode(value, ctx, wr);
16251
+ const value_1 = node.getThird();
16252
+ await this.WalkNode(value_1, ctx, wr);
15376
16253
  ctx.unsetInExpr();
15377
16254
  } else {
15378
16255
  if ( nn.value_type == 6 ) {
@@ -15440,29 +16317,78 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15440
16317
  await this.writeTypeDef(arg.nameNode, ctx, wr);
15441
16318
  };
15442
16319
  };
16320
+ resolveCallReceiverClassName (obj, ctx) {
16321
+ if ( (obj.vref.length) > 0 ) {
16322
+ if ( ctx.isDefinedClass(obj.vref) ) {
16323
+ return obj.vref;
16324
+ }
16325
+ }
16326
+ if ( (obj.eval_type_name.length) > 0 ) {
16327
+ if ( ctx.isDefinedClass(obj.eval_type_name) ) {
16328
+ return obj.eval_type_name;
16329
+ }
16330
+ }
16331
+ if ( (obj.ns.length) >= 1 ) {
16332
+ const head = obj.ns[0];
16333
+ if ( ctx.isDefinedClass(head) ) {
16334
+ return head;
16335
+ }
16336
+ }
16337
+ if ( (obj.children.length) == 1 ) {
16338
+ const inner = obj.children[0];
16339
+ const innerName = this.resolveCallReceiverClassName(inner, ctx);
16340
+ if ( (innerName.length) > 0 ) {
16341
+ return innerName;
16342
+ }
16343
+ }
16344
+ return "";
16345
+ };
16346
+ isSimpleClassCallReceiver (obj, ctx) {
16347
+ const className = this.resolveCallReceiverClassName(obj, ctx);
16348
+ if ( (className.length) == 0 ) {
16349
+ return false;
16350
+ }
16351
+ if ( obj.vref == className ) {
16352
+ return true;
16353
+ }
16354
+ if ( (obj.children.length) == 1 ) {
16355
+ const inner = obj.children[0];
16356
+ if ( inner.vref == className ) {
16357
+ return true;
16358
+ }
16359
+ }
16360
+ return false;
16361
+ };
15443
16362
  async CreateCallExpression (node, ctx, wr) {
15444
16363
  if ( node.has_call ) {
15445
16364
  const obj = node.getSecond();
15446
16365
  const method = node.getThird();
15447
16366
  const args = node.children[3];
15448
- wr.out("(", false);
16367
+ const simpleReceiver = this.isSimpleClassCallReceiver(obj, ctx);
16368
+ if ( simpleReceiver == false ) {
16369
+ wr.out("(", false);
16370
+ }
15449
16371
  ctx.setInExpr();
15450
16372
  await this.WalkNode(obj, ctx, wr);
15451
16373
  ctx.unsetInExpr();
15452
- wr.out(").", false);
16374
+ if ( simpleReceiver == false ) {
16375
+ wr.out(").", false);
16376
+ } else {
16377
+ wr.out(".", false);
16378
+ }
15453
16379
  wr.out(method.vref, false);
15454
16380
  wr.out("(", false);
15455
16381
  ctx.setInExpr();
16382
+ const fnDesc = this.resolveMethodFnDesc(node, ctx);
16383
+ const hasFnDesc = (typeof(fnDesc) !== "undefined" && fnDesc != null ) ;
15456
16384
  for ( let i = 0; i < args.children.length; i++) {
15457
16385
  var arg = args.children[i];
15458
16386
  if ( i > 0 ) {
15459
16387
  wr.out(", ", false);
15460
16388
  }
15461
- if ( ctx.isDefinedClass(obj.eval_type_name) ) {
15462
- const clDef = ctx.findClass(obj.eval_type_name);
15463
- const clMethod = clDef.findMethod(method.vref);
15464
- if ( (typeof(clMethod) !== "undefined" && clMethod != null ) ) {
15465
- const mm = clMethod;
16389
+ if ( hasFnDesc ) {
16390
+ const mm = fnDesc;
16391
+ if ( i < (mm.params.length) ) {
15466
16392
  const pDesc = mm.params[i];
15467
16393
  wr.out(pDesc.compiledName + " : ", false);
15468
16394
  if ( ((pDesc.nameNode)).hasFlag("mutates") ) {
@@ -15471,8 +16397,6 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15471
16397
  await this.WalkNode(arg, ctx, wr);
15472
16398
  continue;
15473
16399
  }
15474
- } else {
15475
- ctx.addError(arg, "Could not find evaluated class for the call");
15476
16400
  }
15477
16401
  await this.WalkNode(arg, ctx, wr);
15478
16402
  };
@@ -15596,7 +16520,10 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15596
16520
  if ( node.hasNewOper ) {
15597
16521
  const cl = node.clDesc;
15598
16522
  const givenArgs = node.getThird();
15599
- if ( cl.nameNode.hasFlag("singleton") ) {
16523
+ if ( await this.tryWriteProcessNewCall(node, ctx, wr) ) {
16524
+ return;
16525
+ }
16526
+ if ( cl.isSingletonClass() ) {
15600
16527
  wr.out(node.clDesc.name + ".__singleton", false);
15601
16528
  wr.out("(", false);
15602
16529
  if ( (typeof(cl.constructor_fn) !== "undefined" && cl.constructor_fn != null ) ) {
@@ -15849,7 +16776,7 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15849
16776
  wr.indent(-1);
15850
16777
  wr.out("}", true);
15851
16778
  };
15852
- if ( cl.nameNode.hasFlag("singleton") ) {
16779
+ if ( cl.isSingletonClass() ) {
15853
16780
  wr.out(("private static var __singleton_instance : " + cl.compiledName) + "? = nil", true);
15854
16781
  wr.out("class func __singleton(", false);
15855
16782
  if ( cl.has_constructor ) {
@@ -15903,6 +16830,10 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15903
16830
  wr.newline();
15904
16831
  const subCtx_2 = variant_3.fnCtx;
15905
16832
  subCtx_2.is_function = true;
16833
+ subCtx_2.in_method = true;
16834
+ subCtx_2.in_static_method = false;
16835
+ subCtx_2.currentMethod = variant_3;
16836
+ subCtx_2.setCurrentClass(cl);
15906
16837
  await this.WalkNode(variant_3.fnBody, subCtx_2, wr);
15907
16838
  wr.newline();
15908
16839
  wr.indent(-1);
@@ -15924,6 +16855,9 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15924
16855
  theEnd.indent(1);
15925
16856
  const subCtx_3 = variant_4.fnCtx;
15926
16857
  subCtx_3.is_function = true;
16858
+ subCtx_3.in_method = false;
16859
+ subCtx_3.in_static_method = true;
16860
+ subCtx_3.currentMethod = variant_4;
15927
16861
  await this.WalkNode(variant_4.fnBody, subCtx_3, theEnd);
15928
16862
  theEnd.newline();
15929
16863
  theEnd.indent(-1);
@@ -15933,6 +16867,85 @@ class RangerSwift6ClassWriter extends RangerGenericClassWriter {
15933
16867
  }
15934
16868
  };
15935
16869
  };
16870
+ resolveMethodFnDesc (methodNode, ctx) {
16871
+ let res;
16872
+ if ( methodNode.hasParamDesc ) {
16873
+ const raw = (methodNode.paramDesc);
16874
+ if ( (raw.params.length) > 0 ) {
16875
+ res = raw;
16876
+ return res;
16877
+ }
16878
+ }
16879
+ if ( (methodNode.ns.length) >= 2 ) {
16880
+ const className = methodNode.ns[0];
16881
+ if ( ctx.isDefinedClass(className) ) {
16882
+ const clDef = ctx.findClass(className);
16883
+ const methodName = methodNode.ns[1];
16884
+ let found = clDef.findStaticMethod(methodName);
16885
+ if ( typeof(found) === "undefined" ) {
16886
+ found = clDef.findMethod(methodName);
16887
+ }
16888
+ if ( (typeof(found) !== "undefined" && found != null ) ) {
16889
+ res = found;
16890
+ return res;
16891
+ }
16892
+ }
16893
+ }
16894
+ if ( methodNode.has_call ) {
16895
+ const obj = methodNode.getSecond();
16896
+ const method = methodNode.getThird();
16897
+ const className_1 = this.resolveCallReceiverClassName(obj, ctx);
16898
+ if ( (className_1.length) > 0 ) {
16899
+ const clDef_1 = ctx.findClass(className_1);
16900
+ let found_1 = clDef_1.findStaticMethod(method.vref);
16901
+ if ( typeof(found_1) === "undefined" ) {
16902
+ found_1 = clDef_1.findMethod(method.vref);
16903
+ }
16904
+ if ( (typeof(found_1) !== "undefined" && found_1 != null ) ) {
16905
+ res = found_1;
16906
+ return res;
16907
+ }
16908
+ }
16909
+ }
16910
+ return res;
16911
+ };
16912
+ async CreateMethodCall (node, ctx, wr) {
16913
+ const methodNode = node.getFirst();
16914
+ const args = node.getSecond();
16915
+ ctx.setInExpr();
16916
+ await this.WalkNode(methodNode, ctx, wr);
16917
+ ctx.unsetInExpr();
16918
+ wr.out("(", false);
16919
+ ctx.setInExpr();
16920
+ let hasFnDesc = false;
16921
+ let fnDesc;
16922
+ const resolved = this.resolveMethodFnDesc(methodNode, ctx);
16923
+ if ( (typeof(resolved) !== "undefined" && resolved != null ) ) {
16924
+ fnDesc = resolved;
16925
+ hasFnDesc = true;
16926
+ }
16927
+ const pms = operatorsOf.filter_36(args.children, ((item, index) => {
16928
+ if ( item.hasFlag("keyword") ) {
16929
+ return false;
16930
+ }
16931
+ return true;
16932
+ }));
16933
+ for ( let i = 0; i < pms.length; i++) {
16934
+ var arg = pms[i];
16935
+ if ( i > 0 ) {
16936
+ wr.out(", ", false);
16937
+ }
16938
+ if ( hasFnDesc ) {
16939
+ if ( i < (fnDesc.params.length) ) {
16940
+ const pArg = fnDesc.params[i];
16941
+ wr.out(pArg.compiledName + " : ", false);
16942
+ }
16943
+ }
16944
+ await this.WalkNode(arg, ctx, wr);
16945
+ };
16946
+ ctx.unsetInExpr();
16947
+ wr.out(")", false);
16948
+ };
15936
16949
  }
15937
16950
  class RangerCppClassWriter extends RangerGenericClassWriter {
15938
16951
  constructor() {
@@ -20141,6 +21154,13 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20141
21154
  const nn = node.children[1];
20142
21155
  const p = nn.paramDesc;
20143
21156
  if ( (p.ref_cnt == 0) && (p.is_class_variable == false) ) {
21157
+ if ( (node.children.length) > 2 ) {
21158
+ const value = node.getThird();
21159
+ if ( this.defValueHasSideEffects(value) ) {
21160
+ await this.writeSideEffectOnlyStmt(value, ctx, wr);
21161
+ return;
21162
+ }
21163
+ }
20144
21164
  wr.out("/** unused: ", false);
20145
21165
  }
20146
21166
  if ( p.is_class_variable ) {
@@ -20158,8 +21178,8 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20158
21178
  if ( (node.children.length) > 2 ) {
20159
21179
  wr.out(" = ", false);
20160
21180
  ctx.setInExpr();
20161
- const value = node.getThird();
20162
- await this.WalkNode(value, ctx, wr);
21181
+ const value_1 = node.getThird();
21182
+ await this.WalkNode(value_1, ctx, wr);
20163
21183
  ctx.unsetInExpr();
20164
21184
  } else {
20165
21185
  if ( nn.hasFlag("optional") ) {
@@ -20197,6 +21217,7 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20197
21217
  };
20198
21218
  async writeFnCall (node, ctx, wr) {
20199
21219
  if ( node.hasFnCall ) {
21220
+ ctx.setInExpr();
20200
21221
  const fc = node.getFirst();
20201
21222
  await this.WriteVRef(fc, ctx, wr);
20202
21223
  wr.out("(", false);
@@ -20220,6 +21241,7 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20220
21241
  await this.WalkNode(n, ctx, wr);
20221
21242
  };
20222
21243
  wr.out(")", false);
21244
+ ctx.unsetInExpr();
20223
21245
  if ( ctx.expressionLevel() == 0 ) {
20224
21246
  wr.out(";", true);
20225
21247
  }
@@ -20229,7 +21251,10 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20229
21251
  if ( node.hasNewOper ) {
20230
21252
  const cl = node.clDesc;
20231
21253
  const givenArgs = node.getThird();
20232
- if ( cl.nameNode.hasFlag("singleton") ) {
21254
+ if ( await this.tryWriteProcessNewCall(node, ctx, wr) ) {
21255
+ return;
21256
+ }
21257
+ if ( cl.isSingletonClass() ) {
20233
21258
  wr.out(" ", false);
20234
21259
  wr.out(node.clDesc.name + ".__singleton", false);
20235
21260
  wr.out("(", false);
@@ -20272,7 +21297,7 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20272
21297
  const wr = orig_wr;
20273
21298
  const importFork = wr.fork();
20274
21299
  wr.out("", true);
20275
- if ( cl.is_extended_by_children ) {
21300
+ if ( cl.is_extended_by_children || (cl.name == "RangerProcessBase") ) {
20276
21301
  wr.out("open class " + cl.name, false);
20277
21302
  } else {
20278
21303
  wr.out("class " + cl.name, false);
@@ -20328,6 +21353,8 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20328
21353
  };
20329
21354
  }
20330
21355
  wr.out(")", false);
21356
+ } else {
21357
+ wr.out("()", false);
20331
21358
  }
20332
21359
  };
20333
21360
  }
@@ -20345,7 +21372,7 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20345
21372
  if ( ((cl.static_methods.length) > 0) || has_static_vars ) {
20346
21373
  wants_companion = true;
20347
21374
  }
20348
- if ( cl.nameNode.hasFlag("singleton") ) {
21375
+ if ( cl.isSingletonClass() ) {
20349
21376
  wants_companion = true;
20350
21377
  }
20351
21378
  for ( let i_2 = 0; i_2 < cl.variables.length; i_2++) {
@@ -20379,7 +21406,7 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20379
21406
  }
20380
21407
  await this.writeVarDef(pvar_2.node, ctx, wr);
20381
21408
  };
20382
- if ( cl.nameNode.hasFlag("singleton") ) {
21409
+ if ( cl.isSingletonClass() ) {
20383
21410
  wr.out(("private var __singleton_instance : " + cl.compiledName) + "? = null", true);
20384
21411
  wr.out("fun __singleton(", false);
20385
21412
  if ( cl.has_constructor ) {
@@ -20431,6 +21458,10 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20431
21458
  wr.newline();
20432
21459
  const subCtx_1 = variant_1.fnCtx;
20433
21460
  subCtx_1.is_function = true;
21461
+ subCtx_1.in_method = true;
21462
+ subCtx_1.in_static_method = false;
21463
+ subCtx_1.currentMethod = variant_1;
21464
+ subCtx_1.setCurrentClass(cl);
20434
21465
  await this.WalkNode(variant_1.fnBody, subCtx_1, wr);
20435
21466
  wr.newline();
20436
21467
  wr.indent(-1);
@@ -20474,6 +21505,10 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20474
21505
  wr.newline();
20475
21506
  const subCtx_2 = variant_2.fnCtx;
20476
21507
  subCtx_2.is_function = true;
21508
+ subCtx_2.in_method = true;
21509
+ subCtx_2.in_static_method = false;
21510
+ subCtx_2.currentMethod = variant_2;
21511
+ subCtx_2.setCurrentClass(cl);
20477
21512
  await this.WalkNode(variant_2.fnBody, subCtx_2, wr);
20478
21513
  wr.newline();
20479
21514
  wr.indent(-1);
@@ -20491,6 +21526,9 @@ class RangerKotlinClassWriter extends RangerGenericClassWriter {
20491
21526
  wr.newline();
20492
21527
  const subCtx_3 = variant_3.fnCtx;
20493
21528
  subCtx_3.is_function = true;
21529
+ subCtx_3.in_method = false;
21530
+ subCtx_3.in_static_method = true;
21531
+ subCtx_3.currentMethod = variant_3;
20494
21532
  await this.WalkNode(variant_3.fnBody, subCtx_3, wr);
20495
21533
  wr.newline();
20496
21534
  wr.indent(-1);
@@ -24892,6 +25930,22 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
24892
25930
  lineEnding () {
24893
25931
  return ";";
24894
25932
  };
25933
+ writeTsOptionalReturnSuffix (variant, wr) {
25934
+ if ( this.target_typescript == false ) {
25935
+ return;
25936
+ }
25937
+ if ( variant.nameNode.hasFlag("optional") ) {
25938
+ wr.out(" | undefined", false);
25939
+ return;
25940
+ }
25941
+ const rv = variant.return_value;
25942
+ if ( typeof(rv) === "undefined" ) {
25943
+ return;
25944
+ }
25945
+ if ( rv.is_optional ) {
25946
+ wr.out(" | undefined", false);
25947
+ }
25948
+ };
24895
25949
  adjustType (tn) {
24896
25950
  if ( tn == "this" ) {
24897
25951
  return "this";
@@ -25479,6 +26533,14 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25479
26533
  };
25480
26534
  async writeClassVarDef (p, ctx, wr) {
25481
26535
  if ( this.target_typescript ) {
26536
+ const cl = ctx.currentClass;
26537
+ let is_singleton = false;
26538
+ if ( (typeof(cl) === "undefined") == false ) {
26539
+ const clDesc = cl;
26540
+ if ( clDesc.isSingletonClass() ) {
26541
+ is_singleton = true;
26542
+ }
26543
+ }
25482
26544
  const pNode = p.node;
25483
26545
  let has_ctor_init = false;
25484
26546
  if ( (pNode.children.length) > 2 ) {
@@ -25493,11 +26555,17 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25493
26555
  wr.out("static ", false);
25494
26556
  }
25495
26557
  wr.out(p.compiledName, false);
25496
- if ( (p.is_static == false) && p.is_optional ) {
25497
- if ( has_ctor_init ) {
25498
- wr.out("!", false);
26558
+ if ( p.is_static == false ) {
26559
+ if ( p.is_optional ) {
26560
+ if ( has_ctor_init ) {
26561
+ wr.out("!", false);
26562
+ } else {
26563
+ wr.out("?", false);
26564
+ }
25499
26565
  } else {
25500
- wr.out("?", false);
26566
+ if ( is_singleton || has_ctor_init ) {
26567
+ wr.out("!", false);
26568
+ }
25501
26569
  }
25502
26570
  }
25503
26571
  wr.out(": ", false);
@@ -25516,7 +26584,10 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25516
26584
  if ( node.hasNewOper ) {
25517
26585
  const cl = node.clDesc;
25518
26586
  const givenArgs = node.getThird();
25519
- if ( cl.nameNode.hasFlag("singleton") ) {
26587
+ if ( await this.tryWriteProcessNewCall(node, ctx, wr) ) {
26588
+ return;
26589
+ }
26590
+ if ( cl.isSingletonClass() ) {
25520
26591
  wr.out(node.clDesc.name + ".__singleton", false);
25521
26592
  wr.out("(", false);
25522
26593
  for ( let i = 0; i < givenArgs.children.length; i++) {
@@ -25739,6 +26810,13 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25739
26810
  }
25740
26811
  wr.out(") {", true);
25741
26812
  wr.indent(1);
26813
+ if ( cl.isSingletonClass() ) {
26814
+ wr.out(("if (" + cl.name) + ".__singleton_instance != null) {", true);
26815
+ wr.indent(1);
26816
+ wr.out(("return " + cl.name) + ".__singleton_instance;", true);
26817
+ wr.indent(-1);
26818
+ wr.out("}", true);
26819
+ }
25742
26820
  if ( b_extd ) {
25743
26821
  if ( (typeof(parentClass) !== "undefined" && parentClass != null ) ) {
25744
26822
  const pc = parentClass;
@@ -25800,6 +26878,9 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25800
26878
  subCtx.is_function = true;
25801
26879
  await this.WalkNode(constr_1.fnBody, subCtx, wr);
25802
26880
  }
26881
+ if ( cl.isSingletonClass() ) {
26882
+ wr.out(cl.name + ".__singleton_instance = this;", true);
26883
+ }
25803
26884
  wr.newline();
25804
26885
  wr.indent(-1);
25805
26886
  wr.out("}", true);
@@ -25824,6 +26905,7 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25824
26905
  if ( variant.nameNode.hasFlag("async") ) {
25825
26906
  wr.out(">", false);
25826
26907
  }
26908
+ this.writeTsOptionalReturnSuffix(variant, wr);
25827
26909
  wr.out(" ", false);
25828
26910
  }
25829
26911
  wr.out(" {", true);
@@ -25871,6 +26953,7 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25871
26953
  if ( variant_1.nameNode.hasFlag("async") ) {
25872
26954
  wr.out("> ", false);
25873
26955
  }
26956
+ this.writeTsOptionalReturnSuffix(variant_1, wr);
25874
26957
  wr.out(" ", false);
25875
26958
  wr.out(" {", true);
25876
26959
  wr.indent(1);
@@ -25882,7 +26965,7 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25882
26965
  wr.indent(-1);
25883
26966
  wr.out("};", true);
25884
26967
  };
25885
- if ( cl.nameNode.hasFlag("singleton") ) {
26968
+ if ( cl.isSingletonClass() ) {
25886
26969
  wr.out(("static __singleton_instance : " + cl.name) + " | null = null;", true);
25887
26970
  wr.out("static __singleton(", false);
25888
26971
  if ( cl.has_constructor ) {
@@ -25946,7 +27029,7 @@ class RangerJavaScriptClassWriter extends RangerGenericClassWriter {
25946
27029
  }
25947
27030
  wr.out(";", true);
25948
27031
  };
25949
- if ( cl.nameNode.hasFlag("singleton") ) {
27032
+ if ( cl.isSingletonClass() ) {
25950
27033
  wr.out((cl.name + ".__singleton_instance") + " = null;", true);
25951
27034
  wr.out((cl.name + ".__singleton") + " = function(", false);
25952
27035
  if ( cl.has_constructor ) {
@@ -27613,7 +28696,7 @@ class CLIProgress {
27613
28696
  this.inputFile = "";
27614
28697
  this.outputFile = "";
27615
28698
  this.targetLanguage = "";
27616
- this.compilerVersion = "3.0.4";
28699
+ this.compilerVersion = "3.0.5";
27617
28700
  this.useColors = (process.stdout.isTTY || false);
27618
28701
  this.startTime = Date.now();
27619
28702
  }
@@ -29965,6 +31048,15 @@ class StaticAnalyzer {
29965
31048
  const contentFork = wr.fork();
29966
31049
  wr.createTag("utilities");
29967
31050
  const theEnd = wr.createTag("file_end");
31051
+ if ( appCtx.hasCompilerFlag("typescript") ) {
31052
+ if ( ( typeof(appCtx.compilerSettings["processTsHelpers"] ) != "undefined" && appCtx.compilerSettings.hasOwnProperty("processTsHelpers") ) ) {
31053
+ const __rgrTs = (( appCtx.compilerSettings.hasOwnProperty("processTsHelpers") ? appCtx.compilerSettings["processTsHelpers"] : undefined ));
31054
+ if ( (__rgrTs.length) > 0 ) {
31055
+ theEnd.raw(__rgrTs, false);
31056
+ theEnd.newline();
31057
+ }
31058
+ }
31059
+ }
29968
31060
  wr = contentFork;
29969
31061
  let handledClasses = {};
29970
31062
  for ( let i_4 = 0; i_4 < appCtx.definedClassList.length; i_4++) {