brighterscript 1.0.0-alpha.16 → 1.0.0-alpha.19

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 (158) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/README.md +30 -9
  3. package/dist/BsConfig.d.ts +4 -0
  4. package/dist/DiagnosticMessages.d.ts +16 -1
  5. package/dist/DiagnosticMessages.js +15 -0
  6. package/dist/DiagnosticMessages.js.map +1 -1
  7. package/dist/Logger.js +5 -5
  8. package/dist/Logger.js.map +1 -1
  9. package/dist/Program.d.ts +2 -2
  10. package/dist/Program.js +3 -3
  11. package/dist/Program.js.map +1 -1
  12. package/dist/ProgramBuilder.d.ts +4 -0
  13. package/dist/ProgramBuilder.js +14 -4
  14. package/dist/ProgramBuilder.js.map +1 -1
  15. package/dist/Scope.d.ts +58 -8
  16. package/dist/Scope.js +141 -25
  17. package/dist/Scope.js.map +1 -1
  18. package/dist/XmlScope.js +1 -1
  19. package/dist/XmlScope.js.map +1 -1
  20. package/dist/astUtils/creators.d.ts +3 -3
  21. package/dist/astUtils/creators.js +8 -8
  22. package/dist/astUtils/creators.js.map +1 -1
  23. package/dist/astUtils/creators.spec.js +10 -0
  24. package/dist/astUtils/creators.spec.js.map +1 -1
  25. package/dist/astUtils/reflection.d.ts +8 -5
  26. package/dist/astUtils/reflection.js +18 -6
  27. package/dist/astUtils/reflection.js.map +1 -1
  28. package/dist/astUtils/reflection.spec.js +10 -0
  29. package/dist/astUtils/reflection.spec.js.map +1 -1
  30. package/dist/astUtils/visitors.d.ts +4 -1
  31. package/dist/astUtils/visitors.js.map +1 -1
  32. package/dist/astUtils/visitors.spec.js +2 -0
  33. package/dist/astUtils/visitors.spec.js.map +1 -1
  34. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +2 -2
  35. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
  36. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +7 -3
  37. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -1
  38. package/dist/{types/FunctionType.spec.d.ts → bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.d.ts} +0 -0
  39. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +32 -0
  40. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +1 -0
  41. package/dist/cli.js +9 -2
  42. package/dist/cli.js.map +1 -1
  43. package/dist/examples/plugins/removePrint.js +12 -14
  44. package/dist/examples/plugins/removePrint.js.map +1 -1
  45. package/dist/files/BrsFile.Class.spec.js +3 -3
  46. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  47. package/dist/files/BrsFile.d.ts +2 -2
  48. package/dist/files/BrsFile.js +89 -59
  49. package/dist/files/BrsFile.js.map +1 -1
  50. package/dist/files/BrsFile.spec.js +187 -67
  51. package/dist/files/BrsFile.spec.js.map +1 -1
  52. package/dist/globalCallables.js +79 -79
  53. package/dist/globalCallables.js.map +1 -1
  54. package/dist/interfaces.d.ts +43 -4
  55. package/dist/parser/Expression.d.ts +75 -8
  56. package/dist/parser/Expression.js +147 -22
  57. package/dist/parser/Expression.js.map +1 -1
  58. package/dist/parser/Parser.Class.spec.js +6 -6
  59. package/dist/parser/Parser.Class.spec.js.map +1 -1
  60. package/dist/parser/Parser.d.ts +3 -6
  61. package/dist/parser/Parser.js +145 -142
  62. package/dist/parser/Parser.js.map +1 -1
  63. package/dist/parser/Parser.spec.js +61 -6
  64. package/dist/parser/Parser.spec.js.map +1 -1
  65. package/dist/parser/SGTypes.d.ts +2 -2
  66. package/dist/parser/SGTypes.js +2 -2
  67. package/dist/parser/SGTypes.js.map +1 -1
  68. package/dist/parser/Statement.d.ts +63 -43
  69. package/dist/parser/Statement.js +135 -92
  70. package/dist/parser/Statement.js.map +1 -1
  71. package/dist/parser/tests/statement/InterfaceStatement.spec.js +181 -0
  72. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
  73. package/dist/parser/tests/statement/TryCatch.spec.js +7 -5
  74. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  75. package/dist/types/ArrayType.js +4 -1
  76. package/dist/types/ArrayType.js.map +1 -1
  77. package/dist/types/ArrayType.spec.js +3 -1
  78. package/dist/types/ArrayType.spec.js.map +1 -1
  79. package/dist/types/BooleanType.d.ts +4 -2
  80. package/dist/types/BooleanType.js +7 -2
  81. package/dist/types/BooleanType.js.map +1 -1
  82. package/dist/types/BooleanType.spec.js +3 -1
  83. package/dist/types/BooleanType.spec.js.map +1 -1
  84. package/dist/types/BscType.d.ts +1 -0
  85. package/dist/types/BscType.js +16 -1
  86. package/dist/types/BscType.js.map +1 -1
  87. package/dist/types/CustomType.js +10 -0
  88. package/dist/types/CustomType.js.map +1 -1
  89. package/dist/types/DoubleType.d.ts +2 -0
  90. package/dist/types/DoubleType.js +7 -2
  91. package/dist/types/DoubleType.js.map +1 -1
  92. package/dist/types/DoubleType.spec.js +3 -1
  93. package/dist/types/DoubleType.spec.js.map +1 -1
  94. package/dist/types/DynamicType.d.ts +2 -0
  95. package/dist/types/DynamicType.js +5 -1
  96. package/dist/types/DynamicType.js.map +1 -1
  97. package/dist/types/FloatType.d.ts +3 -1
  98. package/dist/types/FloatType.js +7 -2
  99. package/dist/types/FloatType.js.map +1 -1
  100. package/dist/types/FloatType.spec.js +2 -0
  101. package/dist/types/FloatType.spec.js.map +1 -1
  102. package/dist/types/FunctionType.d.ts +3 -22
  103. package/dist/types/FunctionType.js +8 -68
  104. package/dist/types/FunctionType.js.map +1 -1
  105. package/dist/types/IntegerType.d.ts +3 -1
  106. package/dist/types/IntegerType.js +7 -2
  107. package/dist/types/IntegerType.js.map +1 -1
  108. package/dist/types/IntegerType.spec.js +3 -1
  109. package/dist/types/IntegerType.spec.js.map +1 -1
  110. package/dist/types/InterfaceType.d.ts +13 -10
  111. package/dist/types/InterfaceType.js +33 -29
  112. package/dist/types/InterfaceType.js.map +1 -1
  113. package/dist/types/InterfaceType.spec.js +36 -16
  114. package/dist/types/InterfaceType.spec.js.map +1 -1
  115. package/dist/types/InvalidType.d.ts +4 -2
  116. package/dist/types/InvalidType.js +7 -2
  117. package/dist/types/InvalidType.js.map +1 -1
  118. package/dist/types/InvalidType.spec.js +2 -0
  119. package/dist/types/InvalidType.spec.js.map +1 -1
  120. package/dist/types/LazyType.js +4 -0
  121. package/dist/types/LazyType.js.map +1 -1
  122. package/dist/types/LongIntegerType.d.ts +3 -1
  123. package/dist/types/LongIntegerType.js +7 -2
  124. package/dist/types/LongIntegerType.js.map +1 -1
  125. package/dist/types/LongIntegerType.spec.js +2 -0
  126. package/dist/types/LongIntegerType.spec.js.map +1 -1
  127. package/dist/types/ObjectType.d.ts +2 -1
  128. package/dist/types/ObjectType.js +4 -2
  129. package/dist/types/ObjectType.js.map +1 -1
  130. package/dist/types/StringType.d.ts +4 -2
  131. package/dist/types/StringType.js +7 -2
  132. package/dist/types/StringType.js.map +1 -1
  133. package/dist/types/StringType.spec.js +2 -0
  134. package/dist/types/StringType.spec.js.map +1 -1
  135. package/dist/types/TypedFunctionType.d.ts +28 -0
  136. package/dist/types/TypedFunctionType.js +88 -0
  137. package/dist/types/TypedFunctionType.js.map +1 -0
  138. package/dist/types/TypedFunctionType.spec.d.ts +1 -0
  139. package/dist/types/TypedFunctionType.spec.js +37 -0
  140. package/dist/types/TypedFunctionType.spec.js.map +1 -0
  141. package/dist/types/UninitializedType.js.map +1 -1
  142. package/dist/types/VoidType.d.ts +4 -2
  143. package/dist/types/VoidType.js +5 -1
  144. package/dist/types/VoidType.js.map +1 -1
  145. package/dist/types/helpers.js +7 -2
  146. package/dist/types/helpers.js.map +1 -1
  147. package/dist/util.d.ts +6 -7
  148. package/dist/util.js +43 -55
  149. package/dist/util.js.map +1 -1
  150. package/dist/validators/ClassValidator.d.ts +14 -1
  151. package/dist/validators/ClassValidator.js +129 -82
  152. package/dist/validators/ClassValidator.js.map +1 -1
  153. package/package.json +3 -2
  154. package/dist/types/FunctionType.spec.js +0 -35
  155. package/dist/types/FunctionType.spec.js.map +0 -1
  156. package/dist/types/UniversalFunctionType.d.ts +0 -9
  157. package/dist/types/UniversalFunctionType.js +0 -25
  158. package/dist/types/UniversalFunctionType.js.map +0 -1
@@ -3,15 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BooleanType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  class BooleanType {
6
+ constructor(typeText) {
7
+ this.typeText = typeText;
8
+ }
6
9
  isAssignableTo(targetType) {
7
10
  return ((0, reflection_1.isBooleanType)(targetType) ||
8
- (0, reflection_1.isDynamicType)(targetType));
11
+ (0, reflection_1.isDynamicType)(targetType) ||
12
+ (0, reflection_1.isObjectType)(targetType));
9
13
  }
10
14
  isConvertibleTo(targetType) {
11
15
  return this.isAssignableTo(targetType);
12
16
  }
13
17
  toString() {
14
- return 'boolean';
18
+ var _a;
19
+ return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'boolean';
15
20
  }
16
21
  toTypeString() {
17
22
  return this.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanType.js","sourceRoot":"","sources":["../../src/types/BooleanType.ts"],"names":[],"mappings":";;;AAAA,uDAAsE;AAGtE,MAAa,WAAW;IACb,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC,CAC5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEM,QAAQ;QACX,OAAO,SAAS,CAAC;IACrB,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,0BAAa,EAAC,UAAU,CAAC,CAAC;IACrC,CAAC;CACJ;AAvBD,kCAuBC"}
1
+ {"version":3,"file":"BooleanType.js","sourceRoot":"","sources":["../../src/types/BooleanType.ts"],"names":[],"mappings":";;;AAAA,uDAAoF;AAGpF,MAAa,WAAW;IACpB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAEE,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,yBAAY,EAAC,UAAU,CAAC,CAC3B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,SAAS,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,0BAAa,EAAC,UAAU,CAAC,CAAC;IACrC,CAAC;CACJ;AA5BD,kCA4BC"}
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chai_1 = require("chai");
4
4
  const BooleanType_1 = require("./BooleanType");
5
5
  const DynamicType_1 = require("./DynamicType");
6
+ const ObjectType_1 = require("./ObjectType");
6
7
  describe('BooleanType', () => {
7
- it('is equivalent to boolean types', () => {
8
+ it('is assignable to various types', () => {
8
9
  (0, chai_1.expect)(new BooleanType_1.BooleanType().isAssignableTo(new BooleanType_1.BooleanType())).to.be.true;
9
10
  (0, chai_1.expect)(new BooleanType_1.BooleanType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
11
+ (0, chai_1.expect)(new BooleanType_1.BooleanType().isAssignableTo(new ObjectType_1.ObjectType())).to.be.true;
10
12
  });
11
13
  });
12
14
  //# sourceMappingURL=BooleanType.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanType.spec.js","sourceRoot":"","sources":["../../src/types/BooleanType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,+CAA4C;AAC5C,+CAA4C;AAE5C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACvE,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC3E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"BooleanType.spec.js","sourceRoot":"","sources":["../../src/types/BooleanType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,+CAA4C;AAC5C,+CAA4C;AAC5C,6CAA0C;AAE1C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACvE,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACvE,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,uBAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC1E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -19,3 +19,4 @@ export interface TypeContext {
19
19
  position?: Position;
20
20
  }
21
21
  export declare function getTypeFromContext(type: BscType, context?: TypeContext): BscType;
22
+ export declare function checkAssignabilityToInterface(sourceType: BscType, targetType: BscType, context?: TypeContext): any;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTypeFromContext = void 0;
3
+ exports.checkAssignabilityToInterface = exports.getTypeFromContext = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  function getTypeFromContext(type, context) {
6
6
  if ((0, reflection_1.isLazyType)(type)) {
@@ -9,4 +9,19 @@ function getTypeFromContext(type, context) {
9
9
  return type;
10
10
  }
11
11
  exports.getTypeFromContext = getTypeFromContext;
12
+ function checkAssignabilityToInterface(sourceType, targetType, context) {
13
+ var _a;
14
+ if (!sourceType.memberTable || !targetType.memberTable || !(0, reflection_1.isInterfaceType)(targetType)) {
15
+ return false;
16
+ }
17
+ let isSuperSet = true;
18
+ const targetSymbols = (_a = targetType.memberTable) === null || _a === void 0 ? void 0 : _a.getAllSymbols();
19
+ for (const targetSymbol of targetSymbols) {
20
+ // TODO TYPES: this ignores union types
21
+ const mySymbolsWithName = sourceType.memberTable.getSymbol(targetSymbol.name);
22
+ isSuperSet = isSuperSet && mySymbolsWithName && mySymbolsWithName.length > 0 && mySymbolsWithName[0].type.isAssignableTo(targetSymbol.type, context);
23
+ }
24
+ return isSuperSet;
25
+ }
26
+ exports.checkAssignabilityToInterface = checkAssignabilityToInterface;
12
27
  //# sourceMappingURL=BscType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BscType.js","sourceRoot":"","sources":["../../src/types/BscType.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAyBpD,SAAgB,kBAAkB,CAAC,IAAa,EAAE,OAAqB;IACnE,IAAI,IAAA,uBAAU,EAAC,IAAI,CAAC,EAAE;QAClB,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;KAC3C;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AALD,gDAKC"}
1
+ {"version":3,"file":"BscType.js","sourceRoot":"","sources":["../../src/types/BscType.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AAyBrE,SAAgB,kBAAkB,CAAC,IAAa,EAAE,OAAqB;IACnE,IAAI,IAAA,uBAAU,EAAC,IAAI,CAAC,EAAE;QAClB,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;KAC3C;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AALD,gDAKC;AAED,SAAgB,6BAA6B,CAAC,UAAmB,EAAE,UAAmB,EAAE,OAAqB;;IACzG,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,IAAA,4BAAe,EAAC,UAAU,CAAC,EAAE;QACpF,OAAO,KAAK,CAAC;KAChB;IACD,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,MAAM,aAAa,GAAG,MAAA,UAAU,CAAC,WAAW,0CAAE,aAAa,EAAE,CAAC;IAC9D,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACtC,uCAAuC;QAEvC,MAAM,iBAAiB,GAAG,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC9E,UAAU,GAAG,UAAU,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACxJ;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAbD,sEAaC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CustomType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
+ const BscType_1 = require("./BscType");
5
6
  class CustomType {
6
7
  constructor(name, memberTable = null) {
7
8
  this.name = name;
@@ -15,10 +16,19 @@ class CustomType {
15
16
  }
16
17
  isAssignableTo(targetType, context) {
17
18
  var _a;
19
+ if ((0, reflection_1.isObjectType)(targetType)) {
20
+ return true;
21
+ }
18
22
  const ancestorTypes = (_a = context === null || context === void 0 ? void 0 : context.scope) === null || _a === void 0 ? void 0 : _a.getAncestorTypeListByContext(this, context);
19
23
  if (ancestorTypes === null || ancestorTypes === void 0 ? void 0 : ancestorTypes.find(ancestorType => targetType.equals(ancestorType, context))) {
20
24
  return true;
21
25
  }
26
+ if (this.memberTable && targetType.memberTable) {
27
+ // both have symbol tables, so check if the target is an interface and has all the members of the target
28
+ if ((0, BscType_1.checkAssignabilityToInterface)(this, targetType, context)) {
29
+ return true;
30
+ }
31
+ }
22
32
  return (this.equals(targetType, context) ||
23
33
  (0, reflection_1.isObjectType)(targetType) ||
24
34
  (0, reflection_1.isDynamicType)(targetType));
@@ -1 +1 @@
1
- {"version":3,"file":"CustomType.js","sourceRoot":"","sources":["../../src/types/CustomType.ts"],"names":[],"mappings":";;;AAAA,uDAAmF;AAInF,MAAa,UAAU;IAEnB,YAAmB,IAAY,EAAS,cAA2B,IAAI;QAApD,SAAI,GAAJ,IAAI,CAAQ;QAAS,gBAAW,GAAX,WAAW,CAAoB;IACvE,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAEM,YAAY;QACf,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,cAAc,CAAC,UAAmB,EAAE,OAAqB;;QAC5D,MAAM,aAAa,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClF,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,EAAE;Y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AY,EAAE,OAAO,CAAC,CAAC,EAAE;YAC/E,OAAO,IAAI,CAAC;SACf;QACD,IAAI,IAAI,CAAC,WAAW,IAAI,UAAU,CAAC,WAAW,EAAE;YAC5C,wGAAwG;YACxG,IAAI,IAAA,uCAA6B,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;gBAC1D,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,CACH,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC;YAChC,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,0BAAa,EAAC,UAAU,CAAC,CAC5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB,EAAE,OAAqB;QAC7D,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAEM,MAAM,CAAC,UAAmB,EAAE,OAAqB;QACpD,OAAO,IAAA,yBAAY,EAAC,UAAU,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAK,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE,CAAA,CAAC;IAClF,CAAC;CACJ;AAzCD,gCAyCC"}
@@ -1,5 +1,7 @@
1
1
  import type { BscType } from './BscType';
2
2
  export declare class DoubleType implements BscType {
3
+ typeText?: string;
4
+ constructor(typeText?: string);
3
5
  isAssignableTo(targetType: BscType): boolean;
4
6
  isConvertibleTo(targetType: BscType): boolean;
5
7
  toString(): string;
@@ -3,9 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DoubleType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  class DoubleType {
6
+ constructor(typeText) {
7
+ this.typeText = typeText;
8
+ }
6
9
  isAssignableTo(targetType) {
7
10
  return ((0, reflection_1.isDoubleType)(targetType) ||
8
- (0, reflection_1.isDynamicType)(targetType));
11
+ (0, reflection_1.isDynamicType)(targetType) ||
12
+ (0, reflection_1.isObjectType)(targetType));
9
13
  }
10
14
  isConvertibleTo(targetType) {
11
15
  if ((0, reflection_1.isDynamicType)(targetType) ||
@@ -20,7 +24,8 @@ class DoubleType {
20
24
  }
21
25
  }
22
26
  toString() {
23
- return 'double';
27
+ var _a;
28
+ return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'double';
24
29
  }
25
30
  toTypeString() {
26
31
  return this.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"DoubleType.js","sourceRoot":"","sources":["../../src/types/DoubleType.ts"],"names":[],"mappings":";;;AAAA,uDAAoH;AAGpH,MAAa,UAAU;IACZ,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,0BAAa,EAAC,UAAU,CAAC,CAC5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,IACI,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,8BAAiB,EAAC,UAAU,CAAC,EAC/B;YACE,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IACM,QAAQ;QACX,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAK,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE,CAAA,CAAC;IACtD,CAAC;CACJ;AAhCD,gCAgCC"}
1
+ {"version":3,"file":"DoubleType.js","sourceRoot":"","sources":["../../src/types/DoubleType.ts"],"names":[],"mappings":";;;AAAA,uDAAkI;AAGlI,MAAa,UAAU;IACnB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAEE,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,yBAAY,EAAC,UAAU,CAAC,CAC3B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,IACI,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,8BAAiB,EAAC,UAAU,CAAC,EAC/B;YACE,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IACM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,QAAQ,CAAC;IACrC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAK,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE,CAAA,CAAC;IACtD,CAAC;CACJ;AArCD,gCAqCC"}
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chai_1 = require("chai");
4
4
  const DoubleType_1 = require("./DoubleType");
5
5
  const DynamicType_1 = require("./DynamicType");
6
+ const ObjectType_1 = require("./ObjectType");
6
7
  describe('DoubleType', () => {
7
- it('is equivalent to double types', () => {
8
+ it('is assignable to correct types', () => {
8
9
  (0, chai_1.expect)(new DoubleType_1.DoubleType().isAssignableTo(new DoubleType_1.DoubleType())).to.be.true;
9
10
  (0, chai_1.expect)(new DoubleType_1.DoubleType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
11
+ (0, chai_1.expect)(new DoubleType_1.DoubleType().isAssignableTo(new ObjectType_1.ObjectType())).to.be.true;
10
12
  });
11
13
  });
12
14
  //# sourceMappingURL=DoubleType.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DoubleType.spec.js","sourceRoot":"","sources":["../../src/types/DoubleType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,6CAA0C;AAC1C,+CAA4C;AAE5C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,IAAA,aAAM,EAAC,IAAI,uBAAU,EAAE,CAAC,cAAc,CAAC,IAAI,uBAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACrE,IAAA,aAAM,EAAC,IAAI,uBAAU,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC1E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"DoubleType.spec.js","sourceRoot":"","sources":["../../src/types/DoubleType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,6CAA0C;AAC1C,+CAA4C;AAC5C,6CAA0C;AAE1C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,IAAA,aAAM,EAAC,IAAI,uBAAU,EAAE,CAAC,cAAc,CAAC,IAAI,uBAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACrE,IAAA,aAAM,EAAC,IAAI,uBAAU,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACtE,IAAA,aAAM,EAAC,IAAI,uBAAU,EAAE,CAAC,cAAc,CAAC,IAAI,uBAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACzE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import type { BscType } from './BscType';
2
2
  export declare class DynamicType implements BscType {
3
+ typeText?: string;
4
+ constructor(typeText?: string);
3
5
  isAssignableTo(targetType: BscType): boolean;
4
6
  /**
5
7
  * The dynamic type is convertible to everything.
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynamicType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  class DynamicType {
6
+ constructor(typeText) {
7
+ this.typeText = typeText;
8
+ }
6
9
  isAssignableTo(targetType) {
7
10
  //everything can be dynamic, so as long as a type is provided, this is true
8
11
  return !!targetType;
@@ -16,7 +19,8 @@ class DynamicType {
16
19
  return !!targetType;
17
20
  }
18
21
  toString() {
19
- return 'dynamic';
22
+ var _a;
23
+ return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'dynamic';
20
24
  }
21
25
  toTypeString() {
22
26
  return this.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicType.js","sourceRoot":"","sources":["../../src/types/DynamicType.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAGvD,MAAa,WAAW;IAEb,cAAc,CAAC,UAAmB;QACrC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,UAAmB;QACtC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,QAAQ;QACX,OAAO,SAAS,CAAC;IACrB,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,0BAAa,EAAC,UAAU,CAAC,CAAC;IACrC,CAAC;CACJ;AA3BD,kCA2BC"}
1
+ {"version":3,"file":"DynamicType.js","sourceRoot":"","sources":["../../src/types/DynamicType.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAGvD,MAAa,WAAW;IACpB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAEE,cAAc,CAAC,UAAmB;QACrC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,UAAmB;QACtC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,SAAS,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,0BAAa,EAAC,UAAU,CAAC,CAAC;IACrC,CAAC;CACJ;AA9BD,kCA8BC"}
@@ -1,6 +1,8 @@
1
1
  import type { BscType } from './BscType';
2
2
  export declare class FloatType implements BscType {
3
- isAssignableTo(targetType: BscType): any;
3
+ typeText?: string;
4
+ constructor(typeText?: string);
5
+ isAssignableTo(targetType: BscType): boolean;
4
6
  isConvertibleTo(targetType: BscType): boolean;
5
7
  toString(): string;
6
8
  toTypeString(): string;
@@ -3,9 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FloatType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  class FloatType {
6
+ constructor(typeText) {
7
+ this.typeText = typeText;
8
+ }
6
9
  isAssignableTo(targetType) {
7
10
  return ((0, reflection_1.isFloatType)(targetType) ||
8
- (0, reflection_1.isDynamicType)(targetType));
11
+ (0, reflection_1.isDynamicType)(targetType) ||
12
+ (0, reflection_1.isObjectType)(targetType));
9
13
  }
10
14
  isConvertibleTo(targetType) {
11
15
  if ((0, reflection_1.isDynamicType)(targetType) ||
@@ -20,7 +24,8 @@ class FloatType {
20
24
  }
21
25
  }
22
26
  toString() {
23
- return 'float';
27
+ var _a;
28
+ return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'float';
24
29
  }
25
30
  toTypeString() {
26
31
  return this.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"FloatType.js","sourceRoot":"","sources":["../../src/types/FloatType.ts"],"names":[],"mappings":";;;AAAA,uDAAoH;AAGpH,MAAa,SAAS;IACX,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,0BAAa,EAAC,UAAU,CAAC,CAE5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,IACI,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,8BAAiB,EAAC,UAAU,CAAC,EAC/B;YACE,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IAEM,QAAQ;QACX,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAK,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE,CAAA,CAAC;IACtD,CAAC;CACJ;AAlCD,8BAkCC"}
1
+ {"version":3,"file":"FloatType.js","sourceRoot":"","sources":["../../src/types/FloatType.ts"],"names":[],"mappings":";;;AAAA,uDAAkI;AAGlI,MAAa,SAAS;IAClB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAEE,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,yBAAY,EAAC,UAAU,CAAC,CAC3B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,IACI,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,8BAAiB,EAAC,UAAU,CAAC,EAC/B;YACE,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,OAAO,CAAC;IACpC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAK,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE,CAAA,CAAC;IACtD,CAAC;CACJ;AAtCD,8BAsCC"}
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chai_1 = require("chai");
4
4
  const DynamicType_1 = require("./DynamicType");
5
5
  const FloatType_1 = require("./FloatType");
6
+ const ObjectType_1 = require("./ObjectType");
6
7
  describe('FloatType', () => {
7
8
  it('is equivalent to double types', () => {
8
9
  (0, chai_1.expect)(new FloatType_1.FloatType().isAssignableTo(new FloatType_1.FloatType())).to.be.true;
9
10
  (0, chai_1.expect)(new FloatType_1.FloatType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
11
+ (0, chai_1.expect)(new FloatType_1.FloatType().isAssignableTo(new ObjectType_1.ObjectType())).to.be.true;
10
12
  });
11
13
  });
12
14
  //# sourceMappingURL=FloatType.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloatType.spec.js","sourceRoot":"","sources":["../../src/types/FloatType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,+CAA4C;AAC5C,2CAAwC;AAExC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,IAAA,aAAM,EAAC,IAAI,qBAAS,EAAE,CAAC,cAAc,CAAC,IAAI,qBAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACnE,IAAA,aAAM,EAAC,IAAI,qBAAS,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACzE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"FloatType.spec.js","sourceRoot":"","sources":["../../src/types/FloatType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,+CAA4C;AAC5C,2CAAwC;AACxC,6CAA0C;AAE1C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,IAAA,aAAM,EAAC,IAAI,qBAAS,EAAE,CAAC,cAAc,CAAC,IAAI,qBAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACnE,IAAA,aAAM,EAAC,IAAI,qBAAS,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACrE,IAAA,aAAM,EAAC,IAAI,qBAAS,EAAE,CAAC,cAAc,CAAC,IAAI,uBAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,28 +1,9 @@
1
1
  import type { CallableParam } from '../interfaces';
2
2
  import type { BscType, TypeContext } from './BscType';
3
- export declare class FunctionType implements BscType {
4
- returnType: BscType;
5
- /**
6
- * Determines if this is a sub or not
7
- */
8
- isSub: boolean;
9
- params: CallableParam[];
10
- isNew: boolean;
11
- isVariadic: boolean;
12
- constructor(returnType: BscType,
13
- /**
14
- * Determines if this is a sub or not
15
- */
16
- isSub?: boolean, params?: CallableParam[], isNew?: boolean, isVariadic?: boolean);
17
- /**
18
- * The name of the function for this type. Can be null
19
- */
20
- name: string;
3
+ import { TypedFunctionType } from './TypedFunctionType';
4
+ export declare class FunctionType extends TypedFunctionType implements BscType {
5
+ constructor();
21
6
  setName(name: string): this;
22
7
  addParameter(paramOrName: CallableParam | string, type?: BscType, isOptional?: boolean): this;
23
- isAssignableTo(targetType: BscType, context?: TypeContext): boolean;
24
- isConvertibleTo(targetType: BscType, context?: TypeContext): boolean;
25
- toString(context?: TypeContext): string;
26
- toTypeString(): string;
27
8
  equals(targetType: BscType, context?: TypeContext): boolean;
28
9
  }
@@ -3,82 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FunctionType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  const DynamicType_1 = require("./DynamicType");
6
- class FunctionType {
7
- constructor(returnType,
8
- /**
9
- * Determines if this is a sub or not
10
- */
11
- isSub = false, params = [], isNew = false, isVariadic = false) {
12
- this.returnType = returnType;
13
- this.isSub = isSub;
14
- this.params = params;
15
- this.isNew = isNew;
16
- this.isVariadic = isVariadic;
6
+ const TypedFunctionType_1 = require("./TypedFunctionType");
7
+ class FunctionType extends TypedFunctionType_1.TypedFunctionType {
8
+ constructor() {
9
+ super(new DynamicType_1.DynamicType());
10
+ this.isVariadic = true;
17
11
  }
18
12
  setName(name) {
19
- this.name = name;
13
+ // noop
20
14
  return this;
21
15
  }
22
16
  addParameter(paramOrName, type, isOptional) {
23
- if (typeof paramOrName === 'string') {
24
- this.params.push({
25
- name: paramOrName,
26
- type: type !== null && type !== void 0 ? type : new DynamicType_1.DynamicType(),
27
- isOptional: isOptional === true ? true : false,
28
- isRestArgument: false
29
- });
30
- }
31
- else {
32
- this.params.push(paramOrName);
33
- }
17
+ // noop
34
18
  return this;
35
19
  }
36
- isAssignableTo(targetType, context) {
37
- if ((0, reflection_1.isFunctionType)(targetType)) {
38
- if (!targetType.isVariadic) {
39
- //compare all parameters
40
- let len = Math.max(this.params.length, targetType.params.length);
41
- for (let i = 0; i < len; i++) {
42
- let myParam = this.params[i];
43
- let targetParam = targetType.params[i];
44
- if (!myParam || !targetParam || !myParam.type.isAssignableTo(targetParam.type, context)) {
45
- return false;
46
- }
47
- }
48
- }
49
- //compare return type
50
- if (!this.returnType || !targetType.returnType || !this.returnType.isAssignableTo(targetType.returnType, context)) {
51
- return false;
52
- }
53
- //made it here, all params and return type are equivalent
54
- return true;
55
- }
56
- else if ((0, reflection_1.isDynamicType)(targetType)) {
57
- return true;
58
- }
59
- else {
60
- return false;
61
- }
62
- }
63
- isConvertibleTo(targetType, context) {
64
- return this.isAssignableTo(targetType, context);
65
- }
66
- toString(context) {
67
- var _a, _b;
68
- let paramTexts = [];
69
- for (let param of this.params) {
70
- paramTexts.push(`${param.name}${param.isOptional ? '?' : ''} as ${param.type.toString(context)}`);
71
- }
72
- if (this.isNew) {
73
- return `new ${(_a = this.name) !== null && _a !== void 0 ? _a : ''}(${paramTexts.join(', ')})`;
74
- }
75
- return `${this.isSub ? 'sub' : 'function'} ${(_b = this.name) !== null && _b !== void 0 ? _b : ''}(${paramTexts.join(', ')}) as ${this.returnType.toString(context)}`;
76
- }
77
- toTypeString() {
78
- return 'Function';
79
- }
80
20
  equals(targetType, context) {
81
- return ((0, reflection_1.isFunctionType)(targetType)) && this.isAssignableTo(targetType, context);
21
+ return ((0, reflection_1.isFunctionType)(targetType));
82
22
  }
83
23
  }
84
24
  exports.FunctionType = FunctionType;
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionType.js","sourceRoot":"","sources":["../../src/types/FunctionType.ts"],"names":[],"mappings":";;;AAAA,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CAAI,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;SAC7D;QACD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,IAAI,MAAA,IAAI,CAAC,IAAI,mCAAI,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAErI,CAAC;IAEM,YAAY;QACf,OAAO,UAAU,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,UAAmB,EAAE,OAAqB;QACpD,OAAO,CAAC,IAAA,2BAAc,EAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;CACJ;AAvFD,oCAuFC"}
1
+ {"version":3,"file":"FunctionType.js","sourceRoot":"","sources":["../../src/types/FunctionType.ts"],"names":[],"mappings":";;;AAAA,uDAAwD;AAGxD,+CAA4C;AAC5C,2DAAwD;AAExD,MAAa,YAAa,SAAQ,qCAAiB;IAE/C;QAEI,KAAK,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;IAEM,OAAO,CAAC,IAAY;QACvB,OAAO;QACP,OAAO,IAAI,CAAC;IAChB,CAAC;IACM,YAAY,CAAC,WAAmC,EAAE,IAAc,EAAE,UAAoB;QACzF,OAAO;QACP,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,UAAmB,EAAE,OAAqB;QACpD,OAAO,CAAC,IAAA,2BAAc,EAAC,UAAU,CAAC,CAAC,CAAC;IACxC,CAAC;CACJ;AApBD,oCAoBC"}
@@ -1,6 +1,8 @@
1
1
  import type { BscType } from './BscType';
2
2
  export declare class IntegerType implements BscType {
3
- isAssignableTo(targetType: BscType): any;
3
+ typeText?: string;
4
+ constructor(typeText?: string);
5
+ isAssignableTo(targetType: BscType): boolean;
4
6
  isConvertibleTo(targetType: BscType): boolean;
5
7
  toString(): string;
6
8
  toTypeString(): string;
@@ -3,9 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IntegerType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  class IntegerType {
6
+ constructor(typeText) {
7
+ this.typeText = typeText;
8
+ }
6
9
  isAssignableTo(targetType) {
7
10
  return ((0, reflection_1.isIntegerType)(targetType) ||
8
- (0, reflection_1.isDynamicType)(targetType));
11
+ (0, reflection_1.isDynamicType)(targetType) ||
12
+ (0, reflection_1.isObjectType)(targetType));
9
13
  }
10
14
  isConvertibleTo(targetType) {
11
15
  if ((0, reflection_1.isDynamicType)(targetType) ||
@@ -20,7 +24,8 @@ class IntegerType {
20
24
  }
21
25
  }
22
26
  toString() {
23
- return 'integer';
27
+ var _a;
28
+ return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'integer';
24
29
  }
25
30
  toTypeString() {
26
31
  return this.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"IntegerType.js","sourceRoot":"","sources":["../../src/types/IntegerType.ts"],"names":[],"mappings":";;;AAAA,uDAAoH;AAIpH,MAAa,WAAW;IACb,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC,CAC5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,IACI,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,8BAAiB,EAAC,UAAU,CAAC,EAC/B;YACE,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IAEM,Q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sCC"}
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chai_1 = require("chai");
4
4
  const DynamicType_1 = require("./DynamicType");
5
5
  const IntegerType_1 = require("./IntegerType");
6
+ const ObjectType_1 = require("./ObjectType");
6
7
  describe('IntegerType', () => {
7
- it('is equivalent to other integer types', () => {
8
+ it('is assignable to other proper types', () => {
8
9
  (0, chai_1.expect)(new IntegerType_1.IntegerType().isAssignableTo(new IntegerType_1.IntegerType())).to.be.true;
9
10
  (0, chai_1.expect)(new IntegerType_1.IntegerType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
11
+ (0, chai_1.expect)(new IntegerType_1.IntegerType().isAssignableTo(new ObjectType_1.ObjectType())).to.be.true;
10
12
  });
11
13
  });
12
14
  //# sourceMappingURL=IntegerType.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntegerType.spec.js","sourceRoot":"","sources":["../../src/types/IntegerType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,+CAA4C;AAC5C,+CAA4C;AAE5C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACvE,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC3E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"IntegerType.spec.js","sourceRoot":"","sources":["../../src/types/IntegerType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,+CAA4C;AAC5C,+CAA4C;AAC5C,6CAA0C;AAE1C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC3C,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACvE,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACvE,IAAA,aAAM,EAAC,IAAI,yBAAW,EAAE,CAAC,cAAc,CAAC,IAAI,uBAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC1E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,14 +1,17 @@
1
- import type { BscType } from './BscType';
2
- export declare class InterfaceType implements BscType {
3
- members: Map<string, BscType>;
4
- constructor(members: Map<string, BscType>);
5
- /**
6
- * The name of the interface. Can be null.
7
- */
1
+ import type { SymbolTable } from '../SymbolTable';
2
+ import type { BscType, SymbolContainer, TypeContext } from './BscType';
3
+ export declare class InterfaceType implements BscType, SymbolContainer {
8
4
  name: string;
9
- isAssignableTo(targetType: BscType): boolean;
10
- isConvertibleTo(targetType: BscType): boolean;
5
+ memberTable: SymbolTable;
6
+ constructor(name: string, memberTable?: SymbolTable);
7
+ isAssignableTo(targetType: BscType, context?: TypeContext): any;
8
+ isConvertibleTo(targetType: BscType): any;
11
9
  toString(): string;
10
+ /**
11
+ * Gets a string representation of the Interface that looks like javascript
12
+ * @returns {string}
13
+ */
14
+ toJsString(): string;
12
15
  toTypeString(): string;
13
- equals(targetType: BscType): boolean;
16
+ equals(targetType: BscType, context?: TypeContext): boolean;
14
17
  }
@@ -2,44 +2,51 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InterfaceType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
+ const BscType_1 = require("./BscType");
5
6
  class InterfaceType {
6
- constructor(members) {
7
- this.members = members;
7
+ constructor(name, memberTable = null) {
8
+ this.name = name;
9
+ this.memberTable = memberTable;
8
10
  }
9
- isAssignableTo(targetType) {
10
- //we must have all of the members of the target type, and they must be equivalent types
11
- if ((0, reflection_1.isInterfaceType)(targetType)) {
12
- for (const [targetMemberName, targetMemberType] of targetType.members) {
13
- //we don't have the target member
14
- if (!this.members.has(targetMemberName)) {
15
- return false;
16
- }
17
- //our member's type is not assignable to the target member type
18
- if (!this.members.get(targetMemberName).isAssignableTo(targetMemberType)) {
19
- return false;
20
- }
21
- }
22
- //we have all of the target member's types. we are assignable!
11
+ isAssignableTo(targetType, context) {
12
+ var _a;
13
+ if ((0, reflection_1.isObjectType)(targetType)) {
23
14
  return true;
24
- //we are always assignable to dynamic or object
25
15
  }
26
- else if ((0, reflection_1.isDynamicType)(targetType) || (0, reflection_1.isObjectType)(targetType)) {
16
+ const ancestorTypes = (_a = context === null || context === void 0 ? void 0 : context.scope) === null || _a === void 0 ? void 0 : _a.getAncestorTypeListByContext(this, context);
17
+ if (ancestorTypes === null || ancestorTypes === void 0 ? void 0 : ancestorTypes.find(ancestorType => targetType.equals(ancestorType, context))) {
27
18
  return true;
28
- //not assignable to any other object types
29
19
  }
30
- else {
31
- return false;
20
+ if (this.memberTable && targetType.memberTable) {
21
+ // both have symbol tables, so check if this interface has all the members of the target
22
+ return (0, BscType_1.checkAssignabilityToInterface)(this, targetType, context);
32
23
  }
24
+ return (this.equals(targetType, context) ||
25
+ (0, reflection_1.isObjectType)(targetType) ||
26
+ (0, reflection_1.isDynamicType)(targetType));
33
27
  }
34
28
  isConvertibleTo(targetType) {
35
29
  return this.isAssignableTo(targetType);
36
30
  }
37
31
  toString() {
32
+ return this.name;
33
+ }
34
+ /**
35
+ * Gets a string representation of the Interface that looks like javascript
36
+ * @returns {string}
37
+ */
38
+ toJsString() {
39
+ var _a;
38
40
  let result = '{';
39
- for (const [key, type] of this.members.entries()) {
40
- result += ' ' + key + ': ' + type.toString() + ';';
41
+ const memberSymbols = (((_a = this.memberTable) === null || _a === void 0 ? void 0 : _a.getAllSymbols()) || []).sort((a, b) => a.name.localeCompare(b.name));
42
+ for (const symbol of memberSymbols) {
43
+ let symbolTypeString = symbol.type.toString();
44
+ if ((0, reflection_1.isInterfaceType)(symbol.type)) {
45
+ symbolTypeString = symbol.type.toJsString();
46
+ }
47
+ result += ' ' + symbol.name + ': ' + symbolTypeString + ';';
41
48
  }
42
- if (this.members.size > 0) {
49
+ if (memberSymbols.length > 0) {
43
50
  result += ' ';
44
51
  }
45
52
  return result + '}';
@@ -47,12 +54,9 @@ class InterfaceType {
47
54
  toTypeString() {
48
55
  return 'object';
49
56
  }
50
- equals(targetType) {
57
+ equals(targetType, context) {
51
58
  if ((0, reflection_1.isInterfaceType)(targetType)) {
52
- if (targetType.members.size !== this.members.size) {
53
- return false;
54
- }
55
- return targetType.isAssignableTo(this);
59
+ return this.isAssignableTo(targetType, context) && targetType.isAssignableTo(this, context);
56
60
  }
57
61
  return false;
58
62
  }