@arcgis/arcade-languageservice 5.0.0-next.67 → 5.0.0-next.68

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 (3) hide show
  1. package/dist/index.d.ts +83 -7
  2. package/dist/index.js +1396 -1355
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -68,7 +68,7 @@ declare interface AssignmentExpression extends NodeBase<typeof NodeTypes.Assignm
68
68
  /**
69
69
  * Arcade assignment operators.
70
70
  */
71
- declare const AssignmentOperators: readonly string[];
71
+ declare const AssignmentOperators: readonly ["=", "/=", "*=", "%=", "+=", "-="];
72
72
 
73
73
  /**
74
74
  * Arcade assignment operators.
@@ -103,7 +103,7 @@ declare interface BinaryExpression extends NodeBase<typeof NodeTypes.BinaryExpre
103
103
  /**
104
104
  * Arcade binary operators.
105
105
  */
106
- declare const BinaryOperators: readonly string[];
106
+ declare const BinaryOperators: readonly ["|", "&", ">>", "<<", ">>>", "^", "==", "!=", "<", "<=", ">", ">=", "+", "-", "*", "/", "%"];
107
107
 
108
108
  /**
109
109
  * Arcade binary operators.
@@ -152,7 +152,7 @@ declare interface CallExpression extends NodeBase<typeof NodeTypes.CallExpressio
152
152
  * Example: foo(1, 2, 3)
153
153
  * The callee is foo.
154
154
  */
155
- callee: Identifier | MemberExpression;
155
+ callee: Identifier | MemberExpression | SafeMemberExpression;
156
156
  /**
157
157
  * The arguments of the call expression.
158
158
  * Example: foo(1, 2, 3)
@@ -448,7 +448,7 @@ declare interface ExportSpecifier extends NodeBase<typeof NodeTypes.ExportSpecif
448
448
  /**
449
449
  * Define the types of Arcade Expression.
450
450
  */
451
- declare type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | Identifier | Literal | LogicalExpression | MemberExpression | ObjectExpression | TemplateLiteral | UnaryExpression | UpdateExpression;
451
+ declare type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | Identifier | Literal | LogicalExpression | MemberAccessChainExpression | MemberExpression | ObjectExpression | SafeMemberExpression | TemplateLiteral | UnaryExpression | UpdateExpression;
452
452
 
453
453
  /**
454
454
  * Define an Arcade expression statement.
@@ -765,6 +765,11 @@ declare function isLiteral(item: unknown): item is Literal;
765
765
  */
766
766
  declare function isLogicalExpression(item: unknown): item is LogicalExpression;
767
767
 
768
+ /**
769
+ * Test if the item is an Arcade MemberAccessChainExpression.
770
+ */
771
+ declare function isMemberAccessChainExpression(item: unknown): item is MemberAccessChainExpression;
772
+
768
773
  /**
769
774
  * Test if the item is an Arcade MemberExpression.
770
775
  */
@@ -790,6 +795,11 @@ declare function isProperty(item: unknown): item is Property;
790
795
  */
791
796
  declare function isReturnStatement(item: unknown): item is ReturnStatement;
792
797
 
798
+ /**
799
+ * Test if the item is an Arcade SafeMemberExpression.
800
+ */
801
+ declare function isSafeMemberExpression(item: unknown): item is SafeMemberExpression;
802
+
793
803
  /**
794
804
  * Test if the item is an Arcade Statement.
795
805
  */
@@ -944,7 +954,7 @@ declare interface LogicalExpression extends NodeBase<typeof NodeTypes.LogicalExp
944
954
  /**
945
955
  * Arcade logical operators.
946
956
  */
947
- declare const LogicalOperators: readonly string[];
957
+ declare const LogicalOperators: readonly ["||", "&&"];
948
958
 
949
959
  /**
950
960
  * Arcade logical operators.
@@ -961,6 +971,15 @@ declare interface Marker extends Position {
961
971
  index: number;
962
972
  }
963
973
 
974
+ /**
975
+ * The enclosing scope for SafeMemberExpressions. Failed accesses in `expression` (or descendent `callee`/`object` expressions)
976
+ * result in this entire chain evaluating to `null`.
977
+ * Example: `foo?.bar?.["baz"]`, `foo()?.bar`, `foo.bar?.baz`, `foo?.bar.baz`, `foo?.bar()` are all single chains
978
+ */
979
+ declare interface MemberAccessChainExpression extends NodeBase<typeof NodeTypes.MemberAccessChainExpression> {
980
+ expression: Expression;
981
+ }
982
+
964
983
  /**
965
984
  * Define an Arcade member expression.
966
985
  * Example: foo.bar or foo[1]
@@ -1014,11 +1033,13 @@ declare const NodeTypes: {
1014
1033
  readonly LineComment: "LineComment";
1015
1034
  readonly Literal: "Literal";
1016
1035
  readonly LogicalExpression: "LogicalExpression";
1036
+ readonly MemberAccessChainExpression: "MemberAccessChainExpression";
1017
1037
  readonly MemberExpression: "MemberExpression";
1018
1038
  readonly ObjectExpression: "ObjectExpression";
1019
1039
  readonly Program: "Program";
1020
1040
  readonly Property: "Property";
1021
1041
  readonly ReturnStatement: "ReturnStatement";
1042
+ readonly SafeMemberExpression: "SafeMemberExpression";
1022
1043
  readonly TemplateElement: "TemplateElement";
1023
1044
  readonly TemplateLiteral: "TemplateLiteral";
1024
1045
  readonly UnaryExpression: "UnaryExpression";
@@ -1130,6 +1151,8 @@ declare namespace Parser {
1130
1151
  isObjectExpression,
1131
1152
  isTemplateLiteral,
1132
1153
  isMemberExpression,
1154
+ isSafeMemberExpression,
1155
+ isMemberAccessChainExpression,
1133
1156
  isUnaryExpression,
1134
1157
  isUpdateExpression,
1135
1158
  isVariableDeclarator,
@@ -1144,6 +1167,7 @@ declare namespace Parser {
1144
1167
  AssignmentOperators,
1145
1168
  LogicalOperators,
1146
1169
  BinaryOperators,
1170
+ SafeAccessOperator,
1147
1171
  OperatorPrecedence,
1148
1172
  Position,
1149
1173
  SourceLocation,
@@ -1196,6 +1220,8 @@ declare namespace Parser {
1196
1220
  LogicalExpression,
1197
1221
  ComputedMemberExpression,
1198
1222
  MemberExpression,
1223
+ SafeMemberExpression,
1224
+ MemberAccessChainExpression,
1199
1225
  ObjectExpression,
1200
1226
  Property,
1201
1227
  TemplateLiteral,
@@ -1278,6 +1304,56 @@ declare interface ReturnStatement extends NodeBase<typeof NodeTypes.ReturnStatem
1278
1304
  argument: Expression | null;
1279
1305
  }
1280
1306
 
1307
+ declare const SafeAccessOperator = "?.";
1308
+
1309
+ declare type SafeAccessOperator = typeof SafeAccessOperator;
1310
+
1311
+ /**
1312
+ * Define an Arcade safe computed member expression.
1313
+ * Example: foo?.[1]
1314
+ */
1315
+ declare interface SafeComputedMemberExpression extends NodeBase<typeof NodeTypes.SafeMemberExpression> {
1316
+ readonly computed: true;
1317
+ /**
1318
+ * The object of the member expression.
1319
+ * Example: foo?.[1]
1320
+ * The object is foo.
1321
+ */
1322
+ object: Expression;
1323
+ /**
1324
+ * The property of the member expression.
1325
+ * Example: foo?.[1]
1326
+ * The property is 1.
1327
+ */
1328
+ property: Expression;
1329
+ }
1330
+
1331
+ /**
1332
+ * Define an Arcade safe member expression.
1333
+ * Example: foo?.bar or foo?.[1]
1334
+ */
1335
+ declare type SafeMemberExpression = SafeComputedMemberExpression | SafeNonComputedMemberExpression;
1336
+
1337
+ /**
1338
+ * Define an Arcade safe non-computed member expression.
1339
+ * Example: foo?.bar
1340
+ */
1341
+ declare interface SafeNonComputedMemberExpression extends NodeBase<typeof NodeTypes.SafeMemberExpression> {
1342
+ readonly computed: false;
1343
+ /**
1344
+ * The object of the member expression.
1345
+ * Example: foo?.bar
1346
+ * The object is foo.
1347
+ */
1348
+ object: Expression;
1349
+ /**
1350
+ * The property of the member expression.
1351
+ * Example: foo?.bar
1352
+ * The property is bar.
1353
+ */
1354
+ property: Identifier;
1355
+ }
1356
+
1281
1357
  /**
1282
1358
  * Describe a range in the source code between two positions as [start, end].
1283
1359
  * Start is inclusive and end is exclusive.
@@ -1434,7 +1510,7 @@ declare interface UnaryExpression extends NodeBase<typeof NodeTypes.UnaryExpress
1434
1510
  /**
1435
1511
  * Arcade unary operators.
1436
1512
  */
1437
- declare const UnaryOperators: readonly string[];
1513
+ declare const UnaryOperators: readonly ["-", "+", "!", "~"];
1438
1514
 
1439
1515
  /**
1440
1516
  * Arcade unary operators.
@@ -1469,7 +1545,7 @@ declare interface UpdateExpression extends NodeBase<typeof NodeTypes.UpdateExpre
1469
1545
  /**
1470
1546
  * Arcade update operators.
1471
1547
  */
1472
- declare const UpdateOperators: readonly string[];
1548
+ declare const UpdateOperators: readonly ["++", "--"];
1473
1549
 
1474
1550
  /**
1475
1551
  * Arcade update operators.