circuitscript 0.0.14 → 0.0.15

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/src/visitor.ts CHANGED
@@ -1352,8 +1352,8 @@ export class MainVisitor extends ParseTreeVisitor<any> {
1352
1352
  }
1353
1353
 
1354
1354
  if (instance.typeProp === null){
1355
- this.print('Instance has no type:', instance.instanceName);
1356
- continue;
1355
+ this.print('Instance has no type:', instance.instanceName, ' assuming connector');
1356
+ instance.typeProp = 'conn';
1357
1357
  }
1358
1358
 
1359
1359
  if (instance.parameters.has('refdes')) {
@@ -1569,8 +1569,20 @@ class ComponentAnnotater {
1569
1569
  }
1570
1570
 
1571
1571
  getAnnotation(type: string): string | null {
1572
- if (this.counter[type] === undefined) {
1573
- return null;
1572
+
1573
+ // If type is unknown, then allow it to define a new range
1574
+ if (this.counter[type] === undefined && type.length <= 2) {
1575
+ for (const [, value] of Object.entries(ComponentRefDesPrefixes)) {
1576
+ if (value === type) {
1577
+ throw "Refdes prefix is already in use!";
1578
+ }
1579
+ }
1580
+
1581
+ if (ComponentRefDesPrefixes[type] === undefined) {
1582
+ // Define new type and start counting
1583
+ ComponentRefDesPrefixes[type] = type;
1584
+ this.counter[type] = 1;
1585
+ }
1574
1586
  }
1575
1587
 
1576
1588
  let attempts = 100;