circuitscript 0.1.15 → 0.1.17

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.
Files changed (49) hide show
  1. package/dist/cjs/BaseVisitor.js +98 -35
  2. package/dist/cjs/antlr/CircuitScriptLexer.js +3 -3
  3. package/dist/cjs/antlr/CircuitScriptParser.js +868 -757
  4. package/dist/cjs/builtinMethods.js +11 -1
  5. package/dist/cjs/draw_symbols.js +18 -17
  6. package/dist/cjs/execute.js +58 -31
  7. package/dist/cjs/globals.js +4 -1
  8. package/dist/cjs/graph.js +372 -0
  9. package/dist/cjs/helpers.js +6 -2
  10. package/dist/cjs/layout.js +18 -259
  11. package/dist/cjs/objects/ClassComponent.js +27 -20
  12. package/dist/cjs/objects/ExecutionScope.js +7 -2
  13. package/dist/cjs/objects/Net.js +1 -1
  14. package/dist/cjs/objects/PinDefinition.js +55 -3
  15. package/dist/cjs/objects/types.js +42 -6
  16. package/dist/cjs/visitor.js +88 -48
  17. package/dist/esm/BaseVisitor.js +98 -35
  18. package/dist/esm/antlr/CircuitScriptLexer.js +3 -3
  19. package/dist/esm/antlr/CircuitScriptParser.js +864 -755
  20. package/dist/esm/antlr/CircuitScriptVisitor.js +2 -0
  21. package/dist/esm/builtinMethods.js +11 -1
  22. package/dist/esm/draw_symbols.js +18 -17
  23. package/dist/esm/execute.js +60 -33
  24. package/dist/esm/globals.js +3 -0
  25. package/dist/esm/graph.js +344 -0
  26. package/dist/esm/helpers.js +6 -2
  27. package/dist/esm/layout.js +14 -235
  28. package/dist/esm/objects/ClassComponent.js +28 -21
  29. package/dist/esm/objects/ExecutionScope.js +7 -2
  30. package/dist/esm/objects/Net.js +1 -1
  31. package/dist/esm/objects/PinDefinition.js +53 -2
  32. package/dist/esm/objects/types.js +42 -6
  33. package/dist/esm/visitor.js +90 -50
  34. package/dist/libs/std.cst +3 -2
  35. package/dist/types/BaseVisitor.d.ts +5 -2
  36. package/dist/types/antlr/CircuitScriptParser.d.ts +42 -26
  37. package/dist/types/antlr/CircuitScriptVisitor.d.ts +4 -0
  38. package/dist/types/draw_symbols.d.ts +13 -7
  39. package/dist/types/execute.d.ts +12 -12
  40. package/dist/types/globals.d.ts +4 -1
  41. package/dist/types/graph.d.ts +29 -0
  42. package/dist/types/layout.d.ts +4 -9
  43. package/dist/types/objects/ClassComponent.d.ts +8 -8
  44. package/dist/types/objects/ExecutionScope.d.ts +8 -7
  45. package/dist/types/objects/Net.d.ts +2 -2
  46. package/dist/types/objects/PinDefinition.d.ts +17 -2
  47. package/dist/types/objects/types.d.ts +31 -7
  48. package/libs/std.cst +3 -2
  49. package/package.json +2 -1
@@ -32,6 +32,7 @@ export class CircuitScriptVisitor extends AbstractParseTreeVisitor {
32
32
  visitProperty_set_expr;
33
33
  visitDouble_dot_property_set_expr;
34
34
  visitArrayExpr;
35
+ visitArrayIndexExpr;
35
36
  visitFunctionCallExpr;
36
37
  visitAdditionExpr;
37
38
  visitMultiplyExpr;
@@ -49,6 +50,7 @@ export class CircuitScriptVisitor extends AbstractParseTreeVisitor {
49
50
  visitFunction_args_expr;
50
51
  visitAtom_expr;
51
52
  visitTrailer_expr;
53
+ visitTrailer_expr2;
52
54
  visitFunction_call_expr;
53
55
  visitNet_namespace_expr;
54
56
  visitFunction_return_expr;
@@ -1,5 +1,6 @@
1
1
  import Big from "big.js";
2
2
  import { numeric, NumericValue } from "./objects/ParamDefinition.js";
3
+ import { CFunctionEntry } from "./objects/types.js";
3
4
  import { unwrapValue, resolveToNumericValue, RuntimeExecutionError } from "./utils.js";
4
5
  const builtInMethods = [
5
6
  ['enumerate', enumerate],
@@ -144,8 +145,17 @@ function toString(obj) {
144
145
  else if (obj instanceof NumericValue) {
145
146
  return obj.toBigNumber().toString();
146
147
  }
148
+ else if (obj instanceof CFunctionEntry) {
149
+ return obj.toString();
150
+ }
147
151
  else {
148
- if (obj.toDisplayString) {
152
+ if (obj === undefined) {
153
+ return 'undefined';
154
+ }
155
+ else if (obj === null) {
156
+ return 'null';
157
+ }
158
+ else if (obj.toDisplayString) {
149
159
  return obj.toDisplayString();
150
160
  }
151
161
  else if (obj.toString) {
@@ -5,6 +5,7 @@ import { PinTypes } from "./objects/PinTypes.js";
5
5
  import { roundValue, RuntimeExecutionError, throwWithContext } from "./utils.js";
6
6
  import { DeclaredReference, UndeclaredReference } from "./objects/types.js";
7
7
  import { numeric, NumericValue } from "./objects/ParamDefinition.js";
8
+ import { PinId } from "./objects/PinDefinition.js";
8
9
  export class SymbolGraphic {
9
10
  drawPortsName = true;
10
11
  displayBounds = false;
@@ -560,6 +561,12 @@ export class SymbolPlaceholder extends SymbolGraphic {
560
561
  milsToMM(endY)
561
562
  ];
562
563
  }
564
+ if (positionParams[0] instanceof NumericValue) {
565
+ positionParams[0] = new PinId(positionParams[0].toNumber());
566
+ }
567
+ else if (typeof positionParams[0] === 'number' || typeof positionParams[0] === 'string') {
568
+ positionParams[0] = new PinId(positionParams[0]);
569
+ }
563
570
  drawing.addPinMM(...positionParams, lineColor);
564
571
  const lastAddedPin = this.drawing.pins[this.drawing.pins.length - 1];
565
572
  const [pinId, , angle] = lastAddedPin;
@@ -604,7 +611,8 @@ export class SymbolPlaceholder extends SymbolGraphic {
604
611
  vanchor: VerticalAlign.Middle,
605
612
  textColor: pinNameColor,
606
613
  });
607
- displayPinId && drawing.addLabel(endX.add(pinIdOffsetX), endY.add(pinIdOffsetY), pinId.toDisplayString(), {
614
+ const pinDisplayText = pinId.toString();
615
+ displayPinId && drawing.addLabel(endX.add(pinIdOffsetX), endY.add(pinIdOffsetY), pinDisplayText, {
608
616
  fontSize: numeric(defaultPinIdTextSize),
609
617
  anchor: pinIdAlignment,
610
618
  vanchor: pinIdVAlignment,
@@ -704,7 +712,7 @@ export class SymbolCustom extends SymbolGraphic {
704
712
  leftPins.forEach(pin => {
705
713
  const position = pin.position;
706
714
  const pinY = pinStartY.add((position + 1) * tmpPinSpacing);
707
- drawing.addPinMM(numeric(pin.pinId), leftPinStart.sub(this.pinLength), pinY, leftPinStart, pinY, defaultLineColor);
715
+ drawing.addPinMM(pin.pinId, leftPinStart.sub(this.pinLength), pinY, leftPinStart, pinY, defaultLineColor);
708
716
  drawing.addLabel(leftPinStart.add(milsToMM(20)), pinY, pin.text, {
709
717
  fontSize: numeric(CustomSymbolPinTextSize),
710
718
  anchor: HorizontalAlign.Left,
@@ -721,7 +729,7 @@ export class SymbolCustom extends SymbolGraphic {
721
729
  rightPins.forEach(pin => {
722
730
  const position = pin.position;
723
731
  const pinY = pinStartY.add((position + 1) * tmpPinSpacing);
724
- drawing.addPinMM(numeric(pin.pinId), rightPinStart.add(this.pinLength), pinY, rightPinStart, pinY, defaultLineColor);
732
+ drawing.addPinMM(pin.pinId, rightPinStart.add(this.pinLength), pinY, rightPinStart, pinY, defaultLineColor);
725
733
  drawing.addLabel(rightPinStart.sub(milsToMM(20)), pinY, pin.text, {
726
734
  fontSize: numeric(CustomSymbolPinTextSize),
727
735
  anchor: HorizontalAlign.Right,
@@ -738,7 +746,7 @@ export class SymbolCustom extends SymbolGraphic {
738
746
  topPins.forEach(pin => {
739
747
  const position = pin.position;
740
748
  const pinX = pinStartX.add((position + 1) * tmpPinSpacing);
741
- drawing.addPinMM(numeric(pin.pinId), pinX, topPinStart.sub(this.pinLength), pinX, topPinStart, defaultLineColor);
749
+ drawing.addPinMM(pin.pinId, pinX, topPinStart.sub(this.pinLength), pinX, topPinStart, defaultLineColor);
742
750
  drawing.addLabel(pinX, topPinStart.add(milsToMM(20)), pin.text, {
743
751
  fontSize: numeric(CustomSymbolPinTextSize),
744
752
  anchor: HorizontalAlign.Right,
@@ -757,7 +765,7 @@ export class SymbolCustom extends SymbolGraphic {
757
765
  bottomPins.forEach(pin => {
758
766
  const position = pin.position;
759
767
  const pinX = pinStartX.add((position + 1) * tmpPinSpacing);
760
- drawing.addPinMM(numeric(pin.pinId), pinX, bottomPinStart.add(this.pinLength), pinX, bottomPinStart, defaultLineColor);
768
+ drawing.addPinMM(pin.pinId, pinX, bottomPinStart.add(this.pinLength), pinX, bottomPinStart, defaultLineColor);
761
769
  drawing.addLabel(pinX, bottomPinStart.sub(milsToMM(20)), pin.text, {
762
770
  fontSize: numeric(CustomSymbolPinTextSize),
763
771
  anchor: HorizontalAlign.Left,
@@ -839,7 +847,7 @@ export class SymbolCustomModule extends SymbolCustom {
839
847
  leftPins.forEach(pin => {
840
848
  const position = pin.position;
841
849
  const pinY = pinStartY.add((position + 1) * tmpPinSpacing);
842
- drawing.addPinMM(numeric(pin.pinId), leftPinStart.sub(this.pinLength), pinY, leftPinStart, pinY, defaultLineColor);
850
+ drawing.addPinMM(pin.pinId, leftPinStart.sub(this.pinLength), pinY, leftPinStart, pinY, defaultLineColor);
843
851
  drawing.addModulePort(leftPinStart, pinY, this.portWidth, this.portHeight, pin.pinType);
844
852
  drawing.addLabel(leftPinStart.add(this.portWidth).add(milsToMM(20)), pinY, pin.text, {
845
853
  fontSize: numeric(40),
@@ -851,7 +859,7 @@ export class SymbolCustomModule extends SymbolCustom {
851
859
  rightPins.forEach(pin => {
852
860
  const position = pin.position;
853
861
  const pinY = pinStartY.add((position + 1) * tmpPinSpacing);
854
- drawing.addPinMM(numeric(pin.pinId), rightPinStart.add(this.pinLength), pinY, rightPinStart, pinY, defaultLineColor);
862
+ drawing.addPinMM(pin.pinId, rightPinStart.add(this.pinLength), pinY, rightPinStart, pinY, defaultLineColor);
855
863
  drawing.addModulePort(rightPinStart, pinY, this.portWidth, this.portHeight, pin.pinType, -1);
856
864
  drawing.addLabel(rightPinStart.sub(this.portWidth).sub(milsToMM(20)), pinY, pin.text, {
857
865
  fontSize: numeric(40),
@@ -863,7 +871,7 @@ export class SymbolCustomModule extends SymbolCustom {
863
871
  topPins.forEach(pin => {
864
872
  const position = pin.position;
865
873
  const pinX = pinStartX.add((position + 1) * tmpPinSpacing);
866
- drawing.addPinMM(numeric(pin.pinId), pinX, topPinStart.sub(this.pinLength), pinX, topPinStart, defaultLineColor);
874
+ drawing.addPinMM(pin.pinId, pinX, topPinStart.sub(this.pinLength), pinX, topPinStart, defaultLineColor);
867
875
  drawing.addModulePort(pinX, topPinStart, this.portWidth, this.portHeight, pin.pinType, 1, 90);
868
876
  drawing.addLabel(pinX, topPinStart.add(this.portWidth).add(milsToMM(20)), pin.text, {
869
877
  fontSize: numeric(40),
@@ -876,7 +884,7 @@ export class SymbolCustomModule extends SymbolCustom {
876
884
  bottomPins.forEach(pin => {
877
885
  const position = pin.position;
878
886
  const pinX = pinStartX.add((position + 1) * tmpPinSpacing);
879
- drawing.addPinMM(numeric(pin.pinId), pinX, bottomPinStart, pinX, bottomPinStart.sub(this.pinLength), defaultLineColor);
887
+ drawing.addPinMM(pin.pinId, pinX, bottomPinStart, pinX, bottomPinStart.sub(this.pinLength), defaultLineColor);
880
888
  drawing.addModulePort(pinX, bottomPinStart, this.portWidth, this.portHeight, pin.pinType, 1, -90);
881
889
  drawing.addLabel(pinX, bottomPinStart.sub(this.portWidth).sub(milsToMM(20)), pin.text, {
882
890
  fontSize: numeric(40),
@@ -912,13 +920,6 @@ export class SymbolDrawing {
912
920
  this.items.push(Geometry.segment([startX, startY], [endX, endY]));
913
921
  return this;
914
922
  }
915
- addPin(pinId, startX, startY, endX, endY, lineColor) {
916
- startX = milsToMM(startX);
917
- startY = milsToMM(startY);
918
- endX = milsToMM(endX);
919
- endY = milsToMM(endY);
920
- return this.addPinMM(pinId, startX, startY, endX, endY, lineColor);
921
- }
922
923
  addPinMM(pinId, startXMM, startYMM, endXMM, endYMM, lineColor) {
923
924
  let angle = 0;
924
925
  const tmpStartXMM = startXMM.toNumber();
@@ -1221,7 +1222,7 @@ export class SymbolDrawing {
1221
1222
  }
1222
1223
  getPinPosition(pinId) {
1223
1224
  const pin = this.pins.find(item => {
1224
- return item[0].toNumber() === pinId;
1225
+ return item[0].equals(pinId);
1225
1226
  });
1226
1227
  if (pin) {
1227
1228
  const [, feature, angle] = pin;
@@ -3,8 +3,8 @@ import { ClassComponent, ModuleComponent } from './objects/ClassComponent.js';
3
3
  import { ActiveObject, ExecutionScope, FrameAction, SequenceAction } from './objects/ExecutionScope.js';
4
4
  import { Net } from './objects/Net.js';
5
5
  import { numeric, NumericValue } from './objects/ParamDefinition.js';
6
- import { PortSide } from './objects/PinDefinition.js';
7
- import { AnyReference, DeclaredReference, Direction } from './objects/types.js';
6
+ import { PinId, PortSide } from './objects/PinDefinition.js';
7
+ import { AnyReference, CFunctionEntry, DeclaredReference, Direction } from './objects/types.js';
8
8
  import { Wire } from './objects/Wire.js';
9
9
  import { Frame } from './objects/Frame.js';
10
10
  import { CalculatePinPositions } from './layout.js';
@@ -24,7 +24,7 @@ export class ExecutionContext {
24
24
  returnValue = null;
25
25
  silent = false;
26
26
  logger;
27
- __functionCache = {};
27
+ __functionCache = new Map();
28
28
  parentContext;
29
29
  componentAngleFollowsWire = true;
30
30
  warnings = [];
@@ -151,7 +151,7 @@ export class ExecutionContext {
151
151
  const tmpArrangeRight = [];
152
152
  pins.forEach((pin, index) => {
153
153
  const useArray = (index % 2 === 0) ? tmpArrangeLeft : tmpArrangeRight;
154
- useArray.push(numeric(pin.id));
154
+ useArray.push(pin.id);
155
155
  });
156
156
  const arrangeProp = new Map([
157
157
  [SymbolPinSide.Left, tmpArrangeLeft],
@@ -161,11 +161,9 @@ export class ExecutionContext {
161
161
  }
162
162
  if (props.arrange !== null) {
163
163
  component.arrangeProps = this.removeArrangePropDuplicates(props.arrange);
164
- const arrangePropPins = this.getArrangePropPins(component.arrangeProps).map(item => {
165
- return item.toNumber();
166
- });
164
+ const arrangePropPins = this.getArrangePropPins(component.arrangeProps);
167
165
  pins.forEach(pin => {
168
- if (arrangePropPins.indexOf(pin.id) === -1) {
166
+ if (arrangePropPins.find(id => id.equals(pin.id)) === undefined) {
169
167
  this.logWarning(`Pin ${pin.id} is not specified in arrange property`);
170
168
  }
171
169
  });
@@ -182,6 +180,7 @@ export class ExecutionContext {
182
180
  });
183
181
  if (component.typeProp === ComponentTypes.net) {
184
182
  const netName = paramsMap.get(ParamKeys.net_name);
183
+ const netType = paramsMap.get(ParamKeys.net_type);
185
184
  let priority = 0;
186
185
  if (paramsMap.has(ParamKeys.priority)) {
187
186
  priority = paramsMap.get(ParamKeys.priority).toNumber();
@@ -193,21 +192,26 @@ export class ExecutionContext {
193
192
  this.log('net found', tmpNet.namespace, tmpNet.name);
194
193
  }
195
194
  else {
196
- tmpNet = new Net(this.netNamespace, netName, priority);
195
+ tmpNet = new Net(this.netNamespace, netName, priority, netType);
197
196
  this.log('net not found, added net instance', tmpNet.namespace, tmpNet.name);
198
197
  }
199
- const defaultPin = 1;
198
+ const defaultPin = new PinId(1);
200
199
  this.scope.setNet(component, defaultPin, tmpNet);
201
200
  this.log('set net', netName, 'component', component, defaultPin);
202
201
  }
203
202
  const { pins: pinSides, maxPositions } = getPortSide(component.pins, component.arrangeProps);
204
203
  component.pinsMaxPositions = maxPositions;
204
+ const pinIdKeys = Array.from(component.pins.keys());
205
205
  pinSides.forEach(({ pinId, side, position }) => {
206
- if (component.pins.has(pinId)) {
207
- const tmpPin = component.pins.get(pinId);
206
+ const matchedPinId = pinIdKeys.find(id => id.equals(pinId));
207
+ if (matchedPinId) {
208
+ const tmpPin = component.pins.get(matchedPinId);
208
209
  tmpPin.side = side;
209
210
  tmpPin.position = position;
210
211
  }
212
+ else {
213
+ throw 'Not found!';
214
+ }
211
215
  });
212
216
  this.scope.instances.set(instanceName, component);
213
217
  const pinsOutput = pins.map((pin) => {
@@ -230,15 +234,32 @@ export class ExecutionContext {
230
234
  if (!Array.isArray(items)) {
231
235
  items = [items];
232
236
  }
237
+ items = items.map(item => {
238
+ if (item instanceof NumericValue) {
239
+ item = item.toNumber();
240
+ }
241
+ if (item instanceof PinId) {
242
+ return item;
243
+ }
244
+ else if (PinId.isPinIdType(item)) {
245
+ return new PinId(item);
246
+ }
247
+ return item;
248
+ });
249
+ arrangeProp.set(side, items);
250
+ if (!Array.isArray(items)) {
251
+ items = [items];
252
+ }
233
253
  const uniqueItems = [];
234
254
  items.forEach(item => {
235
- if (item instanceof NumericValue) {
236
- if (seenIds.indexOf(item.toNumber()) === -1) {
237
- seenIds.push(item.toNumber());
255
+ if (item instanceof PinId) {
256
+ const found = seenIds.find(id => id.equals(item));
257
+ if (!found) {
258
+ seenIds.push(item);
238
259
  uniqueItems.push(item);
239
260
  }
240
261
  else {
241
- this.logWarning(`Pin ${item.toNumber()} specified more than once in arrange property`);
262
+ this.logWarning(`Pin ${item.toString()} specified more than once in arrange property`);
242
263
  }
243
264
  }
244
265
  else {
@@ -261,7 +282,7 @@ export class ExecutionContext {
261
282
  const items = arrangeProps.get(side);
262
283
  if (items) {
263
284
  items.forEach(item => {
264
- if (item instanceof NumericValue) {
285
+ if (item instanceof PinId) {
265
286
  pins.push(item);
266
287
  }
267
288
  });
@@ -383,7 +404,7 @@ export class ExecutionContext {
383
404
  const cloneInstanceName = component.instanceName + ':' + idNum;
384
405
  this.scope.instances.set(cloneInstanceName, componentCopy);
385
406
  componentCopy.instanceName = cloneInstanceName;
386
- const defaultPin = 1;
407
+ const defaultPin = new PinId(1);
387
408
  if (this.scope.getNet(component, defaultPin) === null) {
388
409
  const foundNet = this.resolveComponentPinNet(component, defaultPin);
389
410
  if (foundNet !== null) {
@@ -538,9 +559,9 @@ export class ExecutionContext {
538
559
  getBreakContext() {
539
560
  return this.scope.breakStack[this.scope.breakStack.length - 1];
540
561
  }
541
- createFunction(functionName, __runFunc) {
542
- this.scope.functions.set(functionName, __runFunc);
543
- this.__functionCache[functionName] = __runFunc;
562
+ createFunction(functionName, __runFunc, source, uniqueId) {
563
+ this.scope.functions.set(functionName, new CFunctionEntry(functionName, __runFunc, source, uniqueId));
564
+ this.__functionCache.set(functionName, __runFunc);
544
565
  this.log(`defined new function '${functionName}'`);
545
566
  }
546
567
  hasFunction(functionName) {
@@ -602,19 +623,24 @@ export class ExecutionContext {
602
623
  else if (type === ReferenceTypes.instance) {
603
624
  const tmpComponent = parentValue;
604
625
  if (tmpComponent.typeProp === ComponentTypes.net) {
605
- const usedNet = this.scope.getNet(tmpComponent, 1);
626
+ const usedNet = this.scope.getNet(tmpComponent, new PinId(1));
606
627
  if (usedNet) {
607
628
  const trailerValue = trailers.join(".");
608
629
  useValue = usedNet.params.get(trailerValue) ?? null;
609
630
  }
610
631
  }
611
632
  else {
612
- useValue = parentValue.parameters.get(trailersPath);
633
+ useValue = parentValue
634
+ .parameters.get(trailersPath);
613
635
  }
614
636
  }
615
637
  }
638
+ let found = false;
639
+ if (parentValue !== undefined && useValue !== undefined) {
640
+ found = true;
641
+ }
616
642
  return new AnyReference({
617
- found: true,
643
+ found,
618
644
  type: type,
619
645
  parentValue,
620
646
  trailers,
@@ -623,26 +649,28 @@ export class ExecutionContext {
623
649
  }
624
650
  callFunction(functionName, functionParams, executionStack, netNamespace) {
625
651
  let __runFunc = null;
626
- if (this.__functionCache[functionName] === undefined) {
652
+ if (!this.__functionCache.has(functionName)) {
627
653
  if (this.hasFunction(functionName)) {
628
- __runFunc = this.getFunction(functionName);
654
+ const entry = this.getFunction(functionName);
655
+ __runFunc = entry.execute;
629
656
  }
630
657
  if (__runFunc === null) {
631
658
  this.log(`searching for function ${functionName} in upper context`);
632
659
  const tmpResolveResult = this.resolveVariable(executionStack, functionName);
633
660
  if (tmpResolveResult.found) {
634
- __runFunc = tmpResolveResult.value;
661
+ const entry = tmpResolveResult.value;
662
+ __runFunc = entry.execute;
635
663
  }
636
664
  else {
637
665
  throw `Invalid function ${functionName}`;
638
666
  }
639
667
  }
640
668
  this.log('save function to cache:', functionName);
641
- this.__functionCache[functionName] = __runFunc;
669
+ this.__functionCache.set(functionName, __runFunc);
642
670
  }
643
671
  else {
644
672
  this.log('found function in cache:', functionName);
645
- __runFunc = this.__functionCache[functionName];
673
+ __runFunc = this.__functionCache.get(functionName);
646
674
  }
647
675
  if (__runFunc !== null) {
648
676
  this.log(`call function '${functionName}'`);
@@ -689,7 +717,7 @@ export class ExecutionContext {
689
717
  const linkRootComponent = true;
690
718
  const tmpRoot = childScope.componentRoot;
691
719
  if (linkRootComponent) {
692
- const netConnectedToRoot = childScope.getNet(tmpRoot, 1);
720
+ const netConnectedToRoot = childScope.getNet(tmpRoot, new PinId(1));
693
721
  if (netConnectedToRoot !== null) {
694
722
  let currentNet = this.scope.getNet(currentComponent, currentPin);
695
723
  if (currentNet === null) {
@@ -1036,10 +1064,9 @@ export function getPortSide(pins, arrangeProps) {
1036
1064
  position += item[0].toNumber();
1037
1065
  }
1038
1066
  else {
1039
- const itemValue = item.toNumber();
1040
- if (existingPinIds.indexOf(itemValue) !== -1) {
1067
+ if (existingPinIds.find(id => id.equals(item))) {
1041
1068
  result.push({
1042
- pinId: itemValue,
1069
+ pinId: item,
1043
1070
  side: useSide,
1044
1071
  position,
1045
1072
  order: counter
@@ -12,6 +12,7 @@ export var ParamKeys;
12
12
  (function (ParamKeys) {
13
13
  ParamKeys["priority"] = "priority";
14
14
  ParamKeys["net_name"] = "net_name";
15
+ ParamKeys["net_type"] = "net_type";
15
16
  ParamKeys["flip"] = "flip";
16
17
  ParamKeys["flipX"] = "flipX";
17
18
  ParamKeys["flipY"] = "flipY";
@@ -92,6 +93,7 @@ export var ReferenceTypes;
92
93
  ReferenceTypes["variable"] = "variable";
93
94
  ReferenceTypes["instance"] = "instance";
94
95
  ReferenceTypes["pinType"] = "pinType";
96
+ ReferenceTypes["unknown"] = "unknown";
95
97
  })(ReferenceTypes || (ReferenceTypes = {}));
96
98
  export var BlockTypes;
97
99
  (function (BlockTypes) {
@@ -123,3 +125,4 @@ export const RenderFlags = {
123
125
  ShowLabelOrigin: false,
124
126
  };
125
127
  export const SymbolValidatorContext = '_sym';
128
+ export const TrailerArrayIndex = 'index';