cashc 0.7.2 → 0.7.4

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.
@@ -1,4 +1,4 @@
1
1
  export * from './Errors.js';
2
2
  export * as utils from '@cashscript/utils';
3
3
  export { compileFile, compileString } from './compiler.js';
4
- export declare const version = "0.7.2";
4
+ export declare const version = "0.7.4";
@@ -2,5 +2,5 @@ export * from './Errors.js';
2
2
  import * as utils_1 from '@cashscript/utils';
3
3
  export { utils_1 as utils };
4
4
  export { compileFile, compileString } from './compiler.js';
5
- export const version = '0.7.2';
5
+ export const version = '0.7.4';
6
6
  //# sourceMappingURL=index.js.map
@@ -68,20 +68,23 @@ export default class SymbolTableTraversal extends AstTraversal {
68
68
  return node;
69
69
  }
70
70
  visitAssign(node) {
71
- var _a;
71
+ var _a, _b;
72
72
  const v = (_a = this.symbolTables[0].get(node.identifier.name)) === null || _a === void 0 ? void 0 : _a.definition;
73
- if ((v === null || v === void 0 ? void 0 : v.modifier) === Modifier.CONSTANT) {
74
- throw new ConstantModificationError(v);
75
- }
73
+ // const used_modifiers = [] # PREVENT USER FROM USING SAME MODIFIER AGAIN
74
+ (_b = v === null || v === void 0 ? void 0 : v.modifier) === null || _b === void 0 ? void 0 : _b.forEach((modifier) => {
75
+ if (modifier === Modifier.CONSTANT) {
76
+ throw new ConstantModificationError(v);
77
+ }
78
+ });
76
79
  super.visitAssign(node);
77
80
  return node;
78
81
  }
79
82
  visitTupleAssignment(node) {
80
83
  [node.var1, node.var2].forEach(({ name, type }) => {
81
84
  if (this.symbolTables[0].get(name)) {
82
- throw new VariableRedefinitionError(new VariableDefinitionNode(type, '', name, node.tuple));
85
+ throw new VariableRedefinitionError(new VariableDefinitionNode(type, [], name, node.tuple));
83
86
  }
84
- this.symbolTables[0].set(Symbol.variable(new VariableDefinitionNode(type, '', name, node.tuple)));
87
+ this.symbolTables[0].set(Symbol.variable(new VariableDefinitionNode(type, [], name, node.tuple)));
85
88
  });
86
89
  node.tuple = this.visit(node.tuple);
87
90
  return node;
@@ -22,7 +22,7 @@ export default class TypeCheckTraversal extends AstTraversal {
22
22
  if (tupleType instanceof BytesType && variable.type instanceof BytesType) {
23
23
  return node;
24
24
  }
25
- throw new AssignTypeError(new VariableDefinitionNode(variable.type, '', variable.name, node.tuple));
25
+ throw new AssignTypeError(new VariableDefinitionNode(variable.type, [], variable.name, node.tuple));
26
26
  }
27
27
  }
28
28
  return node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cashc",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Compile Bitcoin Cash contracts to Bitcoin Cash Script or artifacts",
5
5
  "keywords": [
6
6
  "bitcoin",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@bitauth/libauth": "^1.18.1",
50
- "@cashscript/utils": "^0.7.2",
50
+ "@cashscript/utils": "^0.7.4",
51
51
  "antlr4ts": "^0.5.0-alpha.4",
52
52
  "commander": "^7.1.0",
53
53
  "semver": "^7.3.4"
@@ -59,5 +59,5 @@
59
59
  "ts-jest": "^26.5.1",
60
60
  "typescript": "^4.1.5"
61
61
  },
62
- "gitHead": "0ec0bd1447e2f89e396c3b7e2c027a121e11f4e1"
62
+ "gitHead": "21624782464044609cb6e018a8d8afd028db01d5"
63
63
  }