brighterscript 0.65.1 → 0.66.0-alpha.0

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 (249) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +8 -0
  3. package/dist/BsConfig.d.ts +5 -11
  4. package/dist/CacheVerifier.d.ts +8 -0
  5. package/dist/CacheVerifier.js +20 -0
  6. package/dist/CacheVerifier.js.map +1 -0
  7. package/dist/DiagnosticMessages.d.ts +9 -4
  8. package/dist/DiagnosticMessages.js +8 -3
  9. package/dist/DiagnosticMessages.js.map +1 -1
  10. package/dist/FunctionScope.d.ts +1 -0
  11. package/dist/FunctionScope.js +3 -0
  12. package/dist/FunctionScope.js.map +1 -1
  13. package/dist/PluginInterface.d.ts +0 -4
  14. package/dist/PluginInterface.js.map +1 -1
  15. package/dist/Program.d.ts +6 -39
  16. package/dist/Program.js +42 -44
  17. package/dist/Program.js.map +1 -1
  18. package/dist/ProgramBuilder.d.ts +4 -0
  19. package/dist/ProgramBuilder.js +12 -7
  20. package/dist/ProgramBuilder.js.map +1 -1
  21. package/dist/Scope.d.ts +1 -5
  22. package/dist/Scope.js +3 -28
  23. package/dist/Scope.js.map +1 -1
  24. package/dist/SymbolTable.d.ts +44 -6
  25. package/dist/SymbolTable.js +151 -25
  26. package/dist/SymbolTable.js.map +1 -1
  27. package/dist/XmlScope.js +11 -12
  28. package/dist/XmlScope.js.map +1 -1
  29. package/dist/astUtils/creators.d.ts +16 -6
  30. package/dist/astUtils/creators.js +39 -16
  31. package/dist/astUtils/creators.js.map +1 -1
  32. package/dist/astUtils/reflection.d.ts +46 -37
  33. package/dist/astUtils/reflection.js +145 -147
  34. package/dist/astUtils/reflection.js.map +1 -1
  35. package/dist/astUtils/reflection.spec.js +1 -6
  36. package/dist/astUtils/reflection.spec.js.map +1 -1
  37. package/dist/astUtils/visitors.d.ts +4 -11
  38. package/dist/astUtils/visitors.js +0 -7
  39. package/dist/astUtils/visitors.js.map +1 -1
  40. package/dist/astUtils/visitors.spec.js +4 -2
  41. package/dist/astUtils/visitors.spec.js.map +1 -1
  42. package/dist/astUtils/xml.d.ts +9 -9
  43. package/dist/astUtils/xml.js +6 -6
  44. package/dist/astUtils/xml.js.map +1 -1
  45. package/dist/bscPlugin/BscPlugin.js +4 -0
  46. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  47. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
  48. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +2 -2
  49. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  50. package/dist/bscPlugin/hover/HoverProcessor.js +71 -59
  51. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
  52. package/dist/bscPlugin/hover/HoverProcessor.spec.js +110 -10
  53. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
  54. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +6 -5
  55. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
  56. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +1 -1
  57. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -1
  58. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +11 -0
  59. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +53 -0
  60. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
  61. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +4 -0
  62. package/dist/bscPlugin/validation/BrsFileValidator.js +72 -16
  63. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  64. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1 -1
  65. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
  66. package/dist/bscPlugin/validation/ScopeValidator.d.ts +1 -0
  67. package/dist/bscPlugin/validation/ScopeValidator.js +72 -18
  68. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
  69. package/dist/bscPlugin/validation/XmlFileValidator.js +9 -9
  70. package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
  71. package/dist/files/BrsFile.Class.spec.js +9 -10
  72. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  73. package/dist/files/BrsFile.d.ts +8 -10
  74. package/dist/files/BrsFile.js +72 -52
  75. package/dist/files/BrsFile.js.map +1 -1
  76. package/dist/files/BrsFile.spec.js +56 -14
  77. package/dist/files/BrsFile.spec.js.map +1 -1
  78. package/dist/files/XmlFile.d.ts +19 -19
  79. package/dist/files/XmlFile.js +24 -42
  80. package/dist/files/XmlFile.js.map +1 -1
  81. package/dist/files/XmlFile.spec.js +61 -9
  82. package/dist/files/XmlFile.spec.js.map +1 -1
  83. package/dist/files/tests/imports.spec.js +8 -11
  84. package/dist/files/tests/imports.spec.js.map +1 -1
  85. package/dist/globalCallables.js +2 -1
  86. package/dist/globalCallables.js.map +1 -1
  87. package/dist/index.d.ts +2 -0
  88. package/dist/index.js +2 -0
  89. package/dist/index.js.map +1 -1
  90. package/dist/interfaces.d.ts +20 -1
  91. package/dist/interfaces.js +13 -0
  92. package/dist/interfaces.js.map +1 -1
  93. package/dist/lexer/TokenKind.d.ts +2 -0
  94. package/dist/lexer/TokenKind.js +5 -1
  95. package/dist/lexer/TokenKind.js.map +1 -1
  96. package/dist/parser/AstNode.d.ts +78 -1
  97. package/dist/parser/AstNode.js +80 -1
  98. package/dist/parser/AstNode.js.map +1 -1
  99. package/dist/parser/Expression.d.ts +87 -53
  100. package/dist/parser/Expression.js +243 -139
  101. package/dist/parser/Expression.js.map +1 -1
  102. package/dist/parser/Parser.Class.spec.js +10 -7
  103. package/dist/parser/Parser.Class.spec.js.map +1 -1
  104. package/dist/parser/Parser.d.ts +9 -5
  105. package/dist/parser/Parser.js +125 -78
  106. package/dist/parser/Parser.js.map +1 -1
  107. package/dist/parser/Parser.spec.d.ts +2 -0
  108. package/dist/parser/Parser.spec.js +117 -5
  109. package/dist/parser/Parser.spec.js.map +1 -1
  110. package/dist/parser/SGParser.d.ts +42 -4
  111. package/dist/parser/SGParser.js +191 -195
  112. package/dist/parser/SGParser.js.map +1 -1
  113. package/dist/parser/SGParser.spec.js +13 -10
  114. package/dist/parser/SGParser.spec.js.map +1 -1
  115. package/dist/parser/SGTypes.d.ts +279 -51
  116. package/dist/parser/SGTypes.js +562 -185
  117. package/dist/parser/SGTypes.js.map +1 -1
  118. package/dist/parser/Statement.d.ts +88 -70
  119. package/dist/parser/Statement.js +212 -136
  120. package/dist/parser/Statement.js.map +1 -1
  121. package/dist/parser/TranspileState.d.ts +1 -1
  122. package/dist/parser/TranspileState.js +5 -2
  123. package/dist/parser/TranspileState.js.map +1 -1
  124. package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
  125. package/dist/parser/tests/expression/TypeExpression.spec.js +127 -0
  126. package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
  127. package/dist/types/ArrayType.d.ts +6 -4
  128. package/dist/types/ArrayType.js +30 -22
  129. package/dist/types/ArrayType.js.map +1 -1
  130. package/dist/types/ArrayType.spec.js +8 -8
  131. package/dist/types/ArrayType.spec.js.map +1 -1
  132. package/dist/types/BooleanType.d.ts +7 -4
  133. package/dist/types/BooleanType.js +13 -8
  134. package/dist/types/BooleanType.js.map +1 -1
  135. package/dist/types/BooleanType.spec.js +9 -3
  136. package/dist/types/BooleanType.spec.js.map +1 -1
  137. package/dist/types/BscType.d.ts +25 -2
  138. package/dist/types/BscType.js +64 -0
  139. package/dist/types/BscType.js.map +1 -1
  140. package/dist/types/BscTypeKind.d.ts +22 -0
  141. package/dist/types/BscTypeKind.js +27 -0
  142. package/dist/types/BscTypeKind.js.map +1 -0
  143. package/dist/types/ClassType.d.ts +11 -0
  144. package/dist/types/ClassType.js +31 -0
  145. package/dist/types/ClassType.js.map +1 -0
  146. package/dist/types/ClassType.spec.d.ts +1 -0
  147. package/dist/types/ClassType.spec.js +75 -0
  148. package/dist/types/ClassType.spec.js.map +1 -0
  149. package/dist/types/DoubleType.d.ts +7 -4
  150. package/dist/types/DoubleType.js +16 -20
  151. package/dist/types/DoubleType.js.map +1 -1
  152. package/dist/types/DoubleType.spec.js +11 -3
  153. package/dist/types/DoubleType.spec.js.map +1 -1
  154. package/dist/types/DynamicType.d.ts +9 -3
  155. package/dist/types/DynamicType.js +16 -2
  156. package/dist/types/DynamicType.js.map +1 -1
  157. package/dist/types/DynamicType.spec.js +15 -4
  158. package/dist/types/DynamicType.spec.js.map +1 -1
  159. package/dist/types/EnumType.d.ts +22 -0
  160. package/dist/types/EnumType.js +59 -0
  161. package/dist/types/EnumType.js.map +1 -0
  162. package/dist/types/EnumType.spec.d.ts +1 -0
  163. package/dist/types/EnumType.spec.js +33 -0
  164. package/dist/types/EnumType.spec.js.map +1 -0
  165. package/dist/types/FloatType.d.ts +7 -4
  166. package/dist/types/FloatType.js +16 -20
  167. package/dist/types/FloatType.js.map +1 -1
  168. package/dist/types/FloatType.spec.js +3 -3
  169. package/dist/types/FloatType.spec.js.map +1 -1
  170. package/dist/types/FunctionType.d.ts +6 -4
  171. package/dist/types/FunctionType.js +22 -19
  172. package/dist/types/FunctionType.js.map +1 -1
  173. package/dist/types/FunctionType.spec.js +5 -5
  174. package/dist/types/FunctionType.spec.js.map +1 -1
  175. package/dist/types/InheritableType.d.ts +25 -0
  176. package/dist/types/InheritableType.js +88 -0
  177. package/dist/types/InheritableType.js.map +1 -0
  178. package/dist/types/IntegerType.d.ts +7 -4
  179. package/dist/types/IntegerType.js +16 -20
  180. package/dist/types/IntegerType.js.map +1 -1
  181. package/dist/types/IntegerType.spec.js +7 -3
  182. package/dist/types/IntegerType.spec.js.map +1 -1
  183. package/dist/types/InterfaceType.d.ts +10 -10
  184. package/dist/types/InterfaceType.js +24 -45
  185. package/dist/types/InterfaceType.js.map +1 -1
  186. package/dist/types/InterfaceType.spec.js +59 -45
  187. package/dist/types/InterfaceType.spec.js.map +1 -1
  188. package/dist/types/InvalidType.d.ts +6 -4
  189. package/dist/types/InvalidType.js +12 -8
  190. package/dist/types/InvalidType.js.map +1 -1
  191. package/dist/types/InvalidType.spec.js +7 -3
  192. package/dist/types/InvalidType.spec.js.map +1 -1
  193. package/dist/types/LongIntegerType.d.ts +7 -4
  194. package/dist/types/LongIntegerType.js +16 -20
  195. package/dist/types/LongIntegerType.js.map +1 -1
  196. package/dist/types/LongIntegerType.spec.js +9 -3
  197. package/dist/types/LongIntegerType.spec.js.map +1 -1
  198. package/dist/types/NamespaceType.d.ts +11 -0
  199. package/dist/types/NamespaceType.js +25 -0
  200. package/dist/types/NamespaceType.js.map +1 -0
  201. package/dist/types/ObjectType.d.ts +8 -4
  202. package/dist/types/ObjectType.js +26 -7
  203. package/dist/types/ObjectType.js.map +1 -1
  204. package/dist/types/ObjectType.spec.js +2 -2
  205. package/dist/types/ObjectType.spec.js.map +1 -1
  206. package/dist/types/ReferenceType.d.ts +51 -0
  207. package/dist/types/ReferenceType.js +274 -0
  208. package/dist/types/ReferenceType.js.map +1 -0
  209. package/dist/types/ReferenceType.spec.d.ts +1 -0
  210. package/dist/types/ReferenceType.spec.js +122 -0
  211. package/dist/types/ReferenceType.spec.js.map +1 -0
  212. package/dist/types/StringType.d.ts +10 -4
  213. package/dist/types/StringType.js +16 -8
  214. package/dist/types/StringType.js.map +1 -1
  215. package/dist/types/StringType.spec.js +2 -2
  216. package/dist/types/StringType.spec.js.map +1 -1
  217. package/dist/types/UninitializedType.d.ts +6 -3
  218. package/dist/types/UninitializedType.js +14 -3
  219. package/dist/types/UninitializedType.js.map +1 -1
  220. package/dist/types/UnionType.d.ts +18 -0
  221. package/dist/types/UnionType.js +91 -0
  222. package/dist/types/UnionType.js.map +1 -0
  223. package/dist/types/UnionType.spec.d.ts +1 -0
  224. package/dist/types/UnionType.spec.js +103 -0
  225. package/dist/types/UnionType.spec.js.map +1 -0
  226. package/dist/types/VoidType.d.ts +7 -4
  227. package/dist/types/VoidType.js +13 -8
  228. package/dist/types/VoidType.js.map +1 -1
  229. package/dist/types/VoidType.spec.js +2 -2
  230. package/dist/types/VoidType.spec.js.map +1 -1
  231. package/dist/types/helper.spec.d.ts +1 -0
  232. package/dist/types/helper.spec.js +130 -0
  233. package/dist/types/helper.spec.js.map +1 -0
  234. package/dist/types/helpers.d.ts +19 -0
  235. package/dist/types/helpers.js +131 -0
  236. package/dist/types/helpers.js.map +1 -0
  237. package/dist/types/index.d.ts +22 -0
  238. package/dist/types/index.js +39 -0
  239. package/dist/types/index.js.map +1 -0
  240. package/dist/util.d.ts +9 -8
  241. package/dist/util.js +78 -32
  242. package/dist/util.js.map +1 -1
  243. package/dist/validators/ClassValidator.d.ts +0 -4
  244. package/dist/validators/ClassValidator.js +6 -30
  245. package/dist/validators/ClassValidator.js.map +1 -1
  246. package/package.json +2 -1
  247. package/dist/types/CustomType.d.ts +0 -9
  248. package/dist/types/CustomType.js +0 -32
  249. package/dist/types/CustomType.js.map +0 -1
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUniqueType = exports.reduceTypesToMostGeneric = exports.getUniqueTypesFromArray = exports.findTypeUnion = exports.findTypeIntersection = void 0;
4
+ const reflection_1 = require("../astUtils/reflection");
5
+ function findTypeIntersection(typesArr1, typesArr2) {
6
+ if (!typesArr1 || !typesArr2) {
7
+ return undefined;
8
+ }
9
+ return typesArr1 === null || typesArr1 === void 0 ? void 0 : typesArr1.filter((currentType) => {
10
+ if (!currentType) {
11
+ return false;
12
+ }
13
+ const indexOfCurrentTypeInArr2 = typesArr2.findIndex((checkType) => {
14
+ return currentType.isEqual(checkType);
15
+ });
16
+ return indexOfCurrentTypeInArr2 >= 0;
17
+ });
18
+ }
19
+ exports.findTypeIntersection = findTypeIntersection;
20
+ function findTypeUnion(...typesArr) {
21
+ return getUniqueTypesFromArray([].concat(...typesArr));
22
+ }
23
+ exports.findTypeUnion = findTypeUnion;
24
+ function getUniqueTypesFromArray(types) {
25
+ if (!types) {
26
+ return undefined;
27
+ }
28
+ return types === null || types === void 0 ? void 0 : types.filter((currentType, currentIndex) => {
29
+ if (!currentType) {
30
+ return false;
31
+ }
32
+ const latestIndex = types.findIndex((checkType) => {
33
+ return currentType.isEqual(checkType);
34
+ });
35
+ // the index that was found is the index we're checking --- there are no equal types after this
36
+ return latestIndex === currentIndex;
37
+ });
38
+ }
39
+ exports.getUniqueTypesFromArray = getUniqueTypesFromArray;
40
+ /**
41
+ * Reduces a list of types based on equality or inheritance
42
+ * If all types are the same - just that type is returned
43
+ * If one of the types is Dynamic, then Dynamic.instance is returned
44
+ * If any types inherit another type, the more general type is returned
45
+ * @param types array of types
46
+ * @returns an array of the most general types
47
+ */
48
+ function reduceTypesToMostGeneric(types) {
49
+ if (!types || (types === null || types === void 0 ? void 0 : types.length) === 0) {
50
+ return undefined;
51
+ }
52
+ if (types.length === 1) {
53
+ // only one type
54
+ return [types[0]];
55
+ }
56
+ // Get a list of unique types, based on the `isEqual()` method
57
+ const uniqueTypes = getUniqueTypesFromArray(types).map(t => {
58
+ // map to object with `shouldIgnore` flag
59
+ return { type: t, shouldIgnore: false };
60
+ });
61
+ if (uniqueTypes.length === 1) {
62
+ // only one type after filtering
63
+ return [uniqueTypes[0].type];
64
+ }
65
+ const existingDynamicType = uniqueTypes.find(t => !(0, reflection_1.isReferenceType)(t.type) && (0, reflection_1.isDynamicType)(t.type));
66
+ if (existingDynamicType) {
67
+ // If it includes dynamic, then the result is dynamic
68
+ return [existingDynamicType.type];
69
+ }
70
+ const generalizedTypes = [];
71
+ //check assignability:
72
+ for (let i = 0; i < uniqueTypes.length; i++) {
73
+ const currentType = uniqueTypes[i].type;
74
+ if (i === uniqueTypes.length - 1) {
75
+ if (!uniqueTypes[i].shouldIgnore) {
76
+ //this type was not convertible to anything else... it is as general as possible
77
+ generalizedTypes.push(currentType);
78
+ }
79
+ break;
80
+ }
81
+ for (let j = i + 1; j < uniqueTypes.length; j++) {
82
+ if (uniqueTypes[j].shouldIgnore) {
83
+ continue;
84
+ }
85
+ const checkType = uniqueTypes[j].type;
86
+ if (currentType.isEqual(uniqueTypes[j].type)) {
87
+ uniqueTypes[j].shouldIgnore = true;
88
+ }
89
+ else if ((0, reflection_1.isInheritableType)(currentType) && (0, reflection_1.isInheritableType)(checkType)) {
90
+ if (currentType.isTypeDescendent(checkType)) {
91
+ //the type we're checking is less general than the current type... it can be ignored
92
+ uniqueTypes[j].shouldIgnore = true;
93
+ }
94
+ if (checkType.isTypeDescendent(currentType)) {
95
+ // the currentType is a descendent to some other type - it won't be in the final set
96
+ break;
97
+ }
98
+ }
99
+ if (j === uniqueTypes.length - 1) {
100
+ //this type was not convertible to anything else... it is as general as possible
101
+ generalizedTypes.push(currentType);
102
+ }
103
+ }
104
+ }
105
+ return generalizedTypes;
106
+ }
107
+ exports.reduceTypesToMostGeneric = reduceTypesToMostGeneric;
108
+ /**
109
+ * Gets a Unique type from a list of types
110
+ * @param types array of types
111
+ * @returns either the singular most general type, if there is one, otherwise a UnionType of the most general types
112
+ */
113
+ function getUniqueType(types, unionTypeFactory) {
114
+ types = types === null || types === void 0 ? void 0 : types.map(type => {
115
+ if (!(0, reflection_1.isReferenceType)(type) && (0, reflection_1.isUnionType)(type)) {
116
+ return type.types;
117
+ }
118
+ return type;
119
+ }).flat();
120
+ const generalizedTypes = reduceTypesToMostGeneric(types);
121
+ if (!generalizedTypes || generalizedTypes.length === 0) {
122
+ return undefined;
123
+ }
124
+ if ((generalizedTypes === null || generalizedTypes === void 0 ? void 0 : generalizedTypes.length) === 1) {
125
+ // only one type
126
+ return generalizedTypes[0];
127
+ }
128
+ return unionTypeFactory(generalizedTypes);
129
+ }
130
+ exports.getUniqueType = getUniqueType;
131
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/types/helpers.ts"],"names":[],"mappings":";;;AAAA,uDAAwG;AAGxG,SAAgB,oBAA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AAK,CAAC;SACrB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC,EAAE,IAAI,EAAE,CAAC;IACV,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACzD,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;QACpD,OAAO,SAAS,CAAC;KACpB;IACD,IAAI,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,MAAM,MAAK,CAAC,EAAE;QAChC,gBAAgB;QAChB,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;KAC9B;IACD,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AAC9C,CAAC;AAhBD,sCAgBC"}
@@ -0,0 +1,22 @@
1
+ export * from './ArrayType';
2
+ export * from './BooleanType';
3
+ export * from './BscType';
4
+ export * from './ClassType';
5
+ export * from './DoubleType';
6
+ export * from './DynamicType';
7
+ export * from './EnumType';
8
+ export * from './FloatType';
9
+ export * from './FunctionType';
10
+ export * from './helpers';
11
+ export * from './InheritableType';
12
+ export * from './IntegerType';
13
+ export * from './InterfaceType';
14
+ export * from './InvalidType';
15
+ export * from './LongIntegerType';
16
+ export * from './NamespaceType';
17
+ export * from './ObjectType';
18
+ export * from './ReferenceType';
19
+ export * from './StringType';
20
+ export * from './UninitializedType';
21
+ export * from './UnionType';
22
+ export * from './VoidType';
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ArrayType"), exports);
18
+ __exportStar(require("./BooleanType"), exports);
19
+ __exportStar(require("./BscType"), exports);
20
+ __exportStar(require("./ClassType"), exports);
21
+ __exportStar(require("./DoubleType"), exports);
22
+ __exportStar(require("./DynamicType"), exports);
23
+ __exportStar(require("./EnumType"), exports);
24
+ __exportStar(require("./FloatType"), exports);
25
+ __exportStar(require("./FunctionType"), exports);
26
+ __exportStar(require("./helpers"), exports);
27
+ __exportStar(require("./InheritableType"), exports);
28
+ __exportStar(require("./IntegerType"), exports);
29
+ __exportStar(require("./InterfaceType"), exports);
30
+ __exportStar(require("./InvalidType"), exports);
31
+ __exportStar(require("./LongIntegerType"), exports);
32
+ __exportStar(require("./NamespaceType"), exports);
33
+ __exportStar(require("./ObjectType"), exports);
34
+ __exportStar(require("./ReferenceType"), exports);
35
+ __exportStar(require("./StringType"), exports);
36
+ __exportStar(require("./UninitializedType"), exports);
37
+ __exportStar(require("./UnionType"), exports);
38
+ __exportStar(require("./VoidType"), exports);
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B;AAC7B,gDAA8B;AAC9B,6CAA2B;AAC3B,8CAA4B;AAC5B,iDAA+B;AAC/B,4CAA0B;AAC1B,oDAAkC;AAClC,gDAA8B;AAC9B,kDAAgC;AAChC,gDAA8B;AAC9B,oDAAkC;AAClC,kDAAgC;AAChC,+CAA6B;AAC7B,kDAAgC;AAChC,+CAA6B;AAC7B,sDAAoC;AACpC,8CAA4B;AAC5B,6CAA2B"}
package/dist/util.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Diagnostic, Position, Range, Location } from 'vscode-languageserver';
2
2
  import type { BsConfig } from './BsConfig';
3
- import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo } from './interfaces';
3
+ import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, TypeChainEntry, TypeChainProcessResult } from './interfaces';
4
4
  import { BooleanType } from './types/BooleanType';
5
5
  import { DoubleType } from './types/DoubleType';
6
6
  import { DynamicType } from './types/DynamicType';
@@ -12,11 +12,10 @@ import { LongIntegerType } from './types/LongIntegerType';
12
12
  import { ObjectType } from './types/ObjectType';
13
13
  import { StringType } from './types/StringType';
14
14
  import { VoidType } from './types/VoidType';
15
+ import { ParseMode } from './parser/Parser';
15
16
  import type { DottedGetExpression, VariableExpression } from './parser/Expression';
16
17
  import type { Identifier, Locatable, Token } from './lexer/Token';
17
- import { CustomType } from './types/CustomType';
18
18
  import { SourceNode } from 'source-map';
19
- import type { SGAttribute } from './parser/SGTypes';
20
19
  import type { BrsFile } from './files/BrsFile';
21
20
  import type { XmlFile } from './files/XmlFile';
22
21
  import type { Expression, Statement } from './parser/AstNode';
@@ -289,7 +288,7 @@ export declare class Util {
289
288
  /**
290
289
  * Convert a token into a BscType
291
290
  */
292
- tokenToBscType(token: Token, allowCustomType?: boolean): DynamicType | BooleanType | LongIntegerType | IntegerType | FloatType | DoubleType | FunctionType | InvalidType | ObjectType | StringType | VoidType | CustomType;
291
+ tokenToBscType(token: Token): DynamicType | FloatType | IntegerType | DoubleType | LongIntegerType | StringType | BooleanType | InvalidType | VoidType | FunctionType | ObjectType;
293
292
  /**
294
293
  * Get the extension for the given file path. Basically the part after the final dot, except for
295
294
  * `d.bs` which is treated as single extension
@@ -309,10 +308,6 @@ export declare class Util {
309
308
  * that haven't changed at all, but we still need the map
310
309
  */
311
310
  simpleMap(source: string, src: string): SourceNode;
312
- /**
313
- * Creates a new SGAttribute object, but keeps the existing Range references (since those shouldn't ever get changed directly)
314
- */
315
- cloneSGAttribute(attr: SGAttribute, value: string): SGAttribute;
316
311
  /**
317
312
  * Converts a path into a standardized format (drive letter to lower, remove extra slashes, use single slash type, resolve relative parts, etc...)
318
313
  */
@@ -365,6 +360,7 @@ export declare class Util {
365
360
  * @returns an array of the parts of the dotted get. If not fully a dotted get, then returns undefined
366
361
  */
367
362
  getAllDottedGetParts(node: Expression | Statement): Identifier[] | undefined;
363
+ getAllDottedGetPartsAsString(node: Expression | Statement, parseMode?: ParseMode): string;
368
364
  /**
369
365
  * Break an expression into each part.
370
366
  */
@@ -382,6 +378,11 @@ export declare class Util {
382
378
  */
383
379
  rangeToString(range: Range): string;
384
380
  validateTooDeepFile(file: (BrsFile | XmlFile)): void;
381
+ /**
382
+ * Find the index of the last item in the array that matches.
383
+ */
384
+ findLastIndex<T>(array: T[], matcher: (T: any) => boolean): number;
385
+ processTypeChain(typeChain: TypeChainEntry[]): TypeChainProcessResult;
385
386
  }
386
387
  /**
387
388
  * A tagged template literal function for standardizing the path. This has to be defined as standalone function since it's a tagged template literal function,
package/dist/util.js CHANGED
@@ -25,9 +25,9 @@ const Logger_1 = require("./Logger");
25
25
  const TokenKind_1 = require("./lexer/TokenKind");
26
26
  const reflection_1 = require("./astUtils/reflection");
27
27
  const visitors_1 = require("./astUtils/visitors");
28
- const CustomType_1 = require("./types/CustomType");
29
28
  const source_map_1 = require("source-map");
30
29
  const requireRelative = require("require-relative");
30
+ const creators_1 = require("./astUtils/creators");
31
31
  class Util {
32
32
  clearConsole() {
33
33
  // process.stdout.write('\x1Bc');
@@ -303,8 +303,7 @@ class Util {
303
303
  config.username = (_d = config.username) !== null && _d !== void 0 ? _d : 'rokudev';
304
304
  config.watch = config.watch === true ? true : false;
305
305
  config.emitFullPaths = config.emitFullPaths === true ? true : false;
306
- config.retainStagingDir = ((_e = config.retainStagingDir) !== null && _e !== void 0 ? _e : config.retainStagingFolder) === true ? true : false;
307
- config.retainStagingFolder = config.retainStagingDir;
306
+ config.retainStagingDir = (_e = config.retainStagingDir) !== null && _e !== void 0 ? _e : false;
308
307
  config.copyToStaging = config.copyToStaging === false ? false : true;
309
308
  config.ignoreErrorCodes = (_f = config.ignoreErrorCodes) !== null && _f !== void 0 ? _f : [];
310
309
  config.diagnosticSeverityOverrides = (_g = config.diagnosticSeverityOverrides) !== null && _g !== void 0 ? _g : {};
@@ -316,6 +315,7 @@ class Util {
316
315
  config.allowBrighterScriptInBrightScript = config.allowBrighterScriptInBrightScript === true ? true : false;
317
316
  config.emitDefinitions = config.emitDefinitions === true ? true : false;
318
317
  config.removeParameterTypes = config.removeParameterTypes === true ? true : false;
318
+ config.enableTypeValidation = config.enableTypeValidation === true ? true : false;
319
319
  if (typeof config.logLevel === 'string') {
320
320
  config.logLevel = Logger_1.LogLevel[config.logLevel.toLowerCase()];
321
321
  }
@@ -919,37 +919,37 @@ class Util {
919
919
  /**
920
920
  * Convert a token into a BscType
921
921
  */
922
- tokenToBscType(token, allowCustomType = true) {
922
+ tokenToBscType(token) {
923
923
  // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
924
924
  switch (token.kind) {
925
925
  case TokenKind_1.TokenKind.Boolean:
926
926
  return new BooleanType_1.BooleanType(token.text);
927
927
  case TokenKind_1.TokenKind.True:
928
928
  case TokenKind_1.TokenKind.False:
929
- return new BooleanType_1.BooleanType();
929
+ return BooleanType_1.BooleanType.instance;
930
930
  case TokenKind_1.TokenKind.Double:
931
931
  return new DoubleType_1.DoubleType(token.text);
932
932
  case TokenKind_1.TokenKind.DoubleLiteral:
933
- return new DoubleType_1.DoubleType();
933
+ return DoubleType_1.DoubleType.instance;
934
934
  case TokenKind_1.TokenKind.Dynamic:
935
935
  return new DynamicType_1.DynamicType(token.text);
936
936
  case TokenKind_1.TokenKind.Float:
937
937
  return new FloatType_1.FloatType(token.text);
938
938
  case TokenKind_1.TokenKind.FloatLiteral:
939
- return new FloatType_1.FloatType();
939
+ return FloatType_1.FloatType.instance;
940
940
  case TokenKind_1.TokenKind.Function:
941
941
  //TODO should there be a more generic function type without a signature that's assignable to all other function types?
942
942
  return new FunctionType_1.FunctionType(new DynamicType_1.DynamicType(token.text));
943
943
  case TokenKind_1.TokenKind.Integer:
944
944
  return new IntegerType_1.IntegerType(token.text);
945
945
  case TokenKind_1.TokenKind.IntegerLiteral:
946
- return new IntegerType_1.IntegerType();
946
+ return IntegerType_1.IntegerType.instance;
947
947
  case TokenKind_1.TokenKind.Invalid:
948
948
  return new InvalidType_1.InvalidType(token.text);
949
949
  case TokenKind_1.TokenKind.LongInteger:
950
950
  return new LongIntegerType_1.LongIntegerType(token.text);
951
951
  case TokenKind_1.TokenKind.LongIntegerLiteral:
952
- return new LongIntegerType_1.LongIntegerType();
952
+ return LongIntegerType_1.LongIntegerType.instance;
953
953
  case TokenKind_1.TokenKind.Object:
954
954
  return new ObjectType_1.ObjectType(token.text);
955
955
  case TokenKind_1.TokenKind.String:
@@ -958,7 +958,7 @@ class Util {
958
958
  case TokenKind_1.TokenKind.TemplateStringExpressionBegin:
959
959
  case TokenKind_1.TokenKind.TemplateStringExpressionEnd:
960
960
  case TokenKind_1.TokenKind.TemplateStringQuasi:
961
- return new StringType_1.StringType();
961
+ return StringType_1.StringType.instance;
962
962
  case TokenKind_1.TokenKind.Void:
963
963
  return new VoidType_1.VoidType(token.text);
964
964
  case TokenKind_1.TokenKind.Identifier:
@@ -967,6 +967,8 @@ class Util {
967
967
  return new BooleanType_1.BooleanType(token.text);
968
968
  case 'double':
969
969
  return new DoubleType_1.DoubleType(token.text);
970
+ case 'dynamic':
971
+ return new DynamicType_1.DynamicType(token.text);
970
972
  case 'float':
971
973
  return new FloatType_1.FloatType(token.text);
972
974
  case 'function':
@@ -984,9 +986,6 @@ class Util {
984
986
  case 'void':
985
987
  return new VoidType_1.VoidType(token.text);
986
988
  }
987
- if (allowCustomType) {
988
- return new CustomType_1.CustomType(token.text);
989
- }
990
989
  }
991
990
  }
992
991
  /**
@@ -1082,22 +1081,6 @@ class Util {
1082
1081
  }
1083
1082
  return new source_map_1.SourceNode(null, null, source, chunks);
1084
1083
  }
1085
- /**
1086
- * Creates a new SGAttribute object, but keeps the existing Range references (since those shouldn't ever get changed directly)
1087
- */
1088
- cloneSGAttribute(attr, value) {
1089
- return {
1090
- key: {
1091
- text: attr.key.text,
1092
- range: attr.range
1093
- },
1094
- value: {
1095
- text: value,
1096
- range: attr.value.range
1097
- },
1098
- range: attr.range
1099
- };
1100
- }
1101
1084
  /**
1102
1085
  * Converts a path into a standardized format (drive letter to lower, remove extra slashes, use single slash type, resolve relative parts, etc...)
1103
1086
  */
@@ -1249,16 +1232,30 @@ class Util {
1249
1232
  parts.push(nextPart === null || nextPart === void 0 ? void 0 : nextPart.name);
1250
1233
  nextPart = nextPart.obj;
1251
1234
  }
1252
- else if ((0, reflection_1.isNamespacedVariableNameExpression)(nextPart)) {
1235
+ else if ((0, reflection_1.isCallExpression)(nextPart)) {
1236
+ nextPart = nextPart.callee;
1237
+ }
1238
+ else if ((0, reflection_1.isTypeExpression)(nextPart)) {
1253
1239
  nextPart = nextPart.expression;
1254
1240
  }
1255
1241
  else if ((0, reflection_1.isVariableExpression)(nextPart)) {
1256
1242
  parts.push(nextPart === null || nextPart === void 0 ? void 0 : nextPart.name);
1257
1243
  break;
1258
1244
  }
1245
+ else if ((0, reflection_1.isLiteralExpression)(nextPart)) {
1246
+ parts.push(nextPart === null || nextPart === void 0 ? void 0 : nextPart.token);
1247
+ break;
1248
+ }
1249
+ else if ((0, reflection_1.isIndexedGetExpression)(nextPart)) {
1250
+ nextPart = nextPart.obj;
1251
+ }
1259
1252
  else if ((0, reflection_1.isFunctionParameterExpression)(nextPart)) {
1260
1253
  return [nextPart.name];
1261
1254
  }
1255
+ else if ((0, reflection_1.isGroupingExpression)(nextPart)) {
1256
+ parts.push((0, creators_1.createIdentifier)('()', nextPart.range));
1257
+ break;
1258
+ }
1262
1259
  else {
1263
1260
  //we found a non-DottedGet expression, so return because this whole operation is invalid.
1264
1261
  return undefined;
@@ -1266,6 +1263,15 @@ class Util {
1266
1263
  }
1267
1264
  return parts.reverse();
1268
1265
  }
1266
+ getAllDottedGetPartsAsString(node, parseMode = Parser_1.ParseMode.BrighterScript) {
1267
+ var _a;
1268
+ const sep = parseMode === Parser_1.ParseMode.BrighterScript ? '.' : '_';
1269
+ const hello = (_a = this.getAllDottedGetParts(node)) === null || _a === void 0 ? void 0 : _a.map(part => part.text).join(sep);
1270
+ if (!hello) {
1271
+ console.log(node);
1272
+ }
1273
+ return hello;
1274
+ }
1269
1275
  /**
1270
1276
  * Break an expression into each part.
1271
1277
  */
@@ -1279,7 +1285,7 @@ class Util {
1279
1285
  else if ((0, reflection_1.isCallExpression)(nextPart) || (0, reflection_1.isCallfuncExpression)(nextPart)) {
1280
1286
  nextPart = nextPart.callee;
1281
1287
  }
1282
- else if ((0, reflection_1.isNamespacedVariableNameExpression)(nextPart)) {
1288
+ else if ((0, reflection_1.isTypeExpression)(nextPart)) {
1283
1289
  nextPart = nextPart.expression;
1284
1290
  }
1285
1291
  else {
@@ -1312,7 +1318,7 @@ class Util {
1312
1318
  nextPart = nextPart.call.callee;
1313
1319
  parts = [];
1314
1320
  }
1315
- else if ((0, reflection_1.isNamespacedVariableNameExpression)(nextPart)) {
1321
+ else if ((0, reflection_1.isTypeExpression)(nextPart)) {
1316
1322
  nextPart = nextPart.expression;
1317
1323
  }
1318
1324
  else if ((0, reflection_1.isVariableExpression)(nextPart)) {
@@ -1361,6 +1367,46 @@ class Util {
1361
1367
  file.addDiagnostics([Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.detectedTooDeepFileSource(fileDepth)), { file: file, range: this.createRange(0, 0, 0, Number.MAX_VALUE) })]);
1362
1368
  }
1363
1369
  }
1370
+ /**
1371
+ * Find the index of the last item in the array that matches.
1372
+ */
1373
+ findLastIndex(array, matcher) {
1374
+ for (let i = array.length - 1; i >= 0; i--) {
1375
+ if (matcher(array[i])) {
1376
+ return i;
1377
+ }
1378
+ }
1379
+ }
1380
+ processTypeChain(typeChain) {
1381
+ let fullChainName = '';
1382
+ let fullErrorName = '';
1383
+ let missingItemName = '';
1384
+ let previousTypeName = '';
1385
+ let parentTypeName = '';
1386
+ let errorRange;
1387
+ for (let i = 0; i < typeChain.length; i++) {
1388
+ const chainItem = typeChain[i];
1389
+ if (i > 0) {
1390
+ fullChainName += '.';
1391
+ }
1392
+ fullChainName += chainItem.name;
1393
+ parentTypeName = previousTypeName;
1394
+ fullErrorName = previousTypeName ? `${previousTypeName}.${chainItem.name}` : chainItem.name;
1395
+ previousTypeName = chainItem.type.toString();
1396
+ missingItemName = chainItem.name;
1397
+ if (!chainItem.isResolved) {
1398
+ errorRange = chainItem.range;
1399
+ break;
1400
+ }
1401
+ }
1402
+ return {
1403
+ missingItemName: missingItemName,
1404
+ missingItemParentTypeName: parentTypeName,
1405
+ fullNameOfMissingItem: fullErrorName,
1406
+ fullChainName: fullChainName,
1407
+ range: errorRange
1408
+ };
1409
+ }
1364
1410
  }
1365
1411
  exports.Util = Util;
1366
1412
  /**