@artel/artc 0.9.26047-pre-release → 0.9.26048-pre-release
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 +3 -3
- package/build/api/Api.js +2 -2
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +1 -1
- package/build/{chunk-CQ7C3WWI.js → chunk-467TFDOD.js} +2 -2
- package/build/{chunk-UZ2KX7BW.js → chunk-J3BXLO7R.js} +1 -1
- package/build/{chunk-LBLLWKHX.js → chunk-NT4OVN2D.js} +114 -79
- package/build/types/emitter/IrToJs.d.ts +9 -2
- package/package.json +13 -8
package/build/Cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CommandLineCompiler
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-467TFDOD.js";
|
|
5
|
+
import "./chunk-J3BXLO7R.js";
|
|
6
6
|
import {
|
|
7
7
|
__async
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NT4OVN2D.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-
|
|
3
|
+
} from "../chunk-J3BXLO7R.js";
|
|
4
4
|
import {
|
|
5
5
|
AccessKind,
|
|
6
6
|
AccessedFunction_entity,
|
|
@@ -311,7 +311,7 @@ import {
|
|
|
311
311
|
withoutQuotes,
|
|
312
312
|
withoutTemplateQuotes,
|
|
313
313
|
yieldTask
|
|
314
|
-
} from "../chunk-
|
|
314
|
+
} from "../chunk-NT4OVN2D.js";
|
|
315
315
|
export {
|
|
316
316
|
AccessKind,
|
|
317
317
|
AccessedFunction_entity,
|
package/build/api/ApiNodeJS.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
PhysicalFileSystem,
|
|
7
7
|
PhysicalTypeScriptLibrariesProvider,
|
|
8
8
|
PrintingDiagnosticAcceptor
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-467TFDOD.js";
|
|
10
|
+
import "../chunk-J3BXLO7R.js";
|
|
11
|
+
import "../chunk-NT4OVN2D.js";
|
|
12
12
|
export {
|
|
13
13
|
CommandLineCompiler,
|
|
14
14
|
FileSystemUri,
|
package/build/api/ApiServices.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Compiler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J3BXLO7R.js";
|
|
4
4
|
import {
|
|
5
5
|
ArtelVersion,
|
|
6
6
|
Cached,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
__async,
|
|
17
17
|
performanceMeasurementStageNames,
|
|
18
18
|
performanceMeasurementStages
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NT4OVN2D.js";
|
|
20
20
|
|
|
21
21
|
// source/executor/FileSystemUri.ts
|
|
22
22
|
import { platform } from "os";
|
|
@@ -782,7 +782,7 @@ var UniqueWithComparatorQuery = class extends Query {
|
|
|
782
782
|
};
|
|
783
783
|
|
|
784
784
|
// source/common/Constants.ts
|
|
785
|
-
var ArtelVersion = true ? "0.9.
|
|
785
|
+
var ArtelVersion = true ? "0.9.26048-pre-release" : "";
|
|
786
786
|
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"];
|
|
787
787
|
var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
|
|
788
788
|
var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
|
|
@@ -39558,9 +39558,6 @@ function isNodeM(node) {
|
|
|
39558
39558
|
return node instanceof BaseNode2;
|
|
39559
39559
|
}
|
|
39560
39560
|
|
|
39561
|
-
// source/emitter/Emitter.ts
|
|
39562
|
-
import { CodeGenerator } from "@babel/generator";
|
|
39563
|
-
|
|
39564
39561
|
// source/emitter/EmitPhaseName.ts
|
|
39565
39562
|
var EmitPhaseName = class {
|
|
39566
39563
|
static ofMainFunction(locale) {
|
|
@@ -48977,6 +48974,10 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
|
|
|
48977
48974
|
Debug.assertNotNull(enumeratorMethod);
|
|
48978
48975
|
node.options.addExplicitCallOfEnumeratorMethodIfRequired = false;
|
|
48979
48976
|
const iteratorField = this.ctx.symbolIteratorField;
|
|
48977
|
+
const computedNameInfo = enumeratorMethod.entity.details.hasComputedName;
|
|
48978
|
+
if (computedNameInfo !== void 0 && computedNameInfo.symbolDeclarationSegments.length === 1 && computedNameInfo.symbolDeclarationSegments[0] === iteratorField) {
|
|
48979
|
+
return;
|
|
48980
|
+
}
|
|
48980
48981
|
const key = staticFieldGetAccess(iteratorField);
|
|
48981
48982
|
const enumeratorMethodCall = instanceMethodCallExpression(
|
|
48982
48983
|
node.enumeratedExpression,
|
|
@@ -50520,7 +50521,6 @@ var IrBuilderA = class {
|
|
|
50520
50521
|
if (info.baseConstructor !== void 0) {
|
|
50521
50522
|
const args = info.orderedParametersForBaseConstructor.map((v) => variableGetAccess(this.entityMap.getVariableEntity(v.parameter)));
|
|
50522
50523
|
const baseConstructorEntity = info.baseConstructor.entity;
|
|
50523
|
-
const containingType = baseConstructorEntity.getContainingType();
|
|
50524
50524
|
const baseConstructorCall = baseConstructorCallExpression(
|
|
50525
50525
|
this.entityMap.getNamedFunctionEntity(baseConstructorEntity),
|
|
50526
50526
|
args
|
|
@@ -51469,7 +51469,7 @@ var IrBuilderA = class {
|
|
|
51469
51469
|
}
|
|
51470
51470
|
case "static-field-access": {
|
|
51471
51471
|
const typeEntity = this.getEntityFromType(meaning.type);
|
|
51472
|
-
const typeAccess = typeAccessExpression(typeEntity);
|
|
51472
|
+
const typeAccess = typeAccessExpression(typeEntity, this.getSourceLocation(expression.expression));
|
|
51473
51473
|
const originalEntity = meaning.field.entity;
|
|
51474
51474
|
const entity = this.entityMap.getVariableEntity(originalEntity);
|
|
51475
51475
|
const access = this.convertVariableAccess(meaning.access, originalEntity);
|
|
@@ -51489,7 +51489,7 @@ var IrBuilderA = class {
|
|
|
51489
51489
|
return textLiteral("No suitable functions.");
|
|
51490
51490
|
}
|
|
51491
51491
|
const typeEntity = this.getEntityFromType(meaning.type);
|
|
51492
|
-
const typeAccess = typeAccessExpression(typeEntity);
|
|
51492
|
+
const typeAccess = typeAccessExpression(typeEntity, this.getSourceLocation(expression.expression));
|
|
51493
51493
|
const isCallee = this.expressionIsCallee(expression);
|
|
51494
51494
|
const entity = this.entityMap.getNamedFunctionEntity(method.entity);
|
|
51495
51495
|
const returnType = this.entityMap.getType(method.getReturnType());
|
|
@@ -51728,7 +51728,7 @@ var IrBuilderA = class {
|
|
|
51728
51728
|
const originalEntity = meaning.variable.entity;
|
|
51729
51729
|
let receiver;
|
|
51730
51730
|
if (originalEntity.subkind === "field") {
|
|
51731
|
-
receiver = this.createExplicitReceiver(originalEntity);
|
|
51731
|
+
receiver = this.createExplicitReceiver(originalEntity, this.getSourceLocation(expression));
|
|
51732
51732
|
}
|
|
51733
51733
|
const entity = this.entityMap.getVariableEntity(originalEntity);
|
|
51734
51734
|
const access = this.convertVariableAccess(meaning.access, originalEntity);
|
|
@@ -51754,7 +51754,7 @@ var IrBuilderA = class {
|
|
|
51754
51754
|
const originalEntity = suitableFunction.entity;
|
|
51755
51755
|
let receiver;
|
|
51756
51756
|
if (originalEntity.subkind === "method") {
|
|
51757
|
-
receiver = this.createExplicitReceiver(originalEntity);
|
|
51757
|
+
receiver = this.createExplicitReceiver(originalEntity, this.getSourceLocation(expression));
|
|
51758
51758
|
}
|
|
51759
51759
|
const isCallee = this.expressionIsCallee(expression);
|
|
51760
51760
|
const entity = this.entityMap.getNamedFunctionEntity(originalEntity);
|
|
@@ -51775,15 +51775,15 @@ var IrBuilderA = class {
|
|
|
51775
51775
|
Debug.never(meaning);
|
|
51776
51776
|
}
|
|
51777
51777
|
}
|
|
51778
|
-
createExplicitReceiver(entity) {
|
|
51778
|
+
createExplicitReceiver(entity, sourceLocation) {
|
|
51779
51779
|
let result;
|
|
51780
51780
|
if (entity.isStatic()) {
|
|
51781
51781
|
const typeOrExtensionEntity = this.entityMap.getTypeEntity(entity.getContainingType());
|
|
51782
|
-
result = typeAccessExpression(typeOrExtensionEntity);
|
|
51782
|
+
result = typeAccessExpression(typeOrExtensionEntity, sourceLocation);
|
|
51783
51783
|
} else {
|
|
51784
51784
|
const typeEntity = entity.getContainingType();
|
|
51785
51785
|
const type = this.entityMap.getType(this.analyzer.instantiateTypeByIdentitySubstitution(typeEntity));
|
|
51786
|
-
result = thisExpression(type);
|
|
51786
|
+
result = thisExpression(type, sourceLocation);
|
|
51787
51787
|
}
|
|
51788
51788
|
return result;
|
|
51789
51789
|
}
|
|
@@ -53679,7 +53679,7 @@ var IrBuilderM = class {
|
|
|
53679
53679
|
const originalEntity = meaning.variable.entity;
|
|
53680
53680
|
let receiver;
|
|
53681
53681
|
if (originalEntity.subkind === "field") {
|
|
53682
|
-
receiver = this.createExplicitReceiver(originalEntity);
|
|
53682
|
+
receiver = this.createExplicitReceiver(originalEntity, this.getSourceLocation(expression));
|
|
53683
53683
|
}
|
|
53684
53684
|
const entity = this.entityMap.getVariableEntity(originalEntity);
|
|
53685
53685
|
const access = this.convertVariableAccess(meaning.access, originalEntity);
|
|
@@ -53705,7 +53705,7 @@ var IrBuilderM = class {
|
|
|
53705
53705
|
const originalEntity = suitableFunction.entity;
|
|
53706
53706
|
let receiver;
|
|
53707
53707
|
if (originalEntity.subkind === "method") {
|
|
53708
|
-
receiver = this.createExplicitReceiver(originalEntity);
|
|
53708
|
+
receiver = this.createExplicitReceiver(originalEntity, this.getSourceLocation(expression));
|
|
53709
53709
|
}
|
|
53710
53710
|
const isCallee = this.expressionIsCallee(expression);
|
|
53711
53711
|
const entity = this.entityMap.getNamedFunctionEntity(originalEntity);
|
|
@@ -53724,23 +53724,16 @@ var IrBuilderM = class {
|
|
|
53724
53724
|
}
|
|
53725
53725
|
case "variant-value-access": {
|
|
53726
53726
|
const originalEntity = meaning.field.entity;
|
|
53727
|
-
|
|
53728
|
-
if (originalEntity.subkind === "field") {
|
|
53729
|
-
receiver = this.createExplicitReceiver(originalEntity);
|
|
53730
|
-
}
|
|
53727
|
+
const receiver = this.createExplicitReceiver(originalEntity, this.getSourceLocation(expression));
|
|
53731
53728
|
const entity = this.entityMap.getVariableEntity(originalEntity);
|
|
53732
53729
|
const access = this.convertVariableAccess(meaning.access, originalEntity);
|
|
53733
53730
|
const type = this.entityMap.getType(meaning.field.getType());
|
|
53734
|
-
return
|
|
53731
|
+
return fieldAccessExpression(
|
|
53735
53732
|
receiver,
|
|
53736
53733
|
false,
|
|
53737
53734
|
accessedVariable(entity, type),
|
|
53738
53735
|
access,
|
|
53739
53736
|
this.getSourceLocation(expression)
|
|
53740
|
-
) : variableAccessExpression(
|
|
53741
|
-
accessedVariable(entity, type),
|
|
53742
|
-
access,
|
|
53743
|
-
this.getSourceLocation(expression)
|
|
53744
53737
|
);
|
|
53745
53738
|
}
|
|
53746
53739
|
case "package-alias-access":
|
|
@@ -53754,15 +53747,15 @@ var IrBuilderM = class {
|
|
|
53754
53747
|
Debug.never(meaning);
|
|
53755
53748
|
}
|
|
53756
53749
|
}
|
|
53757
|
-
createExplicitReceiver(entity) {
|
|
53750
|
+
createExplicitReceiver(entity, sourceLocation) {
|
|
53758
53751
|
let result;
|
|
53759
53752
|
if (entity.isStatic()) {
|
|
53760
53753
|
const typeOrExtensionEntity = this.entityMap.getTypeEntity(entity.getContainingType());
|
|
53761
|
-
result = typeAccessExpression(typeOrExtensionEntity);
|
|
53754
|
+
result = typeAccessExpression(typeOrExtensionEntity, sourceLocation);
|
|
53762
53755
|
} else {
|
|
53763
53756
|
const typeEntity = entity.getContainingType();
|
|
53764
53757
|
const type = this.entityMap.getType(this.analyzer.instantiateTypeByIdentitySubstitution(typeEntity));
|
|
53765
|
-
result = thisExpression(type);
|
|
53758
|
+
result = thisExpression(type, sourceLocation);
|
|
53766
53759
|
}
|
|
53767
53760
|
return result;
|
|
53768
53761
|
}
|
|
@@ -54017,10 +54010,12 @@ var IrBuilderM = class {
|
|
|
54017
54010
|
|
|
54018
54011
|
// source/emitter/IrToJs.ts
|
|
54019
54012
|
import { transformFromAstAsync } from "@babel/core";
|
|
54013
|
+
import generate from "@babel/generator";
|
|
54020
54014
|
import * as parser from "@babel/parser";
|
|
54021
54015
|
import decoratorsPlugin from "@babel/plugin-proposal-decorators";
|
|
54022
54016
|
import classPropertiesPlugin from "@babel/plugin-transform-class-properties";
|
|
54023
54017
|
import * as js from "@babel/types";
|
|
54018
|
+
import { addMapping, GenMapping, toEncodedMap } from "@jridgewell/gen-mapping";
|
|
54024
54019
|
var _IrToJs = class _IrToJs {
|
|
54025
54020
|
constructor(options) {
|
|
54026
54021
|
// Used by debugStack decorator.
|
|
@@ -54033,9 +54028,28 @@ var _IrToJs = class _IrToJs {
|
|
|
54033
54028
|
static {
|
|
54034
54029
|
this.customImportFunctionName = "_artelImport";
|
|
54035
54030
|
}
|
|
54036
|
-
|
|
54031
|
+
static {
|
|
54032
|
+
this.notMappedLocationFileName = "stub";
|
|
54033
|
+
}
|
|
54034
|
+
generate(pkg2) {
|
|
54037
54035
|
return __async(this, null, function* () {
|
|
54038
|
-
|
|
54036
|
+
const file2 = yield this.convertPackage(pkg2);
|
|
54037
|
+
const generatorOptions = {
|
|
54038
|
+
jsescOption: {
|
|
54039
|
+
minimal: true,
|
|
54040
|
+
indent: " "
|
|
54041
|
+
},
|
|
54042
|
+
sourceMaps: this.attachSourceLocation
|
|
54043
|
+
};
|
|
54044
|
+
const generated = generate(file2, generatorOptions);
|
|
54045
|
+
let map;
|
|
54046
|
+
if (this.attachSourceLocation && generated.map !== null && generated.rawMappings !== void 0) {
|
|
54047
|
+
map = this.removeStubMappingsFromSourceMap(generated.map, generated.rawMappings);
|
|
54048
|
+
}
|
|
54049
|
+
return {
|
|
54050
|
+
code: generated.code,
|
|
54051
|
+
map
|
|
54052
|
+
};
|
|
54039
54053
|
});
|
|
54040
54054
|
}
|
|
54041
54055
|
convertPackage(pkg2) {
|
|
@@ -54060,7 +54074,7 @@ var _IrToJs = class _IrToJs {
|
|
|
54060
54074
|
let result = js.file(js.program(statements));
|
|
54061
54075
|
this.addNodeLocation(result, pkg2);
|
|
54062
54076
|
if (this.usesDecorators) {
|
|
54063
|
-
const transformationResult = yield transformFromAstAsync(result,
|
|
54077
|
+
const transformationResult = yield transformFromAstAsync(result, "", {
|
|
54064
54078
|
plugins: [
|
|
54065
54079
|
[decoratorsPlugin, { legacy: true }],
|
|
54066
54080
|
[classPropertiesPlugin, { loose: true }]
|
|
@@ -54519,7 +54533,7 @@ var _IrToJs = class _IrToJs {
|
|
|
54519
54533
|
const callee = this.convertExpression(expression.expression);
|
|
54520
54534
|
const args = this.convertArguments(expression.args);
|
|
54521
54535
|
const optional = expression.isOptionalAccess;
|
|
54522
|
-
let result = js.optionalCallExpression(callee, args, optional);
|
|
54536
|
+
let result = optional || this.isOptionalChain(callee) ? js.optionalCallExpression(callee, args, optional) : js.callExpression(callee, args);
|
|
54523
54537
|
if (expression.isAsyncFunctionCall) {
|
|
54524
54538
|
result = js.awaitExpression(result);
|
|
54525
54539
|
}
|
|
@@ -54543,17 +54557,17 @@ var _IrToJs = class _IrToJs {
|
|
|
54543
54557
|
Debug.assertNotNull(argument2, "\u0412\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0438\u043D\u0434\u0435\u043A\u0441\u043D\u043E\u0433\u043E \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u0434\u043E\u043B\u0436\u043D\u043E \u0438\u043C\u0435\u0442\u044C \u043E\u0434\u0438\u043D \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442.");
|
|
54544
54558
|
const property = this.convertExpressionOrJsSpreadElement(argument2);
|
|
54545
54559
|
Debug.assert(!js.isSpreadElement(property), "\u0418\u043D\u0434\u0435\u043A\u0441 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u043C\u0430\u0441\u0441\u0438\u0432\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u044F\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435\u043C \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432.");
|
|
54546
|
-
const result = js.optionalMemberExpression(object, property, true, expression.isOptionalAccess);
|
|
54560
|
+
const result = expression.isOptionalAccess || this.isOptionalChain(object) ? js.optionalMemberExpression(object, property, true, expression.isOptionalAccess) : js.memberExpression(object, property, true);
|
|
54547
54561
|
this.addNodeLocation(result, expression);
|
|
54548
54562
|
return result;
|
|
54549
54563
|
}
|
|
54550
54564
|
convertIntegerLiteral(expression) {
|
|
54551
|
-
const result = js.
|
|
54565
|
+
const result = js.valueToNode(expression.value);
|
|
54552
54566
|
this.addNodeLocation(result, expression);
|
|
54553
54567
|
return result;
|
|
54554
54568
|
}
|
|
54555
54569
|
convertNumericLiteral(expression) {
|
|
54556
|
-
const result = js.
|
|
54570
|
+
const result = js.valueToNode(expression.value);
|
|
54557
54571
|
this.addNodeLocation(result, expression);
|
|
54558
54572
|
return result;
|
|
54559
54573
|
}
|
|
@@ -54635,7 +54649,7 @@ var _IrToJs = class _IrToJs {
|
|
|
54635
54649
|
return result;
|
|
54636
54650
|
}
|
|
54637
54651
|
convertBaseExpression(expression) {
|
|
54638
|
-
const result = js.super
|
|
54652
|
+
const result = js.identifier("super");
|
|
54639
54653
|
this.addNodeLocation(result, expression);
|
|
54640
54654
|
return result;
|
|
54641
54655
|
}
|
|
@@ -54737,7 +54751,7 @@ var _IrToJs = class _IrToJs {
|
|
|
54737
54751
|
computed = !js.isValidIdentifier(name);
|
|
54738
54752
|
property = computed ? js.stringLiteral(name) : js.identifier(name);
|
|
54739
54753
|
}
|
|
54740
|
-
const result = js.optionalMemberExpression(object, property, computed, expression.isOptionalAccess);
|
|
54754
|
+
const result = expression.isOptionalAccess || this.isOptionalChain(object) ? js.optionalMemberExpression(object, property, computed, expression.isOptionalAccess) : js.memberExpression(object, property, computed);
|
|
54741
54755
|
this.addNodeLocation(result, expression);
|
|
54742
54756
|
return result;
|
|
54743
54757
|
}
|
|
@@ -54753,7 +54767,7 @@ var _IrToJs = class _IrToJs {
|
|
|
54753
54767
|
computed = !js.isValidIdentifier(name);
|
|
54754
54768
|
property = computed ? js.stringLiteral(name) : js.identifier(name);
|
|
54755
54769
|
}
|
|
54756
|
-
const result = js.optionalMemberExpression(object, property, computed, expression.isOptionalAccess);
|
|
54770
|
+
const result = expression.isOptionalAccess || this.isOptionalChain(object) ? js.optionalMemberExpression(object, property, computed, expression.isOptionalAccess) : js.memberExpression(object, property, computed);
|
|
54757
54771
|
this.addNodeLocation(result, expression);
|
|
54758
54772
|
return result;
|
|
54759
54773
|
}
|
|
@@ -54824,7 +54838,7 @@ var _IrToJs = class _IrToJs {
|
|
|
54824
54838
|
convertJsIndexedAccessExpression(expression) {
|
|
54825
54839
|
const object = this.convertExpression(expression.expression);
|
|
54826
54840
|
const property = this.convertExpression(expression.argument);
|
|
54827
|
-
const result = js.optionalMemberExpression(object, property, true, expression.isOptionalAccess);
|
|
54841
|
+
const result = expression.isOptionalAccess || this.isOptionalChain(object) ? js.optionalMemberExpression(object, property, true, expression.isOptionalAccess) : js.memberExpression(object, property, true);
|
|
54828
54842
|
this.addNodeLocation(result, expression);
|
|
54829
54843
|
return result;
|
|
54830
54844
|
}
|
|
@@ -54875,7 +54889,7 @@ var _IrToJs = class _IrToJs {
|
|
|
54875
54889
|
const name = expression.name;
|
|
54876
54890
|
const computed = !js.isValidIdentifier(name);
|
|
54877
54891
|
const property = computed ? js.stringLiteral(name) : js.identifier(name);
|
|
54878
|
-
const result = js.optionalMemberExpression(object, property, computed, expression.isOptionalAccess);
|
|
54892
|
+
const result = expression.isOptionalAccess || this.isOptionalChain(object) ? js.optionalMemberExpression(object, property, computed, expression.isOptionalAccess) : js.memberExpression(object, property, computed);
|
|
54879
54893
|
this.addNodeLocation(result, expression);
|
|
54880
54894
|
return result;
|
|
54881
54895
|
}
|
|
@@ -55243,14 +55257,23 @@ var _IrToJs = class _IrToJs {
|
|
|
55243
55257
|
return result;
|
|
55244
55258
|
}
|
|
55245
55259
|
addNodeLocation(jsNode, irNode) {
|
|
55246
|
-
if (this.attachSourceLocation
|
|
55247
|
-
|
|
55248
|
-
|
|
55249
|
-
|
|
55250
|
-
|
|
55251
|
-
|
|
55252
|
-
|
|
55253
|
-
|
|
55260
|
+
if (this.attachSourceLocation) {
|
|
55261
|
+
if (irNode.sourceLocation !== void 0) {
|
|
55262
|
+
const sourceLocation = irNode.sourceLocation;
|
|
55263
|
+
jsNode.loc = {
|
|
55264
|
+
start: { line: sourceLocation.start.line + 1, column: sourceLocation.start.character, index: 0 },
|
|
55265
|
+
end: { line: sourceLocation.end.line + 1, column: sourceLocation.end.character, index: 0 },
|
|
55266
|
+
filename: sourceLocation.sourceFileUri.toString(),
|
|
55267
|
+
identifierName: void 0
|
|
55268
|
+
};
|
|
55269
|
+
} else {
|
|
55270
|
+
jsNode.loc = {
|
|
55271
|
+
start: { line: 0, column: 0, index: 0 },
|
|
55272
|
+
end: { line: 0, column: 0, index: 0 },
|
|
55273
|
+
filename: _IrToJs.notMappedLocationFileName,
|
|
55274
|
+
identifierName: void 0
|
|
55275
|
+
};
|
|
55276
|
+
}
|
|
55254
55277
|
}
|
|
55255
55278
|
}
|
|
55256
55279
|
getEntityName(entity) {
|
|
@@ -55277,6 +55300,21 @@ var _IrToJs = class _IrToJs {
|
|
|
55277
55300
|
isLValue(node) {
|
|
55278
55301
|
return js.isLVal(node) || js.isOptionalMemberExpression(node);
|
|
55279
55302
|
}
|
|
55303
|
+
isOptionalChain(expression) {
|
|
55304
|
+
return js.isOptionalMemberExpression(expression) || js.isOptionalCallExpression(expression) || js.isOptionalIndexedAccessType(expression);
|
|
55305
|
+
}
|
|
55306
|
+
removeStubMappingsFromSourceMap(map, rawMappings) {
|
|
55307
|
+
const genMapping = new GenMapping({
|
|
55308
|
+
file: map.file,
|
|
55309
|
+
sourceRoot: map.sourceRoot
|
|
55310
|
+
});
|
|
55311
|
+
for (const mapping of rawMappings) {
|
|
55312
|
+
if (mapping.source !== _IrToJs.notMappedLocationFileName) {
|
|
55313
|
+
addMapping(genMapping, mapping);
|
|
55314
|
+
}
|
|
55315
|
+
}
|
|
55316
|
+
return toEncodedMap(genMapping);
|
|
55317
|
+
}
|
|
55280
55318
|
};
|
|
55281
55319
|
__decorateClass([
|
|
55282
55320
|
debugStack()
|
|
@@ -55720,15 +55758,8 @@ var Emitter = class _Emitter {
|
|
|
55720
55758
|
attachSourceLocation: this.options?.sourceMap !== void 0,
|
|
55721
55759
|
entityNameOverrides: nameOverrides
|
|
55722
55760
|
};
|
|
55723
|
-
const
|
|
55724
|
-
|
|
55725
|
-
jsescOption: {
|
|
55726
|
-
minimal: true,
|
|
55727
|
-
indent: " "
|
|
55728
|
-
},
|
|
55729
|
-
sourceMaps: this.options?.sourceMap !== void 0
|
|
55730
|
-
};
|
|
55731
|
-
return new CodeGenerator(file2, generatorOptions).generate();
|
|
55761
|
+
const irToJs = new IrToJs(config);
|
|
55762
|
+
return yield irToJs.generate(pkg2);
|
|
55732
55763
|
});
|
|
55733
55764
|
}
|
|
55734
55765
|
generateCodeAndSourceMaps(pkg2) {
|
|
@@ -55736,8 +55767,8 @@ var Emitter = class _Emitter {
|
|
|
55736
55767
|
const generated = yield this.generateCode(pkg2.ir, pkg2.entityNameOverrides);
|
|
55737
55768
|
let code = generated.code;
|
|
55738
55769
|
let linkedSourceMaps;
|
|
55739
|
-
if (generated.map !==
|
|
55740
|
-
this.prepareSourceMap(pkg2.outputUri, generated);
|
|
55770
|
+
if (generated.map !== void 0) {
|
|
55771
|
+
this.prepareSourceMap(pkg2.outputUri, generated.map);
|
|
55741
55772
|
const sourceMapJson = JSON.stringify(generated.map);
|
|
55742
55773
|
const sourceMapMode = this.options?.sourceMap?.mode ?? "linked" /* Linked */;
|
|
55743
55774
|
if (sourceMapMode === "inline" /* Inline */) {
|
|
@@ -55757,29 +55788,33 @@ var Emitter = class _Emitter {
|
|
|
55757
55788
|
return { code, linkedSourceMaps };
|
|
55758
55789
|
});
|
|
55759
55790
|
}
|
|
55760
|
-
prepareSourceMap(outputPackageUri,
|
|
55761
|
-
|
|
55762
|
-
if (map !== null && map.sources.length > 0) {
|
|
55791
|
+
prepareSourceMap(outputPackageUri, map) {
|
|
55792
|
+
if (map.sources.length > 0) {
|
|
55763
55793
|
const useAbsolutePaths = this.options?.sourceMap?.useAbsolutePaths ?? false;
|
|
55764
55794
|
const includeSourcesContent = this.options?.sourceMap?.includeSourcesContent ?? false;
|
|
55765
|
-
|
|
55766
|
-
|
|
55767
|
-
}
|
|
55795
|
+
const sources = Array.from(map.sources);
|
|
55796
|
+
const sourceContents = includeSourcesContent ? new Array(map.sources.length).fill(null) : void 0;
|
|
55768
55797
|
for (let i = 0, n = map.sources.length; i < n; i++) {
|
|
55769
55798
|
const sourceUriString = map.sources[i];
|
|
55770
|
-
|
|
55771
|
-
|
|
55772
|
-
|
|
55773
|
-
|
|
55774
|
-
|
|
55775
|
-
|
|
55776
|
-
|
|
55777
|
-
|
|
55778
|
-
|
|
55779
|
-
|
|
55799
|
+
if (sourceUriString !== null) {
|
|
55800
|
+
const sourceUri = Uri.fromString(sourceUriString);
|
|
55801
|
+
if (useAbsolutePaths) {
|
|
55802
|
+
sources[i] = sourceUri.segments.join("/");
|
|
55803
|
+
} else {
|
|
55804
|
+
sources[i] = getImportPath(outputPackageUri, sourceUri);
|
|
55805
|
+
}
|
|
55806
|
+
if (sourceContents !== void 0) {
|
|
55807
|
+
const content = this.ectx.analyzer.compilation.getSourceFileByUri(sourceUri)?.getSourceText();
|
|
55808
|
+
if (content !== void 0) {
|
|
55809
|
+
sourceContents[i] = content;
|
|
55810
|
+
}
|
|
55780
55811
|
}
|
|
55781
55812
|
}
|
|
55782
55813
|
}
|
|
55814
|
+
map.sources = sources;
|
|
55815
|
+
if (sourceContents !== void 0) {
|
|
55816
|
+
map.sourcesContent = sourceContents;
|
|
55817
|
+
}
|
|
55783
55818
|
}
|
|
55784
55819
|
}
|
|
55785
55820
|
};
|
|
@@ -102631,12 +102666,12 @@ var Analyzer2 = class extends Analyzer {
|
|
|
102631
102666
|
} else {
|
|
102632
102667
|
const enumerableEntity = this.originalWellKnownDeclarationsA.enumerable;
|
|
102633
102668
|
let implementedEnumerableAspect;
|
|
102634
|
-
|
|
102635
|
-
|
|
102669
|
+
const unaliasedType = type.unaliasAndGetExtendedType();
|
|
102670
|
+
if (unaliasedType.entity?.originalEntity === enumerableEntity) {
|
|
102636
102671
|
Debug.assert(unaliasedType.kind === "structured");
|
|
102637
102672
|
implementedEnumerableAspect = unaliasedType;
|
|
102638
102673
|
} else {
|
|
102639
|
-
implementedEnumerableAspect = Query.from(this.typeUtils.allAspectsOfType(
|
|
102674
|
+
implementedEnumerableAspect = Query.from(this.typeUtils.allAspectsOfType(unaliasedType)).first((t) => t.unalias().entity?.originalEntity === enumerableEntity);
|
|
102640
102675
|
}
|
|
102641
102676
|
if (implementedEnumerableAspect !== void 0) {
|
|
102642
102677
|
const parameter = enumerableEntity.getTypeParameters()[0];
|
|
@@ -113115,12 +113150,12 @@ var Analyzer3 = class extends Analyzer {
|
|
|
113115
113150
|
} else {
|
|
113116
113151
|
const enumerableEntity = this.originalWellKnownDeclarationsA.enumerable;
|
|
113117
113152
|
let implementedEnumerableAspect;
|
|
113118
|
-
|
|
113119
|
-
|
|
113153
|
+
const unaliasedType = type.unaliasAndGetExtendedType();
|
|
113154
|
+
if (unaliasedType.entity?.originalEntity === enumerableEntity) {
|
|
113120
113155
|
Debug.assert(unaliasedType.kind === "structured");
|
|
113121
113156
|
implementedEnumerableAspect = unaliasedType;
|
|
113122
113157
|
} else {
|
|
113123
|
-
implementedEnumerableAspect = Query.from(this.typeUtils.allAspectsOfType(
|
|
113158
|
+
implementedEnumerableAspect = Query.from(this.typeUtils.allAspectsOfType(unaliasedType)).first((t) => t.unalias().entity?.originalEntity === enumerableEntity);
|
|
113124
113159
|
}
|
|
113125
113160
|
if (implementedEnumerableAspect !== void 0) {
|
|
113126
113161
|
const parameter = enumerableEntity.getTypeParameters()[0];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EncodedSourceMap } from '@jridgewell/gen-mapping';
|
|
2
2
|
import { DebugStack } from './DebugStack.js';
|
|
3
3
|
import { Entity } from './Entities.js';
|
|
4
4
|
import * as ir from './ir/index.js';
|
|
@@ -23,15 +23,20 @@ export declare namespace ImportEmitMode {
|
|
|
23
23
|
readonly emitOnlyCustomImport: boolean;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
export interface IrToJsResult {
|
|
27
|
+
code: string;
|
|
28
|
+
map: EncodedSourceMap | undefined;
|
|
29
|
+
}
|
|
26
30
|
export declare class IrToJs {
|
|
27
31
|
static readonly customImportFunctionName = "_artelImport";
|
|
32
|
+
static readonly notMappedLocationFileName = "stub";
|
|
28
33
|
protected readonly debugStack: DebugStack;
|
|
29
34
|
private readonly importMode;
|
|
30
35
|
private readonly entityNameOverrides;
|
|
31
36
|
private readonly attachSourceLocation;
|
|
32
37
|
private usesDecorators;
|
|
33
38
|
constructor(options?: IrToJsOptions);
|
|
34
|
-
|
|
39
|
+
generate(pkg: ir.Package): Promise<IrToJsResult>;
|
|
35
40
|
private convertPackage;
|
|
36
41
|
private convertPackageMemberDeclaration;
|
|
37
42
|
private convertEsModuleImportDirectiveStatement;
|
|
@@ -123,4 +128,6 @@ export declare class IrToJs {
|
|
|
123
128
|
private getEntityName;
|
|
124
129
|
private convertArrayWithErrorBoundary;
|
|
125
130
|
private isLValue;
|
|
131
|
+
private isOptionalChain;
|
|
132
|
+
private removeStubMappingsFromSourceMap;
|
|
126
133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artel/artc",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.26048-pre-release",
|
|
4
4
|
"description": "Артель Компилятор | Artel Compiler",
|
|
5
5
|
"author": "Nezaboodka Team <contact@nezaboodka.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,19 +36,24 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@babel/core": "
|
|
40
|
-
"@babel/generator": "
|
|
41
|
-
"@babel/parser": "
|
|
42
|
-
"@babel/plugin-proposal-decorators": "
|
|
43
|
-
"@babel/plugin-transform-class-properties": "
|
|
44
|
-
"@babel/types": "
|
|
39
|
+
"@babel/core": "8.0.1",
|
|
40
|
+
"@babel/generator": "8.0.0",
|
|
41
|
+
"@babel/parser": "8.0.4",
|
|
42
|
+
"@babel/plugin-proposal-decorators": "8.0.2",
|
|
43
|
+
"@babel/plugin-transform-class-properties": "8.0.1",
|
|
44
|
+
"@babel/types": "8.0.4",
|
|
45
|
+
"@jridgewell/gen-mapping": "0.3.13",
|
|
46
|
+
"@swc/core": "1.11.8",
|
|
47
|
+
"@swc/jest": "0.2.37",
|
|
48
|
+
"@types/jest": "29.5.14",
|
|
45
49
|
"@vscode/l10n": "0.0.18",
|
|
50
|
+
"jest": "29.7.0",
|
|
46
51
|
"jsonc-parser": "3.3.1",
|
|
47
52
|
"reactronic": "^0.96.26029",
|
|
48
53
|
"typescript": "5.9.3",
|
|
49
54
|
"vscode-json-languageservice": "5.4.2",
|
|
50
|
-
"vscode-languageserver": "10.1.0",
|
|
51
55
|
"vscode-languageserver-textdocument": "1.0.12",
|
|
56
|
+
"vscode-languageserver": "10.1.0",
|
|
52
57
|
"vscode-uri": "3.0.8"
|
|
53
58
|
},
|
|
54
59
|
"devDependencies": {
|