@artel/artc 0.6.26024 → 0.6.26025

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/Cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CommandLineCompiler
4
- } from "./chunk-SVBA2GB7.js";
5
- import "./chunk-W2Y4H3RW.js";
4
+ } from "./chunk-CIRH34IO.js";
5
+ import "./chunk-7QPDALAB.js";
6
6
  import {
7
7
  __async
8
- } from "./chunk-W3GP7NSM.js";
8
+ } from "./chunk-OTHSFQXT.js";
9
9
 
10
10
  // source/Cli.ts
11
11
  function main() {
package/build/api/Api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "../chunk-W2Y4H3RW.js";
3
+ } from "../chunk-7QPDALAB.js";
4
4
  import {
5
5
  AccessKind,
6
6
  AccessedFunction_entity,
@@ -297,7 +297,7 @@ import {
297
297
  withoutQuotes,
298
298
  withoutTemplateQuotes,
299
299
  yieldTask
300
- } from "../chunk-W3GP7NSM.js";
300
+ } from "../chunk-OTHSFQXT.js";
301
301
  export {
302
302
  AccessKind,
303
303
  AccessedFunction_entity,
@@ -6,9 +6,9 @@ import {
6
6
  PhysicalFileSystem,
7
7
  PhysicalTypeScriptLibrariesProvider,
8
8
  PrintingDiagnosticAcceptor
9
- } from "../chunk-SVBA2GB7.js";
10
- import "../chunk-W2Y4H3RW.js";
11
- import "../chunk-W3GP7NSM.js";
9
+ } from "../chunk-CIRH34IO.js";
10
+ import "../chunk-7QPDALAB.js";
11
+ import "../chunk-OTHSFQXT.js";
12
12
  export {
13
13
  CommandLineCompiler,
14
14
  FileSystemUri,
@@ -109,7 +109,7 @@ import {
109
109
  sortModifiers,
110
110
  traverseTreeAsync,
111
111
  yieldTask
112
- } from "../chunk-W3GP7NSM.js";
112
+ } from "../chunk-OTHSFQXT.js";
113
113
 
114
114
  // source/services/CustomRequests.ts
115
115
  import * as ls from "vscode-languageserver";
@@ -9,7 +9,7 @@ import {
9
9
  WellKnownDeclarationsLoadError,
10
10
  __async,
11
11
  createTsInteropInputsForCompilation
12
- } from "./chunk-W3GP7NSM.js";
12
+ } from "./chunk-OTHSFQXT.js";
13
13
 
14
14
  // source/executor/Compiler.ts
15
15
  var Compiler = class {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Compiler
3
- } from "./chunk-W2Y4H3RW.js";
3
+ } from "./chunk-7QPDALAB.js";
4
4
  import {
5
5
  ArtelVersion,
6
6
  Cached,
@@ -15,7 +15,7 @@ import {
15
15
  __async,
16
16
  performanceMeasurementStageNames,
17
17
  performanceMeasurementStages
18
- } from "./chunk-W3GP7NSM.js";
18
+ } from "./chunk-OTHSFQXT.js";
19
19
 
20
20
  // source/executor/FileSystemUri.ts
21
21
  import { platform } from "os";
@@ -764,7 +764,7 @@ var UniqueWithComparatorQuery = class extends Query {
764
764
  };
765
765
 
766
766
  // source/common/Constants.ts
767
- var ArtelVersion = true ? "0.6.26024" : "";
767
+ var ArtelVersion = true ? "0.6.26025" : "";
768
768
  var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel", ".\u0430\u0440\u0442\u043C", ".\u0430\u0440\u0442\u0435\u043B\u044C\u043C", ".artm", ".artelm"];
769
769
  var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
770
770
  var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
@@ -8091,10 +8091,10 @@ var TextTemplateLiteral = class extends BaseExpressionNode {
8091
8091
  }
8092
8092
  };
8093
8093
  var LocalizableTextTemplateLiteral = class extends BaseExpressionNode {
8094
- constructor(head, spanList, code, rangeWithTrivia) {
8094
+ constructor(head, spanList, key, rangeWithTrivia) {
8095
8095
  super(rangeWithTrivia);
8096
8096
  this.kind = 77 /* LocalizableTextTemplateLiteral */;
8097
- this.children = [head, spanList, code];
8097
+ this.children = [head, spanList, key];
8098
8098
  this.setParentForChildren();
8099
8099
  }
8100
8100
  get parent() {
@@ -8107,7 +8107,7 @@ var LocalizableTextTemplateLiteral = class extends BaseExpressionNode {
8107
8107
  get spanList() {
8108
8108
  return this.children[1];
8109
8109
  }
8110
- get code() {
8110
+ get key() {
8111
8111
  return this.children[2];
8112
8112
  }
8113
8113
  get thisAsNode() {
@@ -8190,10 +8190,10 @@ var TextLiteral = class extends BaseExpressionNode {
8190
8190
  }
8191
8191
  };
8192
8192
  var LocalizableTextLiteral = class extends BaseExpressionNode {
8193
- constructor(text, code, rangeWithTrivia) {
8193
+ constructor(text, key, rangeWithTrivia) {
8194
8194
  super(rangeWithTrivia);
8195
8195
  this.kind = 82 /* LocalizableTextLiteral */;
8196
- this.children = [text, code];
8196
+ this.children = [text, key];
8197
8197
  this.setParentForChildren();
8198
8198
  }
8199
8199
  get parent() {
@@ -8203,7 +8203,7 @@ var LocalizableTextLiteral = class extends BaseExpressionNode {
8203
8203
  get text() {
8204
8204
  return this.children[0];
8205
8205
  }
8206
- get code() {
8206
+ get key() {
8207
8207
  return this.children[1];
8208
8208
  }
8209
8209
  get thisAsNode() {
@@ -9595,10 +9595,10 @@ var TextTranslationFunctionDeclaration = class extends BaseNode {
9595
9595
  }
9596
9596
  };
9597
9597
  var TranslationTextLiteral = class extends BaseNode {
9598
- constructor(text, code, rangeWithTrivia) {
9598
+ constructor(text, key, rangeWithTrivia) {
9599
9599
  super(rangeWithTrivia);
9600
9600
  this.kind = 140 /* TranslationTextLiteral */;
9601
- this.children = [text, code];
9601
+ this.children = [text, key];
9602
9602
  this.setParentForChildren();
9603
9603
  }
9604
9604
  get parent() {
@@ -9608,7 +9608,7 @@ var TranslationTextLiteral = class extends BaseNode {
9608
9608
  get text() {
9609
9609
  return this.children[0];
9610
9610
  }
9611
- get code() {
9611
+ get key() {
9612
9612
  return this.children[1];
9613
9613
  }
9614
9614
  get thisAsNode() {
@@ -9616,10 +9616,10 @@ var TranslationTextLiteral = class extends BaseNode {
9616
9616
  }
9617
9617
  };
9618
9618
  var TranslationTextTemplate = class extends BaseNode {
9619
- constructor(head, spanList, code, rangeWithTrivia) {
9619
+ constructor(head, spanList, key, rangeWithTrivia) {
9620
9620
  super(rangeWithTrivia);
9621
9621
  this.kind = 141 /* TranslationTextTemplate */;
9622
- this.children = [head, spanList, code];
9622
+ this.children = [head, spanList, key];
9623
9623
  this.setParentForChildren();
9624
9624
  }
9625
9625
  get parent() {
@@ -9632,7 +9632,7 @@ var TranslationTextTemplate = class extends BaseNode {
9632
9632
  get spanList() {
9633
9633
  return this.children[1];
9634
9634
  }
9635
- get code() {
9635
+ get key() {
9636
9636
  return this.children[2];
9637
9637
  }
9638
9638
  get thisAsNode() {
@@ -15653,12 +15653,12 @@ var ExpressionParser = class _ExpressionParser {
15653
15653
  const text = this.parser.parseExpectedToken(5 /* TextLiteral */);
15654
15654
  let result;
15655
15655
  if ((text.flags & 384 /* LocalizableText */) !== 0) {
15656
- let code;
15656
+ let key;
15657
15657
  const currentToken = this.parser.getCurrentTokenOrKeyword();
15658
- if ((text.flags & 256 /* EndsWithTilde */) !== 0 && text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 2 /* IntegerLiteral */ && currentToken.leadingTrivia.length === 0) {
15659
- code = this.parser.parseExpectedToken(2 /* IntegerLiteral */);
15658
+ if ((text.flags & 256 /* EndsWithTilde */) !== 0 && text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 5 /* TextLiteral */ && currentToken.leadingTrivia.length === 0) {
15659
+ key = this.parser.parseExpectedToken(5 /* TextLiteral */);
15660
15660
  }
15661
- result = new LocalizableTextLiteral(text, code, this.parser.rangeFrom(literalStart));
15661
+ result = new LocalizableTextLiteral(text, key, this.parser.rangeFrom(literalStart));
15662
15662
  } else {
15663
15663
  result = new TextLiteral(text, this.parser.rangeFrom(literalStart));
15664
15664
  }
@@ -15672,12 +15672,12 @@ var ExpressionParser = class _ExpressionParser {
15672
15672
  const tail = spans.length > 0 ? spans[spans.length - 1] : void 0;
15673
15673
  let result;
15674
15674
  if ((head.flags & 384 /* LocalizableText */) !== 0 || tail !== void 0 && (tail.text.flags & 384 /* LocalizableText */) !== 0) {
15675
- let code;
15675
+ let key;
15676
15676
  const currentToken = this.parser.getCurrentTokenOrKeyword();
15677
- if (tail !== void 0 && (tail.text.flags & 256 /* EndsWithTilde */) !== 0 && tail.text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 2 /* IntegerLiteral */ && currentToken.leadingTrivia.length === 0) {
15678
- code = this.parser.parseExpectedToken(2 /* IntegerLiteral */);
15677
+ if (tail !== void 0 && (tail.text.flags & 256 /* EndsWithTilde */) !== 0 && tail.text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 5 /* TextLiteral */ && currentToken.leadingTrivia.length === 0) {
15678
+ key = this.parser.parseExpectedToken(5 /* TextLiteral */);
15679
15679
  }
15680
- result = new LocalizableTextTemplateLiteral(head, spanList, code, this.parser.rangeFrom(literalStart));
15680
+ result = new LocalizableTextTemplateLiteral(head, spanList, key, this.parser.rangeFrom(literalStart));
15681
15681
  } else {
15682
15682
  result = new TextTemplateLiteral(head, spanList, this.parser.rangeFrom(literalStart));
15683
15683
  }
@@ -17421,12 +17421,12 @@ var TranslationsDeclarationParser = class extends BlockElementListParser {
17421
17421
  parseTranslationTextLiteral() {
17422
17422
  const literalStart = this.parser.tokenOrKeywordStartPosition();
17423
17423
  const text = this.parser.parseExpectedToken(5 /* TextLiteral */);
17424
- let code;
17424
+ let key;
17425
17425
  const currentToken = this.parser.getCurrentTokenOrKeyword();
17426
- if ((text.flags & 256 /* EndsWithTilde */) !== 0 && text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 2 /* IntegerLiteral */ && currentToken.leadingTrivia.length === 0) {
17427
- code = this.parser.parseExpectedToken(2 /* IntegerLiteral */);
17426
+ if ((text.flags & 256 /* EndsWithTilde */) !== 0 && text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 5 /* TextLiteral */ && currentToken.leadingTrivia.length === 0) {
17427
+ key = this.parser.parseExpectedToken(5 /* TextLiteral */);
17428
17428
  }
17429
- return new TranslationTextLiteral(text, code, this.parser.rangeFrom(literalStart));
17429
+ return new TranslationTextLiteral(text, key, this.parser.rangeFrom(literalStart));
17430
17430
  }
17431
17431
  parseTranslationTextTemplate() {
17432
17432
  const literalStart = this.parser.tokenOrKeywordStartPosition();
@@ -17444,8 +17444,8 @@ var TranslationsDeclarationParser = class extends BlockElementListParser {
17444
17444
  spans.push(span);
17445
17445
  } while (span.text.tokenKind === 7 /* TextTemplatePart */);
17446
17446
  const currentToken = this.parser.getCurrentTokenOrKeyword();
17447
- if ((span.text.flags & 256 /* EndsWithTilde */) !== 0 && span.text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 2 /* IntegerLiteral */ && currentToken.leadingTrivia.length === 0) {
17448
- code = this.parser.parseExpectedToken(2 /* IntegerLiteral */);
17447
+ if ((span.text.flags & 256 /* EndsWithTilde */) !== 0 && span.text.trailingTrivia.length === 0 && currentToken.kind === 0 /* Token */ && currentToken.tokenKind === 5 /* TextLiteral */ && currentToken.leadingTrivia.length === 0) {
17448
+ code = this.parser.parseExpectedToken(5 /* TextLiteral */);
17449
17449
  }
17450
17450
  }
17451
17451
  const spanList = new TranslationTextTemplateSpanList(spans, this.parser.rangeFrom(spanListStart));
@@ -26082,9 +26082,6 @@ var TextTemplateEmitOptions = class _TextTemplateEmitOptions {
26082
26082
  this.flags = flagsOrFirstFlag ?? 0 /* None */;
26083
26083
  }
26084
26084
  }
26085
- static default() {
26086
- return new _TextTemplateEmitOptions(1 /* CreateTextTemplateInstance */);
26087
- }
26088
26085
  get createTextTemplateInstance() {
26089
26086
  return (this.flags & 1 /* CreateTextTemplateInstance */) !== 0;
26090
26087
  }
@@ -27462,20 +27459,30 @@ var TextLiteral2 = class _TextLiteral {
27462
27459
  this.value = value;
27463
27460
  this.sourceLocation = sourceLocation;
27464
27461
  this.kind = 46 /* TextLiteral */;
27462
+ this.options = new TextTemplateEmitOptions(false);
27463
+ }
27464
+ withOptions(options) {
27465
+ this.options = options;
27466
+ return this;
27465
27467
  }
27466
27468
  clone() {
27467
- return new _TextLiteral(this.value, this.sourceLocation);
27469
+ return new _TextLiteral(this.value, this.sourceLocation).withOptions(this.options.clone());
27468
27470
  }
27469
27471
  };
27470
27472
  var LocalizableTextLiteral2 = class _LocalizableTextLiteral {
27471
- constructor(value, code, sourceLocation) {
27473
+ constructor(value, key, sourceLocation) {
27472
27474
  this.value = value;
27473
- this.code = code;
27475
+ this.key = key;
27474
27476
  this.sourceLocation = sourceLocation;
27475
27477
  this.kind = 47 /* LocalizableTextLiteral */;
27478
+ this.options = new TextTemplateEmitOptions(false);
27479
+ }
27480
+ withOptions(options) {
27481
+ this.options = options;
27482
+ return this;
27476
27483
  }
27477
27484
  clone() {
27478
- return new _LocalizableTextLiteral(this.value, this.code, this.sourceLocation);
27485
+ return new _LocalizableTextLiteral(this.value, this.key, this.sourceLocation);
27479
27486
  }
27480
27487
  };
27481
27488
  var TextWithEntityName = class _TextWithEntityName {
@@ -27494,7 +27501,7 @@ var TextTemplateLiteral2 = class _TextTemplateLiteral {
27494
27501
  this.expressions = expressions;
27495
27502
  this.sourceLocation = sourceLocation;
27496
27503
  this.kind = 48 /* TextTemplateLiteral */;
27497
- this.options = TextTemplateEmitOptions.default();
27504
+ this.options = new TextTemplateEmitOptions(true);
27498
27505
  }
27499
27506
  withOptions(options) {
27500
27507
  this.options = options;
@@ -27509,13 +27516,13 @@ var TextTemplateLiteral2 = class _TextTemplateLiteral {
27509
27516
  }
27510
27517
  };
27511
27518
  var LocalizableTextTemplateLiteral2 = class _LocalizableTextTemplateLiteral {
27512
- constructor(textFragments, expressions, code, sourceLocation) {
27519
+ constructor(textFragments, expressions, key, sourceLocation) {
27513
27520
  this.textFragments = textFragments;
27514
27521
  this.expressions = expressions;
27515
- this.code = code;
27522
+ this.key = key;
27516
27523
  this.sourceLocation = sourceLocation;
27517
27524
  this.kind = 49 /* LocalizableTextTemplateLiteral */;
27518
- this.options = TextTemplateEmitOptions.default();
27525
+ this.options = new TextTemplateEmitOptions(true);
27519
27526
  }
27520
27527
  withOptions(options) {
27521
27528
  this.options = options;
@@ -27525,7 +27532,7 @@ var LocalizableTextTemplateLiteral2 = class _LocalizableTextTemplateLiteral {
27525
27532
  return new _LocalizableTextTemplateLiteral(
27526
27533
  this.textFragments,
27527
27534
  this.expressions.map((e) => e.clone()),
27528
- this.code,
27535
+ this.key,
27529
27536
  this.sourceLocation
27530
27537
  ).withOptions(this.options.clone());
27531
27538
  }
@@ -28286,6 +28293,11 @@ var StandardTypes = class {
28286
28293
  get textTemplate() {
28287
28294
  return this.textTemplate_ ??= this.entityMap.getType(this.analyzer.originalStandardTypes.textTemplate);
28288
28295
  }
28296
+ get localizableTextTemplate() {
28297
+ return this.localizableTextTemplate_ ??= this.entityMap.getType(
28298
+ this.analyzer.originalStandardTypes.localizableTextTemplate
28299
+ );
28300
+ }
28289
28301
  get reference() {
28290
28302
  return this.reference_ ??= this.entityMap.getType(this.analyzer.originalStandardTypes.reference);
28291
28303
  }
@@ -29846,8 +29858,8 @@ function ternaryExpression(condition, firstExpression, secondExpression, sourceL
29846
29858
  function textLiteral(value, sourceLocation) {
29847
29859
  return new TextLiteral2(value, sourceLocation);
29848
29860
  }
29849
- function localizableTextLiteral(value, code, sourceLocation) {
29850
- return new LocalizableTextLiteral2(value, code, sourceLocation);
29861
+ function localizableTextLiteral(value, key, sourceLocation) {
29862
+ return new LocalizableTextLiteral2(value, key, sourceLocation);
29851
29863
  }
29852
29864
  function textWithEntityName(entity, sourceLocation) {
29853
29865
  return new TextWithEntityName(entity, sourceLocation);
@@ -29855,8 +29867,8 @@ function textWithEntityName(entity, sourceLocation) {
29855
29867
  function textTemplateLiteral(textFragments, expressions, sourceLocation) {
29856
29868
  return new TextTemplateLiteral2(textFragments, expressions, sourceLocation);
29857
29869
  }
29858
- function localizableTextTemplateLiteral(textFragments, expressions, code, sourceLocation) {
29859
- return new LocalizableTextTemplateLiteral2(textFragments, expressions, code, sourceLocation);
29870
+ function localizableTextTemplateLiteral(textFragments, expressions, key, sourceLocation) {
29871
+ return new LocalizableTextTemplateLiteral2(textFragments, expressions, key, sourceLocation);
29860
29872
  }
29861
29873
  function thisExpression(type, sourceLocation) {
29862
29874
  return new ThisExpression(type, sourceLocation);
@@ -32967,23 +32979,31 @@ var AspectsLowering = class {
32967
32979
  return fieldSetterDeclaration(setterEntity, body, parameterEntity2);
32968
32980
  }
32969
32981
  getNotAbstractAspectMembersToAddToDerivedType(entity) {
32970
- const overriddenMembers = Query.from(entity.members).map((m) => this.getAllOverriddenAspectMembers(m)).filter((m) => m !== void 0).flatMap((m) => m).uniqueToSet();
32971
- const result = /* @__PURE__ */ new Set();
32972
- for (const aspect of enumerateOwnAspectsRecursively(entity)) {
32973
- if (!aspect.containingPackage.details.isSource) {
32982
+ const overriddenMembers = Query.from(entity.members).map((m) => this.getAllOverriddenAspectMembers(m)).chain(Query.from(this.uniqueBaseTypesRecursively(entity)).flatMap((e) => e.members.map((m) => this.getAllOverriddenAspectMembers(m)))).filter((m) => m !== void 0).flatMap((m) => m).uniqueToSet();
32983
+ const result = new Array();
32984
+ for (const baseType of this.uniqueBaseTypesRecursively(entity)) {
32985
+ if (!this.ctx.ectx.isAspectTypeEntity(baseType) || !baseType.containingPackage.details.isSource) {
32974
32986
  continue;
32975
32987
  }
32976
- for (const member of aspect.members) {
32988
+ for (const member of baseType.members) {
32977
32989
  if (!overriddenMembers.has(member) && !member.details.isAbstract && !member.details.isStatic) {
32978
- result.add(member);
32990
+ result.push(member);
32979
32991
  }
32980
32992
  }
32981
32993
  }
32982
- return Array.from(result);
32983
- function* enumerateOwnAspectsRecursively(entity2) {
32984
- yield* __yieldStar(entity2.baseAspectTypes);
32985
- for (const baseAspectType of entity2.baseAspectTypes) {
32986
- yield* __yieldStar(enumerateOwnAspectsRecursively(baseAspectType));
32994
+ return result;
32995
+ }
32996
+ *uniqueBaseTypesRecursively(entity, enumerated = /* @__PURE__ */ new Set()) {
32997
+ if (entity.baseObjectType !== void 0 && !enumerated.has(entity.baseObjectType)) {
32998
+ yield entity.baseObjectType;
32999
+ enumerated.add(entity.baseObjectType);
33000
+ yield* __yieldStar(this.uniqueBaseTypesRecursively(entity.baseObjectType));
33001
+ }
33002
+ for (const baseAspectType of entity.baseAspectTypes) {
33003
+ if (!enumerated.has(baseAspectType)) {
33004
+ yield baseAspectType;
33005
+ enumerated.add(baseAspectType);
33006
+ yield* __yieldStar(this.uniqueBaseTypesRecursively(baseAspectType));
32987
33007
  }
32988
33008
  }
32989
33009
  }
@@ -34349,6 +34369,12 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
34349
34369
  }
34350
34370
  return preserveStatement();
34351
34371
  },
34372
+ transformTextLiteral: (node) => {
34373
+ if (node.options.createTextTemplateInstance) {
34374
+ return replaceExpression(this.createTextTemplateConstructorCall([node.value], [], node.sourceLocation));
34375
+ }
34376
+ return preserveExpression();
34377
+ },
34352
34378
  transformTextTemplateLiteral: (node) => {
34353
34379
  if (node.options.createTextTemplateInstance) {
34354
34380
  return replaceExpression(this.lowerTextTemplateLiteral(node));
@@ -34356,10 +34382,40 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
34356
34382
  return preserveExpression();
34357
34383
  },
34358
34384
  transformLocalizableTextLiteral: (node) => {
34359
- return replaceExpression(this.lowerLocalizableTextLiteral(node));
34385
+ let expression = this.createLocalizableTextTemplateConstructorCall(
34386
+ [node.value],
34387
+ [],
34388
+ node.key,
34389
+ node.sourceLocation
34390
+ );
34391
+ if (!node.options.createTextTemplateInstance) {
34392
+ expression = instanceMethodCallExpression(
34393
+ expression,
34394
+ this.ctx.localizableTextTemplateTranslateMethod,
34395
+ [],
34396
+ false,
34397
+ node.sourceLocation
34398
+ );
34399
+ }
34400
+ return replaceExpression(expression);
34360
34401
  },
34361
34402
  transformLocalizableTextTemplateLiteral: (node) => {
34362
- return replaceExpression(this.lowerLocalizableTextTemplateLiteral(node));
34403
+ let expression = this.createLocalizableTextTemplateConstructorCall(
34404
+ node.textFragments,
34405
+ node.expressions,
34406
+ node.key,
34407
+ node.sourceLocation
34408
+ );
34409
+ if (!node.options.createTextTemplateInstance) {
34410
+ expression = instanceMethodCallExpression(
34411
+ expression,
34412
+ this.ctx.localizableTextTemplateTranslateMethod,
34413
+ [],
34414
+ false,
34415
+ node.sourceLocation
34416
+ );
34417
+ }
34418
+ return replaceExpression(expression);
34363
34419
  },
34364
34420
  transformMethodDeclaration: (node) => {
34365
34421
  const nameKeySymbolDeclaration = this.ifTypeMemberHasComputedNameThenSymbolDeclaration(node.entity, true);
@@ -34612,16 +34668,16 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
34612
34668
  const result = this.createLocalizableTextTemplateConstructorAndTranslateCall(
34613
34669
  [node.value],
34614
34670
  [],
34615
- node.code,
34671
+ node.key,
34616
34672
  node.sourceLocation
34617
34673
  );
34618
34674
  return result;
34619
34675
  }
34620
34676
  lowerLocalizableTextTemplateLiteral(node) {
34621
- const result = this.createLocalizableTextTemplateConstructorAndTranslateCall(
34677
+ const result = this.createLocalizableTextTemplateConstructorCall(
34622
34678
  node.textFragments,
34623
34679
  node.expressions,
34624
- node.code,
34680
+ node.key,
34625
34681
  node.sourceLocation
34626
34682
  );
34627
34683
  return result;
@@ -34637,20 +34693,25 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
34637
34693
  );
34638
34694
  return constructorCall;
34639
34695
  }
34640
- createLocalizableTextTemplateConstructorAndTranslateCall(textFragments, expressions, code, sourceLocation) {
34696
+ createLocalizableTextTemplateConstructorCall(textFragments, expressions, key, sourceLocation) {
34641
34697
  const textFragmentsArray = arrayLiteral(this.ctx.ectx, textFragments.map((s) => textLiteral(s)));
34642
34698
  const expressionArray = arrayLiteral(this.ctx.ectx, expressions);
34643
- let codeArg;
34644
- if (code !== void 0) {
34645
- codeArg = numericLiteral(code);
34646
- } else {
34647
- codeArg = textLiteral(textFragments.join("_"));
34648
- }
34699
+ const keyArg = key !== void 0 ? textLiteral(key) : nullLiteral();
34649
34700
  const packageArg = staticFieldGetAccess(this.ctx.packageThisPackageField);
34650
34701
  const constructorCall = constructorCallExpression(
34651
34702
  this.ctx.ectx,
34652
34703
  this.ctx.localizableTextTemplateConstructor,
34653
- [textFragmentsArray, expressionArray, codeArg, packageArg]
34704
+ [textFragmentsArray, expressionArray, keyArg, packageArg],
34705
+ sourceLocation
34706
+ );
34707
+ return constructorCall;
34708
+ }
34709
+ createLocalizableTextTemplateConstructorAndTranslateCall(textFragments, expressions, key, sourceLocation) {
34710
+ const constructorCall = this.createLocalizableTextTemplateConstructorCall(
34711
+ textFragments,
34712
+ expressions,
34713
+ key,
34714
+ sourceLocation
34654
34715
  );
34655
34716
  const toTextMethodCall = instanceMethodCallExpression(
34656
34717
  constructorCall,
@@ -35500,7 +35561,7 @@ var TextTranslationsLowering = class {
35500
35561
  );
35501
35562
  const statements = [dictionaryVariableDeclarationStatement];
35502
35563
  for (const translation of pkg2.ir.translations) {
35503
- const key = typeof translation.key === "number" ? numericLiteral(translation.key) : textLiteral(translation.key);
35564
+ const key = textLiteral(translation.key);
35504
35565
  let textOrTranslationFunction;
35505
35566
  if (translation.translatedTextOrFunctionBlock.kind === 4 /* BlockStatement */) {
35506
35567
  textOrTranslationFunction = this.createTranslationFunctionLiteral(
@@ -36747,7 +36808,25 @@ var IrBuilderA = class {
36747
36808
  }
36748
36809
  applyImplicitConversionIfRequired(expression, expressionIr) {
36749
36810
  if (this.expressionCanBeImplicitlyConverted(expression)) {
36750
- if (expression.kind === 76 /* TextTemplateLiteral */ && this.analyzer.type.ofExpression(expression).equals(this.analyzer.originalStandardTypes.text)) {
36811
+ if (expression.kind === 81 /* TextLiteral */ && expressionIr.kind === 46 /* TextLiteral */) {
36812
+ let targetType2 = this.analyzer.getTargetTypeOfExpression(expression);
36813
+ if (targetType2 !== void 0) {
36814
+ targetType2 = this.analyzer.excludeNullFromType(targetType2.unalias());
36815
+ }
36816
+ if (targetType2 !== void 0 && targetType2.equals(this.analyzer.originalStandardTypes.textTemplate)) {
36817
+ expressionIr.options = expressionIr.options.setCreateTextTemplateInstance(true);
36818
+ return expressionIr;
36819
+ }
36820
+ } else if (expression.kind === 82 /* LocalizableTextLiteral */ && expressionIr.kind === 47 /* LocalizableTextLiteral */) {
36821
+ let targetType2 = this.analyzer.getTargetTypeOfExpression(expression);
36822
+ if (targetType2 !== void 0) {
36823
+ targetType2 = this.analyzer.excludeNullFromType(targetType2.unalias());
36824
+ }
36825
+ if (targetType2 !== void 0 && targetType2.equals(this.analyzer.originalStandardTypes.localizableTextTemplate)) {
36826
+ expressionIr.options = expressionIr.options.setCreateTextTemplateInstance(true);
36827
+ return expressionIr;
36828
+ }
36829
+ } else if ((expression.kind === 76 /* TextTemplateLiteral */ || expression.kind === 77 /* LocalizableTextTemplateLiteral */) && this.analyzer.type.ofExpression(expression).equals(this.analyzer.originalStandardTypes.text)) {
36751
36830
  return this.convertTextTemplateToText(expressionIr);
36752
36831
  }
36753
36832
  let targetType = this.analyzer.getTargetTypeOfExpression(expression);
@@ -36756,7 +36835,7 @@ var IrBuilderA = class {
36756
36835
  }
36757
36836
  if (targetType !== void 0) {
36758
36837
  const expressionType = this.analyzer.type.ofExpression(expression);
36759
- if (expressionType.equals(this.analyzer.originalStandardTypes.textTemplate)) {
36838
+ if (expressionType.equals(this.analyzer.originalStandardTypes.textTemplate) || expressionType.equals(this.analyzer.originalStandardTypes.localizableTextTemplate)) {
36760
36839
  const isConvertedToText = targetType.equals(this.analyzer.originalStandardTypes.text) || targetType.kind === "union" && targetType.unaliasedFlattenedTypes.some((t) => t.equals(this.analyzer.originalStandardTypes.text));
36761
36840
  if (isConvertedToText) {
36762
36841
  return this.convertTextTemplateToText(expressionIr);
@@ -37356,12 +37435,9 @@ var IrBuilderA = class {
37356
37435
  );
37357
37436
  }
37358
37437
  buildLocalizableTextLiteral(expression) {
37359
- const code = expression.code !== void 0 ? parseIntegerLiteral(expression.code.value) : void 0;
37360
- return localizableTextLiteral(
37361
- unescapeText(withoutQuotes(expression.text.value)),
37362
- code,
37363
- this.getSourceLocation(expression)
37364
- );
37438
+ const value = unescapeText(withoutQuotes(expression.text.value));
37439
+ const key = expression.key !== void 0 ? unescapeText(withoutQuotes(expression.key.value)) : void 0;
37440
+ return localizableTextLiteral(value, key, this.getSourceLocation(expression));
37365
37441
  }
37366
37442
  buildTextTemplateLiteral(expression) {
37367
37443
  const textFragments = [unescapeText(withoutTemplateQuotes(expression.head.value))];
@@ -37379,8 +37455,8 @@ var IrBuilderA = class {
37379
37455
  textFragments.push(unescapeText(withoutTemplateQuotes(span.text.value)));
37380
37456
  expressions.push(this.buildExpression(span.expression));
37381
37457
  }
37382
- const code = expression.code !== void 0 ? parseIntegerLiteral(expression.code.value) : void 0;
37383
- return localizableTextTemplateLiteral(textFragments, expressions, code, this.getSourceLocation(expression));
37458
+ const key = expression.key !== void 0 ? unescapeText(withoutQuotes(expression.key.value)) : void 0;
37459
+ return localizableTextTemplateLiteral(textFragments, expressions, key, this.getSourceLocation(expression));
37384
37460
  }
37385
37461
  buildTokenExpression(expression) {
37386
37462
  switch (expression.token.tokenKind) {
@@ -41013,6 +41089,13 @@ var StandardTypes2 = class {
41013
41089
  }
41014
41090
  return this.textTemplate_;
41015
41091
  }
41092
+ get localizableTextTemplate() {
41093
+ if (this.localizableTextTemplate_ === void 0) {
41094
+ const entity = this.wellKnownDeclarations.localizableTextTemplate;
41095
+ this.localizableTextTemplate_ = this.analyzer.typeFactory.getStructuredType(entity, Substitutions.empty());
41096
+ }
41097
+ return this.localizableTextTemplate_;
41098
+ }
41016
41099
  get char() {
41017
41100
  if (this.char_ === void 0) {
41018
41101
  const entity = this.wellKnownDeclarations.char;
@@ -52435,25 +52518,19 @@ var SourceAnonymousStructuredTypeDeclarationData = class extends SourceStructure
52435
52518
 
52436
52519
  // source/analysis/a/TextIdentity.ts
52437
52520
  var TextIdentity = class {
52438
- static keyFromTextFragments(fragments) {
52439
- return fragments.join("_");
52440
- }
52441
- static keyFromTextToken(token) {
52442
- return unescapeText(withoutQuotes(token.value));
52443
- }
52444
52521
  static keyFromLocalizableTextLiteral(node) {
52445
52522
  let result;
52446
- if (node.code !== void 0) {
52447
- result = parseIntegerLiteral(node.code.value);
52523
+ if (node.key !== void 0) {
52524
+ result = unescapeText(withoutQuotes(node.key.value));
52448
52525
  } else {
52449
- result = this.keyFromTextToken(node.text);
52526
+ result = unescapeText(withoutQuotes(node.text.value));
52450
52527
  }
52451
52528
  return result;
52452
52529
  }
52453
52530
  static keyFromLocalizableTextTemplateLiteral(node) {
52454
52531
  let result;
52455
- if (node.code !== void 0) {
52456
- result = parseIntegerLiteral(node.code.value);
52532
+ if (node.key !== void 0) {
52533
+ result = unescapeText(withoutQuotes(node.key.value));
52457
52534
  } else {
52458
52535
  const fragments = [unescapeText(withoutTemplateQuotes(node.head.value))];
52459
52536
  node.spanList.spans.forEach((x) => fragments.push(unescapeText(withoutTemplateQuotes(x.text.value))));
@@ -52463,12 +52540,12 @@ var TextIdentity = class {
52463
52540
  }
52464
52541
  static keyFromTextTranslationSource(node) {
52465
52542
  let result;
52466
- if (node.code !== void 0) {
52467
- result = parseIntegerLiteral(node.code.value);
52543
+ if (node.key !== void 0) {
52544
+ result = unescapeText(withoutQuotes(node.key.value));
52468
52545
  } else {
52469
52546
  switch (node.kind) {
52470
52547
  case 140 /* TranslationTextLiteral */: {
52471
- result = this.keyFromTextToken(node.text);
52548
+ result = unescapeText(withoutQuotes(node.text.value));
52472
52549
  break;
52473
52550
  }
52474
52551
  case 141 /* TranslationTextTemplate */: {
@@ -52497,7 +52574,7 @@ var TextTranslationDeclarationEntity = class {
52497
52574
  case 140 /* TranslationTextLiteral */: {
52498
52575
  this.text = unescapeText(withoutQuotes(node.text.value));
52499
52576
  this.textFragments = [this.text];
52500
- lastToken = node.code ?? node.text;
52577
+ lastToken = node.key ?? node.text;
52501
52578
  break;
52502
52579
  }
52503
52580
  case 141 /* TranslationTextTemplate */: {
@@ -52505,8 +52582,8 @@ var TextTranslationDeclarationEntity = class {
52505
52582
  node.spanList.spans.forEach((x) => fragments.push(unescapeText(withoutTemplateQuotes(x.text.value))));
52506
52583
  this.textFragments = fragments;
52507
52584
  this.text = this.textFragments.join("_");
52508
- if (node.code !== void 0) {
52509
- lastToken = node.code;
52585
+ if (node.key !== void 0) {
52586
+ lastToken = node.key;
52510
52587
  } else {
52511
52588
  const spans = node.spanList.spans;
52512
52589
  if (spans.length > 0) {
@@ -57068,6 +57145,14 @@ var LocalizedWellKnownDeclarations = class {
57068
57145
  }
57069
57146
  return this.textTemplate_;
57070
57147
  }
57148
+ get localizableTextTemplate() {
57149
+ if (this.localizableTextTemplate_ === void 0) {
57150
+ this.localizableTextTemplate_ = this.getLocalizedStructuredType(
57151
+ this.analyzer.originalWellKnownDeclarations.localizableTextTemplate
57152
+ );
57153
+ }
57154
+ return this.localizableTextTemplate_;
57155
+ }
57071
57156
  get char() {
57072
57157
  if (this.char_ === void 0) {
57073
57158
  this.char_ = this.getLocalizedStructuredType(this.analyzer.originalWellKnownDeclarations.char);
@@ -63227,6 +63312,7 @@ var WellKnownDeclarationsLoader = class {
63227
63312
  integer: this.findPackageType(systemPackage, new Name("\u0426\u0435\u043B\u043E\u0435"), 0, 1 /* Structured */),
63228
63313
  text: this.findPackageType(systemPackage, new Name("\u0422\u0435\u043A\u0441\u0442"), 0, 1 /* Structured */),
63229
63314
  textTemplate: this.findPackageType(systemPackage, new Name("\u0428\u0430\u0431\u043B\u043E\u043D\u0422\u0435\u043A\u0441\u0442\u0430"), 0, 1 /* Structured */),
63315
+ localizableTextTemplate: this.findPackageType(systemPackage, new Name("\u0428\u0430\u0431\u043B\u043E\u043D\u0422\u0435\u043A\u0441\u0442\u0430\u041F\u0435\u0440\u0435\u0432\u043E\u0434\u0438\u043C\u044B\u0439"), 0, 1 /* Structured */),
63230
63316
  char: this.findPackageType(systemPackage, new Name("\u0421\u0438\u043C\u0432\u043E\u043B"), 0, 1 /* Structured */),
63231
63317
  yesNo: this.findPackageType(systemPackage, new Name("\u0414\u0430\u041D\u0435\u0442"), 0, 1 /* Structured */),
63232
63318
  nullEntity: this.findPackageType(systemPackage, new Name("\u041F\u0443\u0441\u0442\u043E"), 0, 1 /* Structured */),
@@ -64039,6 +64125,9 @@ var TypeAssignabilityCheck = class {
64039
64125
  if (source.equals(this.analyzer.originalStandardTypes.textTemplate) && target.equals(this.analyzer.originalStandardTypes.text)) {
64040
64126
  return 16 /* ImplicitConversion */;
64041
64127
  }
64128
+ if (source.equals(this.analyzer.originalStandardTypes.localizableTextTemplate) && target.equals(this.analyzer.originalStandardTypes.text)) {
64129
+ return 16 /* ImplicitConversion */;
64130
+ }
64042
64131
  if (source.kind === "variant") {
64043
64132
  let result = this.getAssignabilityFlags(source.getUnderlyingType(), target);
64044
64133
  if (result !== 1 /* NotAssignable */) {
@@ -64165,8 +64254,8 @@ var TypeAssignabilityCheck = class {
64165
64254
  /**
64166
64255
  * @example
64167
64256
  * ```artel
64168
- * перем а = операция(п: Текст): Объект { }
64169
- * перем б = операция(п: Объект): Текст { }
64257
+ * перем а = функция(п: Текст): Объект { }
64258
+ * перем б = функция(п: Объект): Текст { }
64170
64259
  *
64171
64260
  * а = б // Корректно
64172
64261
  * б = а // Ошибка
@@ -73702,11 +73791,13 @@ var Type14 = class {
73702
73791
  case 71 /* ConditionalExpression */:
73703
73792
  return this.ofConditionalExpression(node, analysisOptions);
73704
73793
  case 81 /* TextLiteral */:
73794
+ return this.ofTextLiteral(node, analysisOptions);
73705
73795
  case 82 /* LocalizableTextLiteral */:
73706
- return this.ofTextLiteral(node);
73796
+ return this.ofLocalizableTextLiteral(node, analysisOptions);
73707
73797
  case 76 /* TextTemplateLiteral */:
73708
- case 77 /* LocalizableTextTemplateLiteral */:
73709
73798
  return this.ofTextTemplateLiteral(node, analysisOptions);
73799
+ case 77 /* LocalizableTextTemplateLiteral */:
73800
+ return this.ofLocalizableTextTemplateLiteral(node, analysisOptions);
73710
73801
  case 86 /* IdentifierExpression */:
73711
73802
  return this.ofIdentifierExpression(node, analysisOptions);
73712
73803
  case 80 /* TokenExpression */:
@@ -74045,13 +74136,50 @@ var Type14 = class {
74045
74136
  }
74046
74137
  return this.analyzer.typeFactory.getUnionType([firstExpressionType, secondExpressionType], true);
74047
74138
  }
74048
- ofTextLiteral(node) {
74139
+ ofTextLiteral(node, analysisOptions) {
74049
74140
  const standardTypes = this.analyzer.getLocalizedStandardTypes(node.locale);
74050
- if (node.kind === 81 /* TextLiteral */ && (node.text.flags & 64 /* SingleCharText */) !== 0) {
74141
+ let targetType = this.analyzer.getTargetTypeOfExpression(node, analysisOptions);
74142
+ if (targetType !== void 0) {
74143
+ targetType = targetType.unalias();
74144
+ }
74145
+ let nodeIsTemplateNotText;
74146
+ if (targetType === void 0) {
74147
+ nodeIsTemplateNotText = false;
74148
+ } else if (targetType.equals(standardTypes.textTemplate)) {
74149
+ nodeIsTemplateNotText = true;
74150
+ } else if (targetType.kind === "union") {
74151
+ nodeIsTemplateNotText = targetType.unaliasedFlattenedTypes.some((t) => t.equals(standardTypes.textTemplate)) && !targetType.unaliasedFlattenedTypes.some((t) => t.equals(standardTypes.text));
74152
+ } else {
74153
+ nodeIsTemplateNotText = false;
74154
+ }
74155
+ if (nodeIsTemplateNotText) {
74156
+ return standardTypes.textTemplate;
74157
+ } else if (node.kind === 81 /* TextLiteral */ && (node.text.flags & 64 /* SingleCharText */) !== 0) {
74051
74158
  return standardTypes.char;
74052
74159
  }
74053
74160
  return standardTypes.text;
74054
74161
  }
74162
+ ofLocalizableTextLiteral(node, analysisOptions) {
74163
+ const standardTypes = this.analyzer.getLocalizedStandardTypes(node.locale);
74164
+ let targetType = this.analyzer.getTargetTypeOfExpression(node, analysisOptions);
74165
+ if (targetType !== void 0) {
74166
+ targetType = targetType.unalias();
74167
+ }
74168
+ let nodeIsTemplateNotText;
74169
+ if (targetType === void 0) {
74170
+ nodeIsTemplateNotText = false;
74171
+ } else if (targetType.equals(standardTypes.localizableTextTemplate)) {
74172
+ nodeIsTemplateNotText = true;
74173
+ } else if (targetType.kind === "union") {
74174
+ nodeIsTemplateNotText = targetType.unaliasedFlattenedTypes.some((t) => t.equals(standardTypes.localizableTextTemplate)) && !targetType.unaliasedFlattenedTypes.some((t) => t.equals(standardTypes.text));
74175
+ } else {
74176
+ nodeIsTemplateNotText = false;
74177
+ }
74178
+ if (nodeIsTemplateNotText) {
74179
+ return standardTypes.localizableTextTemplate;
74180
+ }
74181
+ return standardTypes.text;
74182
+ }
74055
74183
  /**
74056
74184
  * По умолчанию литерал шаблона текста имеет тип Текст.
74057
74185
  *
@@ -74078,6 +74206,32 @@ var Type14 = class {
74078
74206
  }
74079
74207
  return nodeIsTemplateNotText ? standardTypes.textTemplate : standardTypes.text;
74080
74208
  }
74209
+ /**
74210
+ * По умолчанию литерал шаблона текста имеет тип Текст.
74211
+ *
74212
+ * Литерал переводимого шаблона текста имеет тип ШаблонТекстаПереводимый в следующих случаях:
74213
+ * - если он присваивается в переменную, имеющую тип ШаблонТекстаПереводимый;
74214
+ * - если он присваивается в переменную, имеющую союзный тип, содержащий тип ШаблонТекстаПереводимый
74215
+ * и не содержащий тип Текст.
74216
+ */
74217
+ ofLocalizableTextTemplateLiteral(node, analysisOptions) {
74218
+ const standardTypes = this.analyzer.getLocalizedStandardTypes(node.locale);
74219
+ let targetType = this.analyzer.getTargetTypeOfExpression(node, analysisOptions);
74220
+ if (targetType !== void 0) {
74221
+ targetType = targetType.unalias();
74222
+ }
74223
+ let nodeIsTemplateNotText;
74224
+ if (targetType === void 0) {
74225
+ nodeIsTemplateNotText = false;
74226
+ } else if (targetType.equals(standardTypes.localizableTextTemplate)) {
74227
+ nodeIsTemplateNotText = true;
74228
+ } else if (targetType.kind === "union") {
74229
+ nodeIsTemplateNotText = targetType.unaliasedFlattenedTypes.some((t) => t.equals(standardTypes.localizableTextTemplate)) && !targetType.unaliasedFlattenedTypes.some((t) => t.equals(standardTypes.text));
74230
+ } else {
74231
+ nodeIsTemplateNotText = false;
74232
+ }
74233
+ return nodeIsTemplateNotText ? standardTypes.localizableTextTemplate : standardTypes.text;
74234
+ }
74081
74235
  ofIdentifierExpression(node, analysisOptions) {
74082
74236
  const meaning = this.analyzer.resolveIdentifierExpression(node, analysisOptions);
74083
74237
  switch (meaning.kind) {
@@ -281,8 +281,8 @@ declare class TypeAssignabilityCheck {
281
281
  /**
282
282
  * @example
283
283
  * ```artel
284
- * перем а = операция(п: Текст): Объект { }
285
- * перем б = операция(п: Объект): Текст { }
284
+ * перем а = функция(п: Текст): Объект { }
285
+ * перем б = функция(п: Объект): Текст { }
286
286
  *
287
287
  * а = б // Корректно
288
288
  * б = а // Ошибка
@@ -13,6 +13,7 @@ export interface WellKnownDeclarations {
13
13
  readonly integer: StructuredTypeEntity;
14
14
  readonly text: StructuredTypeEntity;
15
15
  readonly textTemplate: StructuredTypeEntity;
16
+ readonly localizableTextTemplate: StructuredTypeEntity;
16
17
  readonly char: StructuredTypeEntity;
17
18
  readonly yesNo: StructuredTypeEntity;
18
19
  readonly nullEntity: StructuredTypeEntity;
@@ -47,6 +48,7 @@ export declare class LocalizedWellKnownDeclarations implements WellKnownDeclarat
47
48
  private integer_;
48
49
  private text_;
49
50
  private textTemplate_;
51
+ private localizableTextTemplate_;
50
52
  private char_;
51
53
  private yesNo_;
52
54
  private null_;
@@ -78,6 +80,7 @@ export declare class LocalizedWellKnownDeclarations implements WellKnownDeclarat
78
80
  get integer(): StructuredTypeEntity;
79
81
  get text(): StructuredTypeEntity;
80
82
  get textTemplate(): StructuredTypeEntity;
83
+ get localizableTextTemplate(): StructuredTypeEntity;
81
84
  get char(): StructuredTypeEntity;
82
85
  get yesNo(): StructuredTypeEntity;
83
86
  get nullEntity(): StructuredTypeEntity;
@@ -257,6 +257,7 @@ declare class Type {
257
257
  private ofDereferenceExpression;
258
258
  private ofConditionalExpression;
259
259
  private ofTextLiteral;
260
+ private ofLocalizableTextLiteral;
260
261
  /**
261
262
  * По умолчанию литерал шаблона текста имеет тип Текст.
262
263
  *
@@ -266,6 +267,15 @@ declare class Type {
266
267
  * и не содержащий тип Текст.
267
268
  */
268
269
  private ofTextTemplateLiteral;
270
+ /**
271
+ * По умолчанию литерал шаблона текста имеет тип Текст.
272
+ *
273
+ * Литерал переводимого шаблона текста имеет тип ШаблонТекстаПереводимый в следующих случаях:
274
+ * - если он присваивается в переменную, имеющую тип ШаблонТекстаПереводимый;
275
+ * - если он присваивается в переменную, имеющую союзный тип, содержащий тип ШаблонТекстаПереводимый
276
+ * и не содержащий тип Текст.
277
+ */
278
+ private ofLocalizableTextTemplateLiteral;
269
279
  private ofIdentifierExpression;
270
280
  private ofTokenExpression;
271
281
  private ofKeywordExpression;
@@ -1,9 +1,6 @@
1
- import { TextKey } from '../../entities/index.js';
2
1
  import * as tree from '../../tree/a/index.js';
3
2
  export declare class TextIdentity {
4
- static keyFromTextFragments(fragments: readonly string[]): TextKey;
5
- static keyFromTextToken(token: tree.Token<tree.TokenKind.TextLiteral>): TextKey;
6
- static keyFromLocalizableTextLiteral(node: tree.LocalizableTextLiteral): TextKey;
7
- static keyFromLocalizableTextTemplateLiteral(node: tree.LocalizableTextTemplateLiteral): TextKey;
8
- static keyFromTextTranslationSource(node: tree.TextTranslationSource): TextKey;
3
+ static keyFromLocalizableTextLiteral(node: tree.LocalizableTextLiteral): string;
4
+ static keyFromLocalizableTextTemplateLiteral(node: tree.LocalizableTextTemplateLiteral): string;
5
+ static keyFromTextTranslationSource(node: tree.TextTranslationSource): string;
9
6
  }
@@ -1,5 +1,5 @@
1
1
  import { Name } from '../../../common/index.js';
2
- import { AnonymousFunctionEntity, FunctionEntity, FunctionTypeEntity, GetterEntity, MethodEntity, NamedFunctionEntity, PackageEntity, ParameterEntity, SetterEntity, TextKey, TextTranslationEntity, TypeEntity, TypeEntityWithMembers, TypeExtensionEntity } from '../../../entities/index.js';
2
+ import { AnonymousFunctionEntity, FunctionEntity, FunctionTypeEntity, GetterEntity, MethodEntity, NamedFunctionEntity, PackageEntity, ParameterEntity, SetterEntity, TextTranslationEntity, TypeEntity, TypeEntityWithMembers, TypeExtensionEntity } from '../../../entities/index.js';
3
3
  import { SourceFileA } from '../../../project/SourceFile.js';
4
4
  import * as tree from '../../../tree/a/index.js';
5
5
  import * as types from '../../../types/index.js';
@@ -34,7 +34,7 @@ export declare abstract class SemanticContextBase implements TypeExtensionLookup
34
34
  getNamedDeclarations(noInstanceMembers?: boolean): readonly NamedDeclaration[];
35
35
  getNamedDeclarationsByName(name: Name, noInstanceMembers?: boolean): NamedDeclarationLookupResult;
36
36
  getTypeExtensionsByType(type: TypeEntity): readonly TypeExtensionEntity[];
37
- getTextTranslationEntityByTextKey(key: TextKey): readonly TextTranslationEntity[];
37
+ getTextTranslationEntityByTextKey(key: string): readonly TextTranslationEntity[];
38
38
  private semanticContexts;
39
39
  private getSourceFileContext;
40
40
  }
@@ -1,6 +1,6 @@
1
1
  import { Name } from '../../../common/index.js';
2
2
  import { DiagnosticAcceptor } from '../../../diagnostic/Diagnostic.js';
3
- import { PackageEntity, TextKey, TextTranslationEntity, TypeEntity, TypeExtensionEntity } from '../../../entities/index.js';
3
+ import { PackageEntity, TextTranslationEntity, TypeEntity, TypeExtensionEntity } from '../../../entities/index.js';
4
4
  import { SourceFileA } from '../../../project/SourceFile.js';
5
5
  import * as tree from '../../../tree/a/index.js';
6
6
  import { DiagnosticArgumentFactory } from '../../DiagnosticArgumentFactory.js';
@@ -45,7 +45,7 @@ export declare class SourceFileSemanticContext extends SemanticContextBase {
45
45
  getOwnNamedDeclarations(initialContext: SemanticContext, _noInstanceMembers: boolean, _lookupState: SemanticContextLookupState): NamedDeclaration[];
46
46
  getOwnNamedDeclarationsByName(name: Name, initialContext: SemanticContext, _noInstanceMembers: boolean, lookupResult: NamedDeclarationLookupResult): void;
47
47
  getOwnTypeExtensionsByType(type: TypeEntity, initialContext: SemanticContext): TypeExtensionEntity[];
48
- getTextTranslationEntityByTextKey(key: TextKey): readonly TextTranslationEntity[];
48
+ getTextTranslationEntityByTextKey(key: string): readonly TextTranslationEntity[];
49
49
  validateNameConflicts(diagnostics: DiagnosticAcceptor): void;
50
50
  private convertPackageMemberToNamedDeclaration;
51
51
  private convertPackageAliasToTypeOrContainerWithTypes;
@@ -68,6 +68,7 @@ declare class StandardTypes {
68
68
  private array_;
69
69
  private func_;
70
70
  private textTemplate_;
71
+ private localizableTextTemplate_;
71
72
  private reference_;
72
73
  get nullType(): Type;
73
74
  get yesNo(): Type;
@@ -80,6 +81,7 @@ declare class StandardTypes {
80
81
  get array(): Type;
81
82
  get func(): Type;
82
83
  get textTemplate(): Type;
84
+ get localizableTextTemplate(): Type;
83
85
  get reference(): Type;
84
86
  constructor(analyzer: Analyzer, entityMap: EntityMap);
85
87
  }
@@ -89,10 +89,10 @@ export declare function switchStatement(matchExpression: ir.Expression, caseClau
89
89
  export declare function caseClause(expressions: readonly ir.Expression[], body: ir.BlockStatement, sourceLocation?: ir.SourceLocation): ir.CaseClause;
90
90
  export declare function ternaryExpression(condition: ir.Expression, firstExpression: ir.Expression, secondExpression: ir.Expression, sourceLocation?: ir.SourceLocation): ir.TernaryExpression;
91
91
  export declare function textLiteral(value: string, sourceLocation?: ir.SourceLocation): ir.TextLiteral;
92
- export declare function localizableTextLiteral(value: string, code: number | undefined, sourceLocation?: ir.SourceLocation): ir.LocalizableTextLiteral;
92
+ export declare function localizableTextLiteral(value: string, key: string | undefined, sourceLocation?: ir.SourceLocation): ir.LocalizableTextLiteral;
93
93
  export declare function textWithEntityName(entity: NamedEntity, sourceLocation?: ir.SourceLocation): ir.TextWithEntityName;
94
94
  export declare function textTemplateLiteral(textFragments: readonly string[], expressions: readonly ir.Expression[], sourceLocation?: ir.SourceLocation): ir.TextTemplateLiteral;
95
- export declare function localizableTextTemplateLiteral(textFragments: readonly string[], expressions: readonly ir.Expression[], code: number | undefined, sourceLocation?: ir.SourceLocation): ir.LocalizableTextTemplateLiteral;
95
+ export declare function localizableTextTemplateLiteral(textFragments: readonly string[], expressions: readonly ir.Expression[], key: string | undefined, sourceLocation?: ir.SourceLocation): ir.LocalizableTextTemplateLiteral;
96
96
  export declare function thisExpression(type: Type, sourceLocation?: ir.SourceLocation): ir.ThisExpression;
97
97
  export declare function typeAccessExpression(entity: TypeOrExtensionEntity, sourceLocation?: ir.SourceLocation): ir.TypeAccessExpression;
98
98
  export declare function constructorDeclaration(entity: FunctionEntity, parameters: readonly ir.ParameterDeclaration[], body: ir.BlockStatement, sourceLocation?: ir.SourceLocation): ir.ConstructorDeclaration;
@@ -115,7 +115,7 @@ export declare function fieldSetterDeclaration(entity: FunctionEntity, body: ir.
115
115
  export declare function parameterDeclaration(entity: VariableEntity, defaultValue: ir.Expression | undefined, isRest: boolean, sourceLocation?: ir.SourceLocation): ir.ParameterDeclaration;
116
116
  export declare function whileStatement(label: string | undefined, condition: ir.Expression, body: ir.BlockStatement, sourceLocation?: ir.SourceLocation): ir.WhileStatement;
117
117
  export declare function yieldStatement(expression: ir.Expression, sourceLocation?: ir.SourceLocation): ir.YieldStatement;
118
- export declare function textTranslationDeclaration(key: string | number, sourceTextTemplate: ir.TranslationTextTemplate | undefined, translatedTextOrFunctionBlock: ir.TextLiteral | ir.BlockStatement, sourceLocation?: ir.SourceLocation): ir.TextTranslationDeclaration;
118
+ export declare function textTranslationDeclaration(key: string, sourceTextTemplate: ir.TranslationTextTemplate | undefined, translatedTextOrFunctionBlock: ir.TextLiteral | ir.BlockStatement, sourceLocation?: ir.SourceLocation): ir.TextTranslationDeclaration;
119
119
  export declare function translationTextTemplate(fragments: readonly string[], parameters: readonly VariableEntity[], sourceLocation?: ir.SourceLocation): ir.TranslationTextTemplate;
120
120
  export declare function constructorCallExpression(ectx: EmitterContext, constructor: FunctionEntity, args: readonly ir.Expression[] | ir.Arguments, sourceLocation?: ir.SourceLocation): ir.ConstructorCallExpression;
121
121
  export declare function constructorCallExpressionWithResultType(constructor: FunctionEntity, args: readonly ir.Expression[] | ir.Arguments, type: Type, sourceLocation?: ir.SourceLocation): ir.ConstructorCallExpression;
@@ -70,7 +70,6 @@ export declare class TextTemplateEmitOptions {
70
70
  private flags;
71
71
  constructor(flags?: TextTemplateEmitOptionsFlags);
72
72
  constructor(createTextTemplateInstance: boolean);
73
- static default(): TextTemplateEmitOptions;
74
73
  get createTextTemplateInstance(): boolean;
75
74
  set createTextTemplateInstance(value: boolean);
76
75
  setCreateTextTemplateInstance(value: boolean): this;
@@ -712,15 +712,19 @@ export declare class TextLiteral {
712
712
  value: string;
713
713
  sourceLocation?: SourceLocation | undefined;
714
714
  readonly kind = NodeKind.TextLiteral;
715
+ options: TextTemplateEmitOptions;
715
716
  constructor(value: string, sourceLocation?: SourceLocation | undefined);
717
+ withOptions(options: TextTemplateEmitOptions): this;
716
718
  clone(): TextLiteral;
717
719
  }
718
720
  export declare class LocalizableTextLiteral {
719
721
  value: string;
720
- code: number | undefined;
722
+ key: string | undefined;
721
723
  sourceLocation?: SourceLocation | undefined;
722
724
  readonly kind = NodeKind.LocalizableTextLiteral;
723
- constructor(value: string, code: number | undefined, sourceLocation?: SourceLocation | undefined);
725
+ options: TextTemplateEmitOptions;
726
+ constructor(value: string, key: string | undefined, sourceLocation?: SourceLocation | undefined);
727
+ withOptions(options: TextTemplateEmitOptions): this;
724
728
  clone(): LocalizableTextLiteral;
725
729
  }
726
730
  /**
@@ -748,11 +752,11 @@ export declare class TextTemplateLiteral {
748
752
  export declare class LocalizableTextTemplateLiteral {
749
753
  textFragments: readonly string[];
750
754
  expressions: readonly Expression[];
751
- code: number | undefined;
755
+ key: string | undefined;
752
756
  sourceLocation?: SourceLocation | undefined;
753
757
  readonly kind = NodeKind.LocalizableTextTemplateLiteral;
754
758
  options: TextTemplateEmitOptions;
755
- constructor(textFragments: readonly string[], expressions: readonly Expression[], code: number | undefined, sourceLocation?: SourceLocation | undefined);
759
+ constructor(textFragments: readonly string[], expressions: readonly Expression[], key: string | undefined, sourceLocation?: SourceLocation | undefined);
756
760
  withOptions(options: TextTemplateEmitOptions): this;
757
761
  clone(): LocalizableTextTemplateLiteral;
758
762
  }
@@ -976,12 +980,12 @@ export declare class YieldStatement {
976
980
  clone(): YieldStatement;
977
981
  }
978
982
  export declare class TextTranslationDeclaration {
979
- key: string | number;
983
+ key: string;
980
984
  sourceTextTemplate: TranslationTextTemplate | undefined;
981
985
  translatedTextOrFunctionBlock: TextLiteral | BlockStatement;
982
986
  sourceLocation?: SourceLocation | undefined;
983
987
  readonly kind = NodeKind.TextTranslationDeclaration;
984
- constructor(key: string | number, sourceTextTemplate: TranslationTextTemplate | undefined, translatedTextOrFunctionBlock: TextLiteral | BlockStatement, sourceLocation?: SourceLocation | undefined);
988
+ constructor(key: string, sourceTextTemplate: TranslationTextTemplate | undefined, translatedTextOrFunctionBlock: TextLiteral | BlockStatement, sourceLocation?: SourceLocation | undefined);
985
989
  clone(): TextTranslationDeclaration;
986
990
  }
987
991
  export declare class TranslationTextTemplate {
@@ -1,5 +1,5 @@
1
1
  import { Name } from '../common/index.js';
2
- import { NamedPackageMemberEntity, TextKey, TextTranslationEntity, TypeEntity, TypeExtensionEntity } from './index.js';
2
+ import { NamedPackageMemberEntity, TextTranslationEntity, TypeEntity, TypeExtensionEntity } from './index.js';
3
3
  export declare class PackageEntityMembers {
4
4
  private readonly namedMembers;
5
5
  private readonly typeExtensions;
@@ -9,13 +9,13 @@ export declare class PackageEntityMembers {
9
9
  private readonly membersByNameKey_;
10
10
  private readonly textTranslationsByTextKey_;
11
11
  private get membersByNameKey();
12
- get textTranslationsByTextKey(): ReadonlyMap<TextKey, readonly TextTranslationEntity[]>;
12
+ get textTranslationsByTextKey(): ReadonlyMap<string, readonly TextTranslationEntity[]>;
13
13
  constructor(namedMembers: readonly NamedPackageMemberEntity[], typeExtensions: readonly TypeExtensionEntity[], textTranslations: readonly TextTranslationEntity[]);
14
14
  getNamedMembers(): readonly NamedPackageMemberEntity[];
15
15
  getNamedMembersByName(name: Name): readonly NamedPackageMemberEntity[];
16
16
  getTypeExtensions(): readonly TypeExtensionEntity[];
17
17
  getTypeExtensionsByType(type: TypeEntity): readonly TypeExtensionEntity[];
18
18
  getTextTranslations(): readonly TextTranslationEntity[];
19
- getTextTranslationsByTextKey(key: TextKey): readonly TextTranslationEntity[];
19
+ getTextTranslationsByTextKey(key: string): readonly TextTranslationEntity[];
20
20
  getNamedMembersAndTypeExtensions(): Iterable<NamedPackageMemberEntity | TypeExtensionEntity>;
21
21
  }
@@ -4,7 +4,7 @@ import { DefinitionKind, EntityHidingLevel, EntityKind, ParameterEntity } from '
4
4
  export interface TextTranslationEntity extends IEntity {
5
5
  readonly kind: EntityKind.TextTranslation;
6
6
  isTextTemplate(): boolean;
7
- getKey(): TextKey;
7
+ getKey(): string;
8
8
  getText(): string;
9
9
  getTextFragments(): readonly string[];
10
10
  getComment(): string | undefined;
@@ -13,7 +13,6 @@ export interface TextTranslationEntity extends IEntity {
13
13
  isHidden(): EntityHidingLevel | undefined;
14
14
  getOriginalEntity(): TextTranslationEntity;
15
15
  }
16
- export type TextKey = string | number;
17
16
  export type TextTranslationEntityDefinition = {
18
17
  kind: DefinitionKind.Source;
19
18
  node: treeA.TextTranslationSource;
@@ -1,7 +1,7 @@
1
1
  import { Analyzer } from '../../../analysis/a/Analyzer.js';
2
2
  import { PackageDialect, PackageLocale } from '../../../common/index.js';
3
3
  import * as tree from '../../../tree/a/index.js';
4
- import { EntityHidingLevel, EntityKind, PackageEntity, ParameterEntity, Tag, TextKey, TextTranslationEntity, TextTranslationEntityDefinition, Translation } from '../../index.js';
4
+ import { EntityHidingLevel, EntityKind, PackageEntity, ParameterEntity, Tag, TextTranslationEntity, TextTranslationEntityDefinition, Translation } from '../../index.js';
5
5
  export declare class TextTranslationDeclarationEntity implements TextTranslationEntity {
6
6
  private readonly analyzer;
7
7
  private readonly node;
@@ -13,7 +13,7 @@ export declare class TextTranslationDeclarationEntity implements TextTranslation
13
13
  private readonly comment;
14
14
  constructor(analyzer: Analyzer, node: tree.TextTranslationSource);
15
15
  isTextTemplate(): boolean;
16
- getKey(): TextKey;
16
+ getKey(): string;
17
17
  getText(): string;
18
18
  getTextFragments(): readonly string[];
19
19
  getParameters(): readonly ParameterEntity[];
@@ -1209,14 +1209,14 @@ export declare class LocalizableTextTemplateLiteral extends BaseExpressionNode {
1209
1209
  readonly children: readonly [
1210
1210
  TextTemplateHead,
1211
1211
  TextTemplateSpanList,
1212
- Token<TokenKind.IntegerLiteral> | undefined
1212
+ Token<TokenKind.TextLiteral> | undefined
1213
1213
  ];
1214
1214
  get parent(): ExpressionParent;
1215
1215
  get head(): TextTemplateHead;
1216
1216
  get spanList(): TextTemplateSpanList;
1217
- get code(): Token<TokenKind.IntegerLiteral> | undefined;
1217
+ get key(): Token<TokenKind.TextLiteral> | undefined;
1218
1218
  protected get thisAsNode(): Expression;
1219
- constructor(head: TextTemplateHead, spanList: TextTemplateSpanList, code: Token<TokenKind.IntegerLiteral> | undefined, rangeWithTrivia: Range | undefined);
1219
+ constructor(head: TextTemplateHead, spanList: TextTemplateSpanList, key: Token<TokenKind.TextLiteral> | undefined, rangeWithTrivia: Range | undefined);
1220
1220
  }
1221
1221
  export type TextTemplateSpanListParent = TextTemplateLiteral | LocalizableTextTemplateLiteral;
1222
1222
  export declare class TextTemplateSpanList extends BaseNode {
@@ -1267,13 +1267,13 @@ export declare class LocalizableTextLiteral extends BaseExpressionNode {
1267
1267
  readonly kind = NodeKind.LocalizableTextLiteral;
1268
1268
  readonly children: readonly [
1269
1269
  Token<TokenKind.TextLiteral>,
1270
- Token<TokenKind.IntegerLiteral> | undefined
1270
+ Token<TokenKind.TextLiteral> | undefined
1271
1271
  ];
1272
1272
  get parent(): ExpressionParent;
1273
1273
  get text(): Token<TokenKind.TextLiteral>;
1274
- get code(): Token<TokenKind.IntegerLiteral> | undefined;
1274
+ get key(): Token<TokenKind.TextLiteral> | undefined;
1275
1275
  protected get thisAsNode(): Expression;
1276
- constructor(text: Token<TokenKind.TextLiteral>, code: Token<TokenKind.IntegerLiteral> | undefined, rangeWithTrivia: Range | undefined);
1276
+ constructor(text: Token<TokenKind.TextLiteral>, key: Token<TokenKind.TextLiteral> | undefined, rangeWithTrivia: Range | undefined);
1277
1277
  }
1278
1278
  export declare class KeywordExpression extends BaseExpressionNode {
1279
1279
  readonly kind = NodeKind.KeywordExpression;
@@ -2051,27 +2051,27 @@ export declare class TranslationTextLiteral extends BaseNode {
2051
2051
  readonly kind = NodeKind.TranslationTextLiteral;
2052
2052
  readonly children: readonly [
2053
2053
  Token<TokenKind.TextLiteral>,
2054
- Token<TokenKind.IntegerLiteral> | undefined
2054
+ Token<TokenKind.TextLiteral> | undefined
2055
2055
  ];
2056
2056
  get parent(): TranslationTextParent;
2057
2057
  get text(): Token<TokenKind.TextLiteral>;
2058
- get code(): Token<TokenKind.IntegerLiteral> | undefined;
2058
+ get key(): Token<TokenKind.TextLiteral> | undefined;
2059
2059
  protected get thisAsNode(): Node;
2060
- constructor(text: Token<TokenKind.TextLiteral>, code: Token<TokenKind.IntegerLiteral> | undefined, rangeWithTrivia: Range | undefined);
2060
+ constructor(text: Token<TokenKind.TextLiteral>, key: Token<TokenKind.TextLiteral> | undefined, rangeWithTrivia: Range | undefined);
2061
2061
  }
2062
2062
  export declare class TranslationTextTemplate extends BaseNode {
2063
2063
  readonly kind = NodeKind.TranslationTextTemplate;
2064
2064
  readonly children: readonly [
2065
2065
  TextTemplateHead,
2066
2066
  TranslationTextTemplateSpanList,
2067
- Token<TokenKind.IntegerLiteral> | undefined
2067
+ Token<TokenKind.TextLiteral> | undefined
2068
2068
  ];
2069
2069
  get parent(): TranslationTextParent;
2070
2070
  get head(): TextTemplateHead;
2071
2071
  get spanList(): TranslationTextTemplateSpanList;
2072
- get code(): Token<TokenKind.IntegerLiteral> | undefined;
2072
+ get key(): Token<TokenKind.TextLiteral> | undefined;
2073
2073
  protected get thisAsNode(): Node;
2074
- constructor(head: TextTemplateHead, spanList: TranslationTextTemplateSpanList, code: Token<TokenKind.IntegerLiteral> | undefined, rangeWithTrivia: Range | undefined);
2074
+ constructor(head: TextTemplateHead, spanList: TranslationTextTemplateSpanList, key: Token<TokenKind.TextLiteral> | undefined, rangeWithTrivia: Range | undefined);
2075
2075
  }
2076
2076
  export declare class TranslationTextTemplateSpanList extends BaseNode {
2077
2077
  readonly kind = NodeKind.TranslationTextTemplateSpanList;
@@ -11,6 +11,7 @@ export declare class StandardTypes {
11
11
  private integer_;
12
12
  private text_;
13
13
  private textTemplate_;
14
+ private localizableTextTemplate_;
14
15
  private char_;
15
16
  private unresolved_;
16
17
  private yesNo_;
@@ -30,6 +31,7 @@ export declare class StandardTypes {
30
31
  get integer(): StructuredType;
31
32
  get text(): StructuredType;
32
33
  get textTemplate(): StructuredType;
34
+ get localizableTextTemplate(): StructuredType;
33
35
  get char(): StructuredType;
34
36
  get unresolved(): UnresolvedType;
35
37
  get yesNo(): StructuredType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artel/artc",
3
- "version": "0.6.26024",
3
+ "version": "0.6.26025",
4
4
  "description": "Артель Компилятор | Artel Compiler",
5
5
  "author": "Nezaboodka Team <contact@nezaboodka.com>",
6
6
  "license": "Apache-2.0",