@dbml/parse 8.0.0-alpha.0 → 8.0.0-alpha.10
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/dist/dbml-parse.js +21 -25
- package/dist/dbml-parse.mjs +478 -339
- package/dist/src/compiler/index.d.ts +12 -8
- package/dist/src/compiler/projectLayout/layout.d.ts +2 -6
- package/dist/src/compiler/queries/container/index.d.ts +5 -5
- package/dist/src/compiler/queries/files/reachableFiles.d.ts +1 -0
- package/dist/src/compiler/queries/files/usableMembers.d.ts +5 -3
- package/dist/src/compiler/queries/pipeline/index.d.ts +2 -2
- package/dist/src/compiler/queries/resolutionIndex.d.ts +2 -0
- package/dist/src/compiler/queries/transform/index.d.ts +3 -3
- package/dist/src/compiler/queries/transform/renameTable.d.ts +4 -6
- package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +1 -1
- package/dist/src/core/global_modules/records/utils/data/values.d.ts +1 -1
- package/dist/src/core/global_modules/records/utils/index.d.ts +1 -0
- package/dist/src/core/local_modules/types.d.ts +1 -1
- package/dist/src/core/parser/parser.d.ts +2 -0
- package/dist/src/core/types/internable.d.ts +0 -12
- package/dist/src/core/types/module.d.ts +2 -1
- package/dist/src/core/types/symbol/index.d.ts +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/services/index.d.ts +2 -2
- package/dist/src/services/monarch.d.ts +1 -1
- package/dist/src/services/suggestions/utils/useMerger.d.ts +2 -1
- package/dist/src/services/types.d.ts +1 -1
- package/package.json +4 -3
- /package/dist/src/core/global_modules/{program → records}/utils/constraints/fk.d.ts +0 -0
- /package/dist/src/core/global_modules/{program → records}/utils/constraints/helper.d.ts +0 -0
- /package/dist/src/core/global_modules/{program → records}/utils/constraints/index.d.ts +0 -0
- /package/dist/src/core/global_modules/{program → records}/utils/constraints/pk.d.ts +0 -0
- /package/dist/src/core/global_modules/{program → records}/utils/constraints/unique.d.ts +0 -0
package/dist/dbml-parse.mjs
CHANGED
|
@@ -1010,6 +1010,10 @@ function baseUniq(r, j, M) {
|
|
|
1010
1010
|
return L;
|
|
1011
1011
|
}
|
|
1012
1012
|
var _baseUniq_default = baseUniq;
|
|
1013
|
+
function uniq(r) {
|
|
1014
|
+
return r && r.length ? _baseUniq_default(r) : [];
|
|
1015
|
+
}
|
|
1016
|
+
var uniq_default = uniq;
|
|
1013
1017
|
function uniqBy(r, j) {
|
|
1014
1018
|
return r && r.length ? _baseUniq_default(r, _baseIteratee_default(j, 2)) : [];
|
|
1015
1019
|
}
|
|
@@ -1257,13 +1261,13 @@ var isAbsolute = function(r) {
|
|
|
1257
1261
|
function resolveImportFilepath(r, j) {
|
|
1258
1262
|
if (!Filepath.isRelative(j)) return;
|
|
1259
1263
|
let M = Filepath.resolve(r.dirname, j);
|
|
1260
|
-
return M.absolute.endsWith(".dbml") ? M : Filepath.from(M.absolute +
|
|
1264
|
+
return M.absolute.endsWith(".dbml") ? M : Filepath.from(M.absolute + ".dbml");
|
|
1261
1265
|
}
|
|
1262
1266
|
const KEYWORDS_OF_DEFAULT_SETTING = [
|
|
1263
1267
|
"null",
|
|
1264
1268
|
"true",
|
|
1265
1269
|
"false"
|
|
1266
|
-
],
|
|
1270
|
+
], NUMERIC_LITERAL_PREFIX = ["-", "+"], DEFAULT_SCHEMA_NAME = "public", DEFAULT_ENTRY = Filepath.from("/main.dbml");
|
|
1267
1271
|
let CompileErrorCode = /* @__PURE__ */ function(r) {
|
|
1268
1272
|
return r[r.UNKNOWN_SYMBOL = 1e3] = "UNKNOWN_SYMBOL", r[r.UNEXPECTED_SYMBOL = 1001] = "UNEXPECTED_SYMBOL", r[r.UNEXPECTED_EOF = 1002] = "UNEXPECTED_EOF", r[r.UNEXPECTED_NEWLINE = 1003] = "UNEXPECTED_NEWLINE", r[r.UNKNOWN_TOKEN = 1004] = "UNKNOWN_TOKEN", r[r.UNEXPECTED_TOKEN = 1005] = "UNEXPECTED_TOKEN", r[r.UNEXPECTED_ELEMENT_DECLARATION = 1006] = "UNEXPECTED_ELEMENT_DECLARATION", r[r.MISSING_SPACES = 1007] = "MISSING_SPACES", r[r.UNKNOWN_PREFIX_OP = 1008] = "UNKNOWN_PREFIX_OP", r[r.INVALID_OPERAND = 1009] = "INVALID_OPERAND", r[r.EMPTY_ATTRIBUTE_NAME = 1010] = "EMPTY_ATTRIBUTE_NAME", r[r.INVALID_ESCAPE_SEQUENCE = 1011] = "INVALID_ESCAPE_SEQUENCE", r[r.INVALID_NAME = 3e3] = "INVALID_NAME", r[r.UNEXPECTED_NAME = 3001] = "UNEXPECTED_NAME", r[r.NAME_NOT_FOUND = 3002] = "NAME_NOT_FOUND", r[r.DUPLICATE_NAME = 3003] = "DUPLICATE_NAME", r[r.INVALID_ALIAS = 3004] = "INVALID_ALIAS", r[r.UNEXPECTED_ALIAS = 3005] = "UNEXPECTED_ALIAS", r[r.UNEXPECTED_SETTINGS = 3006] = "UNEXPECTED_SETTINGS", r[r.INVALID_SETTINGS = 3007] = "INVALID_SETTINGS", r[r.UNEXPECTED_SIMPLE_BODY = 3008] = "UNEXPECTED_SIMPLE_BODY", r[r.UNEXPECTED_COMPLEX_BODY = 3009] = "UNEXPECTED_COMPLEX_BODY", r[r.INVALID_TABLE_CONTEXT = 3010] = "INVALID_TABLE_CONTEXT", r[r.UNKNOWN_TABLE_SETTING = 3011] = "UNKNOWN_TABLE_SETTING", r[r.DUPLICATE_TABLE_SETTING = 3012] = "DUPLICATE_TABLE_SETTING", r[r.INVALID_TABLEGROUP_CONTEXT = 3013] = "INVALID_TABLEGROUP_CONTEXT", r[r.INVALID_TABLEGROUP_ELEMENT_NAME = 3014] = "INVALID_TABLEGROUP_ELEMENT_NAME", r[r.DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3015] = "DUPLICATE_TABLEGROUP_ELEMENT_NAME", r[r.DUPLICATE_TABLEGROUP_FIELD_NAME = 3016] = "DUPLICATE_TABLEGROUP_FIELD_NAME", r[r.INVALID_TABLEGROUP_FIELD = 3017] = "INVALID_TABLEGROUP_FIELD", r[r.EMPTY_TABLE = 3018] = "EMPTY_TABLE", r[r.INVALID_COLUMN = 3019] = "INVALID_COLUMN", r[r.INVALID_COLUMN_NAME = 3020] = "INVALID_COLUMN_NAME", r[r.UNKNOWN_COLUMN_SETTING = 3021] = "UNKNOWN_COLUMN_SETTING", r[r.INVALID_COLUMN_TYPE = 3022] = "INVALID_COLUMN_TYPE", r[r.DUPLICATE_COLUMN_NAME = 3023] = "DUPLICATE_COLUMN_NAME", r[r.DUPLICATE_COLUMN_SETTING = 3024] = "DUPLICATE_COLUMN_SETTING", r[r.INVALID_COLUMN_SETTING_VALUE = 3025] = "INVALID_COLUMN_SETTING_VALUE", r[r.INVALID_ENUM_CONTEXT = 3026] = "INVALID_ENUM_CONTEXT", r[r.INVALID_ENUM_ELEMENT_NAME = 3027] = "INVALID_ENUM_ELEMENT_NAME", r[r.INVALID_ENUM_ELEMENT = 3028] = "INVALID_ENUM_ELEMENT", r[r.DUPLICATE_ENUM_ELEMENT_NAME = 3029] = "DUPLICATE_ENUM_ELEMENT_NAME", r[r.UNKNOWN_ENUM_ELEMENT_SETTING = 3030] = "UNKNOWN_ENUM_ELEMENT_SETTING", r[r.DUPLICATE_ENUM_ELEMENT_SETTING = 3031] = "DUPLICATE_ENUM_ELEMENT_SETTING", r[r.INVALID_ENUM_ELEMENT_SETTING = 3032] = "INVALID_ENUM_ELEMENT_SETTING", r[r.EMPTY_ENUM = 3033] = "EMPTY_ENUM", r[r.INVALID_REF_CONTEXT = 3034] = "INVALID_REF_CONTEXT", r[r.UNKNOWN_REF_SETTING = 3035] = "UNKNOWN_REF_SETTING", r[r.DUPLICATE_REF_SETTING = 3036] = "DUPLICATE_REF_SETTING", r[r.INVALID_REF_SETTING_VALUE = 3037] = "INVALID_REF_SETTING_VALUE", r[r.INVALID_REF_RELATIONSHIP = 3038] = "INVALID_REF_RELATIONSHIP", r[r.INVALID_REF_FIELD = 3039] = "INVALID_REF_FIELD", r[r.EMPTY_REF = 3040] = "EMPTY_REF", r[r.REF_REDEFINED = 3041] = "REF_REDEFINED", r[r.INVALID_NOTE_CONTEXT = 3042] = "INVALID_NOTE_CONTEXT", r[r.INVALID_NOTE = 3043] = "INVALID_NOTE", r[r.NOTE_REDEFINED = 3044] = "NOTE_REDEFINED", r[r.NOTE_CONTENT_REDEFINED = 3045] = "NOTE_CONTENT_REDEFINED", r[r.EMPTY_NOTE = 3046] = "EMPTY_NOTE", r[r.INVALID_INDEXES_CONTEXT = 3047] = "INVALID_INDEXES_CONTEXT", r[r.INVALID_INDEXES_FIELD = 3048] = "INVALID_INDEXES_FIELD", r[r.INVALID_INDEX = 3049] = "INVALID_INDEX", r[r.UNKNOWN_INDEX_SETTING = 3050] = "UNKNOWN_INDEX_SETTING", r[r.DUPLICATE_INDEX_SETTING = 3051] = "DUPLICATE_INDEX_SETTING", r[r.UNEXPECTED_INDEX_SETTING_VALUE = 3052] = "UNEXPECTED_INDEX_SETTING_VALUE", r[r.INVALID_INDEX_SETTING_VALUE = 3053] = "INVALID_INDEX_SETTING_VALUE", r[r.INVALID_PROJECT_CONTEXT = 3054] = "INVALID_PROJECT_CONTEXT", r[r.PROJECT_REDEFINED = 3055] = "PROJECT_REDEFINED", r[r.INVALID_PROJECT_FIELD = 3056] = "INVALID_PROJECT_FIELD", r[r.INVALID_CUSTOM_CONTEXT = 3057] = "INVALID_CUSTOM_CONTEXT", r[r.INVALID_CUSTOM_ELEMENT_VALUE = 3058] = "INVALID_CUSTOM_ELEMENT_VALUE", r[r.INVALID_ELEMENT_IN_SIMPLE_BODY = 3059] = "INVALID_ELEMENT_IN_SIMPLE_BODY", r[r.INVALID_TABLE_PARTIAL_CONTEXT = 3060] = "INVALID_TABLE_PARTIAL_CONTEXT", r[r.INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3061] = "INVALID_TABLE_PARTIAL_ELEMENT_NAME", r[r.INVALID_TABLE_PARTIAL_SETTING_VALUE = 3062] = "INVALID_TABLE_PARTIAL_SETTING_VALUE", r[r.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3063] = "DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME", r[r.DUPLICATE_TABLE_PARTIAL_SETTING = 3064] = "DUPLICATE_TABLE_PARTIAL_SETTING", r[r.INVALID_TABLE_PARTIAL_INJECTION = 3065] = "INVALID_TABLE_PARTIAL_INJECTION", r[r.INVALID_TABLE_PARTIAL_INJECTION_OP = 3066] = "INVALID_TABLE_PARTIAL_INJECTION_OP", r[r.INVALID_TABLE_PARTIAL_INJECTION_NAME = 3067] = "INVALID_TABLE_PARTIAL_INJECTION_NAME", r[r.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068] = "DUPLICATE_TABLE_PARTIAL_INJECTION_NAME", r[r.UNKNOWN_TABLE_PARTIAL_SETTING = 3069] = "UNKNOWN_TABLE_PARTIAL_SETTING", r[r.INVALID_TABLE_SETTING_VALUE = 3070] = "INVALID_TABLE_SETTING_VALUE", r[r.INVALID_CHECKS_CONTEXT = 3071] = "INVALID_CHECKS_CONTEXT", r[r.INVALID_CHECKS_FIELD = 3072] = "INVALID_CHECKS_FIELD", r[r.INVALID_CHECK = 3073] = "INVALID_CHECK", r[r.UNKNOWN_CHECK_SETTING = 3074] = "UNKNOWN_CHECK_SETTING", r[r.DUPLICATE_CHECK_SETTING = 3075] = "DUPLICATE_CHECK_SETTING", r[r.INVALID_CHECK_SETTING_VALUE = 3076] = "INVALID_CHECK_SETTING_VALUE", r[r.INVALID_RECORDS_CONTEXT = 3077] = "INVALID_RECORDS_CONTEXT", r[r.INVALID_RECORDS_NAME = 3078] = "INVALID_RECORDS_NAME", r[r.INVALID_RECORDS_FIELD = 3079] = "INVALID_RECORDS_FIELD", r[r.DUPLICATE_COLUMN_REFERENCES_IN_RECORDS = 3080] = "DUPLICATE_COLUMN_REFERENCES_IN_RECORDS", r[r.DUPLICATE_RECORDS_FOR_TABLE = 3081] = "DUPLICATE_RECORDS_FOR_TABLE", r[r.INVALID_USE_CONTEXT = 3082] = "INVALID_USE_CONTEXT", r[r.INVALID_USE_SPECIFIER_KIND = 3083] = "INVALID_USE_SPECIFIER_KIND", r[r.INVALID_USE_SPECIFIER_NAME = 3084] = "INVALID_USE_SPECIFIER_NAME", r[r.INVALID_DIAGRAMVIEW_CONTEXT = 3085] = "INVALID_DIAGRAMVIEW_CONTEXT", r[r.DUPLICATE_DIAGRAMVIEW_NAME = 3086] = "DUPLICATE_DIAGRAMVIEW_NAME", r[r.INVALID_DIAGRAMVIEW_FIELD = 3087] = "INVALID_DIAGRAMVIEW_FIELD", r[r.DUPLICATE_DIAGRAMVIEW_FIELD = 3088] = "DUPLICATE_DIAGRAMVIEW_FIELD", r[r.BINDING_ERROR = 4e3] = "BINDING_ERROR", r[r.NONEXISTENT_MODULE = 4001] = "NONEXISTENT_MODULE", r[r.UNSUPPORTED = 5e3] = "UNSUPPORTED", r[r.CIRCULAR_REF = 5001] = "CIRCULAR_REF", r[r.SAME_ENDPOINT = 5002] = "SAME_ENDPOINT", r[r.UNEQUAL_FIELDS_BINARY_REF = 5003] = "UNEQUAL_FIELDS_BINARY_REF", r[r.CONFLICTING_SETTING = 5004] = "CONFLICTING_SETTING", r[r.TABLE_REAPPEAR_IN_TABLEGROUP = 5005] = "TABLE_REAPPEAR_IN_TABLEGROUP", r;
|
|
1269
1273
|
}({});
|
|
@@ -1310,6 +1314,9 @@ function isValidAlias(r) {
|
|
|
1310
1314
|
function isSimpleName(r) {
|
|
1311
1315
|
return r instanceof PrimaryExpressionNode && r.expression instanceof VariableNode;
|
|
1312
1316
|
}
|
|
1317
|
+
function hasSimpleBody(r) {
|
|
1318
|
+
return !!r.bodyColon;
|
|
1319
|
+
}
|
|
1313
1320
|
function isValidPartialInjection(r) {
|
|
1314
1321
|
return r instanceof PrefixExpressionNode && r.op?.value === "~" && isExpressionAVariableNode(r.expression);
|
|
1315
1322
|
}
|
|
@@ -1504,7 +1511,7 @@ function destructureIndexNode(r) {
|
|
|
1504
1511
|
};
|
|
1505
1512
|
}
|
|
1506
1513
|
function extractQuotedStringToken(r) {
|
|
1507
|
-
if (isExpressionAQuotedString(r)) return r
|
|
1514
|
+
if (isExpressionAQuotedString(r)) return r.expression instanceof VariableNode ? r?.expression?.variable?.value : r.expression.literal.value;
|
|
1508
1515
|
}
|
|
1509
1516
|
function extractNumericLiteral(r) {
|
|
1510
1517
|
return r instanceof PrimaryExpressionNode && r.expression instanceof LiteralNode && r.expression.literal?.kind === SyntaxTokenKind.NUMERIC_LITERAL ? Number(r.expression.literal.value) : null;
|
|
@@ -2797,7 +2804,9 @@ var DiagramViewBinder = class {
|
|
|
2797
2804
|
let [j] = partition_default(r.body, (r) => r instanceof FunctionApplicationNode);
|
|
2798
2805
|
return j.flatMap((r) => !r.callee || isWildcardExpression(r.callee) ? [] : [r.callee, ...r.args].flatMap(scanNonListNodeForBinding).flatMap((r) => {
|
|
2799
2806
|
let j = r.variables.pop();
|
|
2800
|
-
|
|
2807
|
+
if (!j) return [];
|
|
2808
|
+
let M = r.variables.pop();
|
|
2809
|
+
return [...M ? this.compiler.nodeReferee(M).getErrors() : [], ...this.compiler.nodeReferee(j).getErrors()];
|
|
2801
2810
|
}));
|
|
2802
2811
|
}
|
|
2803
2812
|
bindNoteReferences(r) {
|
|
@@ -3246,7 +3255,7 @@ const indexesModule$1 = {
|
|
|
3246
3255
|
let z = isExpressionAVariableNode(F) ? F.expression.variable?.value ?? "" : "", B = P.lookupMembers(R, SymbolKind.Column, z);
|
|
3247
3256
|
if (B) return Report.create(B);
|
|
3248
3257
|
let V = isElementNode(L, ElementKind.TablePartial) ? "TablePartial" : "Table";
|
|
3249
|
-
return new Report(void 0, [new CompileError(CompileErrorCode.
|
|
3258
|
+
return new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Column '${z}' does not exist in ${V} 'public.${R.name}'`, F)]);
|
|
3250
3259
|
},
|
|
3251
3260
|
bindNode(j, P) {
|
|
3252
3261
|
return isElementNode(P, ElementKind.Indexes) ? Report.create(void 0, new IndexesBinder(j, P).bind()) : Report.create(PASS_THROUGH);
|
|
@@ -7350,11 +7359,15 @@ var ProgramInterpreter = class {
|
|
|
7350
7359
|
let P = N.getValue();
|
|
7351
7360
|
P && this.pushElement(M, P);
|
|
7352
7361
|
}
|
|
7353
|
-
let r = this.compiler.symbolMembers(this.programSymbol).getFiltered(UNHANDLED) ?? [];
|
|
7354
|
-
for (let
|
|
7355
|
-
if (!(
|
|
7356
|
-
let
|
|
7357
|
-
for (let j of
|
|
7362
|
+
let r = /* @__PURE__ */ new Set(), M = this.compiler.symbolMembers(this.programSymbol).getFiltered(UNHANDLED) ?? [];
|
|
7363
|
+
for (let N of M) {
|
|
7364
|
+
if (!(N instanceof SchemaSymbol)) continue;
|
|
7365
|
+
let M = this.compiler.symbolMembers(N).getFiltered(UNHANDLED) ?? [];
|
|
7366
|
+
for (let j of M) {
|
|
7367
|
+
if (!(j instanceof UseSymbol)) continue;
|
|
7368
|
+
let M = j.originalSymbol.intern();
|
|
7369
|
+
r.has(M) || (r.add(M), this.interpretUseSymbol(j));
|
|
7370
|
+
}
|
|
7358
7371
|
}
|
|
7359
7372
|
}
|
|
7360
7373
|
interpretUseSymbol(r) {
|
|
@@ -7558,24 +7571,16 @@ const programModule$1 = {
|
|
|
7558
7571
|
},
|
|
7559
7572
|
symbolMembers(N, P) {
|
|
7560
7573
|
if (!P.isKind(SymbolKind.Program)) return Report.create(PASS_THROUGH);
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
let I = new Map([[DEFAULT_SCHEMA_NAME, N.symbolFactory.create(SchemaSymbol, { name: DEFAULT_SCHEMA_NAME }, P.filepath)]]);
|
|
7564
|
-
for (let r of F.declarations) {
|
|
7565
|
-
let M = N.nodeFullname(r).getFiltered(UNHANDLED) || [], F = M.length <= 1 ? DEFAULT_SCHEMA_NAME : M[0];
|
|
7566
|
-
I.has(F) || I.set(F, N.symbolFactory.create(SchemaSymbol, { name: F }, P.filepath));
|
|
7567
|
-
}
|
|
7574
|
+
if (!(P.declaration instanceof ProgramNode)) return Report.create([]);
|
|
7575
|
+
let F = /* @__PURE__ */ new Map();
|
|
7568
7576
|
for (let r of N.reachableFiles(P.filepath)) {
|
|
7569
7577
|
let { schemaMembers: j } = N.usableMembers(r).getValue();
|
|
7570
|
-
for (let r of j)
|
|
7571
|
-
let { name: j } = r;
|
|
7572
|
-
I.has(j) || I.set(j, N.symbolFactory.create(SchemaSymbol, { name: j }, P.filepath));
|
|
7573
|
-
}
|
|
7578
|
+
for (let r of j) F.has(r.name) || F.set(r.name, r);
|
|
7574
7579
|
}
|
|
7575
|
-
let
|
|
7576
|
-
if (!
|
|
7577
|
-
let
|
|
7578
|
-
return
|
|
7580
|
+
let I = F.get(DEFAULT_SCHEMA_NAME);
|
|
7581
|
+
if (!I) return Report.create([...F.values()]);
|
|
7582
|
+
let L = N.symbolMembers(I).getFiltered(UNHANDLED)?.filter((r) => !r.isKind(SymbolKind.Schema));
|
|
7583
|
+
return L ? Report.create([...F.values(), ...L]) : Report.create([...F.values()]);
|
|
7579
7584
|
},
|
|
7580
7585
|
bindNode(j, N) {
|
|
7581
7586
|
return isProgramNode(N) ? new Binder(N, j).resolve() : Report.create(PASS_THROUGH);
|
|
@@ -7995,23 +8000,23 @@ function nodeRefereeOfRecordsName(r, j, N) {
|
|
|
7995
8000
|
let P = extractVarNameFromPrimaryVariable(N) ?? "";
|
|
7996
8001
|
if (!isAccessExpression(N.parentNode)) {
|
|
7997
8002
|
let F = r.lookupMembers(j, [SymbolKind.Table, SymbolKind.Schema], P);
|
|
7998
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8003
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Table '${P}' does not exist in Schema 'public'`, N)]);
|
|
7999
8004
|
}
|
|
8000
8005
|
let F = nodeRefereeOfLeftExpression(r, N);
|
|
8001
8006
|
if (!F) {
|
|
8002
8007
|
let F = r.lookupMembers(j, [SymbolKind.Table, SymbolKind.Schema], P);
|
|
8003
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8008
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Table or schema '${P}' does not exist`, N)]);
|
|
8004
8009
|
}
|
|
8005
8010
|
if (F.isKind(SymbolKind.Schema)) {
|
|
8006
8011
|
let j = r.lookupMembers(F, [SymbolKind.Table, SymbolKind.Schema], P);
|
|
8007
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8012
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Table or schema '${P}' does not exist`, N)]);
|
|
8008
8013
|
}
|
|
8009
8014
|
return new Report(void 0);
|
|
8010
8015
|
}
|
|
8011
8016
|
function nodeRefereeOfRecordsColumn(r, j, N) {
|
|
8012
8017
|
if (!isExpressionAVariableNode(N)) return new Report(void 0);
|
|
8013
8018
|
let P = extractVarNameFromPrimaryVariable(N) ?? "", F = r.lookupMembers(j, SymbolKind.Column, P);
|
|
8014
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8019
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Column '${P}' does not exist in Table 'public.${j.name}'`, N)]);
|
|
8015
8020
|
}
|
|
8016
8021
|
function nodeRefereeOfEnumValue(r, j, N) {
|
|
8017
8022
|
if (!isExpressionAVariableNode(N)) return new Report(void 0);
|
|
@@ -8021,7 +8026,7 @@ function nodeRefereeOfEnumValue(r, j, N) {
|
|
|
8021
8026
|
if (F) {
|
|
8022
8027
|
if (F.isKind(SymbolKind.Schema)) {
|
|
8023
8028
|
let j = r.lookupMembers(F, [SymbolKind.Enum, SymbolKind.Schema], P);
|
|
8024
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8029
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum or schema '${P}' does not exist`, N)]);
|
|
8025
8030
|
}
|
|
8026
8031
|
if (F.isKind(SymbolKind.Enum)) {
|
|
8027
8032
|
let j = r.lookupMembers(F, SymbolKind.EnumField, P);
|
|
@@ -8033,7 +8038,7 @@ function nodeRefereeOfEnumValue(r, j, N) {
|
|
|
8033
8038
|
if (I.leftExpression === N) {
|
|
8034
8039
|
if (isAccessExpression(I.parentNode) && I.parentNode.leftExpression === I) {
|
|
8035
8040
|
let F = r.lookupMembers(j, SymbolKind.Schema, P);
|
|
8036
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8041
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Schema '${P}' does not exist in Schema 'public'`, N)]);
|
|
8037
8042
|
}
|
|
8038
8043
|
let F = r.lookupMembers(j, SymbolKind.Enum, P);
|
|
8039
8044
|
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum '${P}' does not exist in Schema 'public'`, N)]);
|
|
@@ -8204,7 +8209,7 @@ function nodeRefereeOfRefEndpoint(r, N, P) {
|
|
|
8204
8209
|
}
|
|
8205
8210
|
const useUtils = { visibleName(r, M) {
|
|
8206
8211
|
let N = M instanceof SyntaxNode ? M : M.useSpecifierDeclaration instanceof UseSpecifierNode ? M.useSpecifierDeclaration : M.declaration;
|
|
8207
|
-
if (N) return r.nodeAlias(N).mapFiltered((r) => [r], UNHANDLED, void 0).getFiltered(UNHANDLED) || r.nodeFullname(N).getFiltered(UNHANDLED);
|
|
8212
|
+
if (N instanceof UseSpecifierNode && M instanceof NodeSymbol && N.getSymbolKind() !== M.kind && (N = M.declaration), N) return r.nodeAlias(N).mapFiltered((r) => [r], UNHANDLED, void 0).getFiltered(UNHANDLED) || r.nodeFullname(N).getFiltered(UNHANDLED);
|
|
8208
8213
|
} }, useModule$1 = {
|
|
8209
8214
|
nodeSymbol(N, P) {
|
|
8210
8215
|
if (!isUseSpecifier(P) || !P.name) return Report.create(PASS_THROUGH);
|
|
@@ -8217,7 +8222,7 @@ const useUtils = { visibleName(r, M) {
|
|
|
8217
8222
|
usedSymbol: I,
|
|
8218
8223
|
kind: F,
|
|
8219
8224
|
name: useUtils.visibleName(N, P)?.at(-1)
|
|
8220
|
-
}, P.filepath), I === void 0 ? [new CompileError(CompileErrorCode.BINDING_ERROR, `Failed to resolve the import of ${F} '${(
|
|
8225
|
+
}, P.filepath), I === void 0 ? [new CompileError(CompileErrorCode.BINDING_ERROR, `Failed to resolve the import of ${F} '${(destructureComplexVariable(P.name) || []).map(addDoubleQuoteIfNeeded).join(".")}'`, P)] : []);
|
|
8221
8226
|
},
|
|
8222
8227
|
symbolMembers(N, P) {
|
|
8223
8228
|
if (!(P instanceof UseSymbol)) return Report.create(PASS_THROUGH);
|
|
@@ -8235,14 +8240,14 @@ const useUtils = { visibleName(r, M) {
|
|
|
8235
8240
|
let z = P.parentOfKind(UseDeclarationNode);
|
|
8236
8241
|
if (z?.importPath?.value === void 0) return Report.create(void 0);
|
|
8237
8242
|
let B = resolveImportFilepath(P.filepath, z.importPath.value);
|
|
8238
|
-
if (!B) return Report.create(void 0);
|
|
8243
|
+
if (!B) return Report.create(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Import path must be relative, got '${z.importPath.value}'`, P)]);
|
|
8239
8244
|
if (!N.layout.exists(B)) return Report.create(void 0, [new CompileError(CompileErrorCode.NONEXISTENT_MODULE, `${I} '${L?.join(".") ?? R}' does not exist in file ${B.toString()}. Does the file exist?`, P)]);
|
|
8240
8245
|
let V = P.parentOfKind(InfixExpressionNode)?.leftExpression;
|
|
8241
8246
|
if (V && V !== P) {
|
|
8242
8247
|
let r = N.nodeReferee(V).getFiltered(UNHANDLED);
|
|
8243
8248
|
if (!r) return Report.create(void 0);
|
|
8244
8249
|
let F = N.lookupMembers(r, I, R);
|
|
8245
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8250
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Could not find ${I} '${R}'`, P)]);
|
|
8246
8251
|
}
|
|
8247
8252
|
let H = lookupMemberInFilepath(N, B, R, I);
|
|
8248
8253
|
return H ? Report.create(H) : Report.create(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `${I} '${R}' does not exist in file ${B.toString()}`, P)]);
|
|
@@ -8252,7 +8257,7 @@ const useUtils = { visibleName(r, M) {
|
|
|
8252
8257
|
let r = [];
|
|
8253
8258
|
if (N.importPath?.value) {
|
|
8254
8259
|
let M = resolveImportFilepath(N.filepath, N.importPath.value);
|
|
8255
|
-
M
|
|
8260
|
+
M ? j.layout.exists(M) || r.push(new CompileError(CompileErrorCode.NONEXISTENT_MODULE, `Failed to resolve the non-existent file '${N.importPath.value}'`, N.importPath)) : r.push(new CompileError(CompileErrorCode.BINDING_ERROR, `Import path must be relative, got '${N.importPath.value}'`, N.importPath));
|
|
8256
8261
|
}
|
|
8257
8262
|
if (N.specifiers) {
|
|
8258
8263
|
let M = j.bindNode(N.specifiers);
|
|
@@ -8298,64 +8303,23 @@ function lookupMemberInFilepath(r, M, N, P, F = /* @__PURE__ */ new Set()) {
|
|
|
8298
8303
|
}
|
|
8299
8304
|
}
|
|
8300
8305
|
function usableMembers(r) {
|
|
8301
|
-
let N = [], P = /* @__PURE__ */ new Map(), F = [], I = [], L = [], R = [], z = r instanceof Filepath ? r : r.filepath, B = this.parseFile(z), { ast: V } = B.getValue();
|
|
8302
|
-
for (let r of V.body) {
|
|
8303
|
-
if (!(r instanceof UseDeclarationNode) || !r.specifiers || !r.importPath) continue;
|
|
8304
|
-
let j = resolveImportFilepath(z, r.importPath.value);
|
|
8305
|
-
j && (r.isReuse ? r.specifiers instanceof WildcardNode ? F.push({
|
|
8306
|
-
importPath: j,
|
|
8307
|
-
node: r.specifiers
|
|
8308
|
-
}) : I.push(...r.specifiers.specifiers) : r.specifiers instanceof WildcardNode ? L.push({
|
|
8309
|
-
importPath: j,
|
|
8310
|
-
node: r.specifiers
|
|
8311
|
-
}) : R.push(...r.specifiers.specifiers));
|
|
8312
|
-
}
|
|
8313
|
-
let H = [];
|
|
8314
8306
|
if (r instanceof Filepath) {
|
|
8315
|
-
let M =
|
|
8316
|
-
|
|
8317
|
-
let P = this.nodeFullname(N).getFiltered(UNHANDLED) || [], F = P.length <= 1 ? DEFAULT_SCHEMA_NAME : P[0];
|
|
8318
|
-
M.has(F) || M.set(F, this.symbolFactory.create(SchemaSymbol, { name: F }, r));
|
|
8319
|
-
}
|
|
8320
|
-
H.push(...M.values());
|
|
8321
|
-
let P = H.find((r) => r.isPublicSchema());
|
|
8322
|
-
if (P) {
|
|
8323
|
-
let r = this.usableMembers(P).getFiltered(UNHANDLED);
|
|
8324
|
-
r && N.push(...r.nonSchemaMembers);
|
|
8325
|
-
}
|
|
8326
|
-
} else {
|
|
8327
|
-
let M = r;
|
|
8328
|
-
for (let r of V.body) {
|
|
8329
|
-
if (!(r instanceof ElementDeclarationNode)) continue;
|
|
8330
|
-
let F = schemaMembership(this, M, r), I = this.nodeAlias(r).getFiltered(UNHANDLED), L = this.nodeSymbol(r).getFiltered(UNHANDLED);
|
|
8331
|
-
if (I !== void 0 && M.isPublicSchema() && L && N.push(this.symbolFactory.create(AliasSymbol, {
|
|
8332
|
-
kind: L.kind,
|
|
8333
|
-
declaration: r,
|
|
8334
|
-
aliasedSymbol: L,
|
|
8335
|
-
name: I
|
|
8336
|
-
}, M.filepath)), F.kind !== "none") if (F.kind === "direct") {
|
|
8337
|
-
let M = this.nodeSymbol(r).getFiltered(UNHANDLED);
|
|
8338
|
-
if (!M) continue;
|
|
8339
|
-
N.push(M);
|
|
8340
|
-
} else P.has(F.schemaName) || P.set(F.schemaName, this.symbolFactory.create(SchemaSymbol, {
|
|
8341
|
-
name: F.schemaName,
|
|
8342
|
-
parent: M
|
|
8343
|
-
}, M.filepath));
|
|
8344
|
-
}
|
|
8345
|
-
H.push(...P.values());
|
|
8307
|
+
let { ast: M } = this.parseFile(r).getValue(), N = this.nodeSymbol(M).getFiltered(UNHANDLED);
|
|
8308
|
+
return this.usableMembers(N);
|
|
8346
8309
|
}
|
|
8310
|
+
let N = r.filepath, P = collectImports(this, N), { nonSchemaMembers: F, schemaMembers: I } = r instanceof ProgramSymbol ? usableMembersForProgram(this, r, P) : usableMembersForSchema(this, r, P);
|
|
8347
8311
|
return new Report({
|
|
8348
|
-
nonSchemaMembers:
|
|
8349
|
-
schemaMembers:
|
|
8312
|
+
nonSchemaMembers: F,
|
|
8313
|
+
schemaMembers: I,
|
|
8350
8314
|
reuses: {
|
|
8351
|
-
selective:
|
|
8352
|
-
wildcard:
|
|
8315
|
+
selective: P.selectiveReuses,
|
|
8316
|
+
wildcard: P.wildcardReuses
|
|
8353
8317
|
},
|
|
8354
8318
|
uses: {
|
|
8355
|
-
selective:
|
|
8356
|
-
wildcard:
|
|
8319
|
+
selective: P.selectiveUses,
|
|
8320
|
+
wildcard: P.wildcardUses
|
|
8357
8321
|
}
|
|
8358
|
-
},
|
|
8322
|
+
}, P.parseResult.getErrors(), P.parseResult.getWarnings());
|
|
8359
8323
|
}
|
|
8360
8324
|
function schemaMembership(r, M, N) {
|
|
8361
8325
|
let P = M.qualifiedName, F;
|
|
@@ -8366,6 +8330,124 @@ function schemaMembership(r, M, N) {
|
|
|
8366
8330
|
schemaName: I[P.length]
|
|
8367
8331
|
};
|
|
8368
8332
|
}
|
|
8333
|
+
function collectImports(r, j) {
|
|
8334
|
+
let M = r.parseFile(j), { ast: N } = M.getValue(), P = [], F = [], I = [], L = [];
|
|
8335
|
+
for (let r of N.body) {
|
|
8336
|
+
if (!(r instanceof UseDeclarationNode) || !r.specifiers || !r.importPath) continue;
|
|
8337
|
+
let M = resolveImportFilepath(j, r.importPath.value);
|
|
8338
|
+
M && (r.isReuse ? r.specifiers instanceof WildcardNode ? P.push({
|
|
8339
|
+
importPath: M,
|
|
8340
|
+
node: r.specifiers
|
|
8341
|
+
}) : F.push(...r.specifiers.specifiers) : r.specifiers instanceof WildcardNode ? I.push({
|
|
8342
|
+
importPath: M,
|
|
8343
|
+
node: r.specifiers
|
|
8344
|
+
}) : L.push(...r.specifiers.specifiers));
|
|
8345
|
+
}
|
|
8346
|
+
return {
|
|
8347
|
+
ast: N,
|
|
8348
|
+
parseResult: M,
|
|
8349
|
+
selectiveReuses: F,
|
|
8350
|
+
wildcardReuses: P,
|
|
8351
|
+
selectiveUses: L,
|
|
8352
|
+
wildcardUses: I
|
|
8353
|
+
};
|
|
8354
|
+
}
|
|
8355
|
+
function usableMembersForProgram(r, M, N) {
|
|
8356
|
+
let { ast: P, selectiveUses: F, selectiveReuses: I } = N, L = M.filepath, R = new Map([[DEFAULT_SCHEMA_NAME, r.symbolFactory.create(SchemaSymbol, { name: DEFAULT_SCHEMA_NAME }, L)]]);
|
|
8357
|
+
for (let M of P.declarations) {
|
|
8358
|
+
let N = r.nodeFullname(M).getFiltered(UNHANDLED) || [], P = N.length <= 1 ? DEFAULT_SCHEMA_NAME : N[0];
|
|
8359
|
+
R.has(P) || R.set(P, r.symbolFactory.create(SchemaSymbol, { name: P }, L));
|
|
8360
|
+
}
|
|
8361
|
+
registerProgramSchemas(r, [...F, ...I], R, L);
|
|
8362
|
+
for (let j of r.reachableFiles(L)) for (let M of collectTopLevelSchemaNames(r, j)) R.has(M) || R.set(M, r.symbolFactory.create(SchemaSymbol, { name: M }, L));
|
|
8363
|
+
let z = [...R.values()], B = [], V = z.find((r) => r.isPublicSchema());
|
|
8364
|
+
if (V) {
|
|
8365
|
+
let M = r.usableMembers(V).getFiltered(UNHANDLED);
|
|
8366
|
+
M && B.push(...M.nonSchemaMembers);
|
|
8367
|
+
}
|
|
8368
|
+
return {
|
|
8369
|
+
nonSchemaMembers: B,
|
|
8370
|
+
schemaMembers: z
|
|
8371
|
+
};
|
|
8372
|
+
}
|
|
8373
|
+
function usableMembersForSchema(r, M, N) {
|
|
8374
|
+
let { ast: P, selectiveUses: F, selectiveReuses: I } = N, L = [], R = /* @__PURE__ */ new Map();
|
|
8375
|
+
for (let N of P.body) {
|
|
8376
|
+
if (!(N instanceof ElementDeclarationNode)) continue;
|
|
8377
|
+
let P = schemaMembership(r, M, N), F = r.nodeAlias(N).getFiltered(UNHANDLED), I = r.nodeSymbol(N).getFiltered(UNHANDLED);
|
|
8378
|
+
if (F !== void 0 && M.isPublicSchema() && I && L.push(r.symbolFactory.create(AliasSymbol, {
|
|
8379
|
+
kind: I.kind,
|
|
8380
|
+
declaration: N,
|
|
8381
|
+
aliasedSymbol: I,
|
|
8382
|
+
name: F
|
|
8383
|
+
}, M.filepath)), P.kind !== "none") if (P.kind === "direct") {
|
|
8384
|
+
let M = r.nodeSymbol(N).getFiltered(UNHANDLED);
|
|
8385
|
+
if (!M) continue;
|
|
8386
|
+
L.push(M);
|
|
8387
|
+
} else R.has(P.schemaName) || R.set(P.schemaName, r.symbolFactory.create(SchemaSymbol, {
|
|
8388
|
+
name: P.schemaName,
|
|
8389
|
+
parent: M
|
|
8390
|
+
}, M.filepath));
|
|
8391
|
+
}
|
|
8392
|
+
registerSchemaChildren(r, [...F, ...I], M, R);
|
|
8393
|
+
let z = M.qualifiedName;
|
|
8394
|
+
for (let j of r.reachableFiles(M.filepath)) for (let N of collectChildSchemaNames(r, j, z)) R.has(N) || R.set(N, r.symbolFactory.create(SchemaSymbol, {
|
|
8395
|
+
name: N,
|
|
8396
|
+
parent: M
|
|
8397
|
+
}, M.filepath));
|
|
8398
|
+
return {
|
|
8399
|
+
nonSchemaMembers: L,
|
|
8400
|
+
schemaMembers: [...R.values()]
|
|
8401
|
+
};
|
|
8402
|
+
}
|
|
8403
|
+
function registerProgramSchemas(r, j, M, N) {
|
|
8404
|
+
for (let P of j) {
|
|
8405
|
+
if (P.getSymbolKind() !== SymbolKind.Schema) continue;
|
|
8406
|
+
let j = useUtils.visibleName(r, P)?.at(0);
|
|
8407
|
+
j !== void 0 && !M.has(j) && M.set(j, r.symbolFactory.create(SchemaSymbol, { name: j }, N));
|
|
8408
|
+
}
|
|
8409
|
+
}
|
|
8410
|
+
function registerSchemaChildren(r, j, M, N) {
|
|
8411
|
+
let P = M.qualifiedName;
|
|
8412
|
+
for (let F of j) {
|
|
8413
|
+
if (F.getSymbolKind() !== SymbolKind.Schema) continue;
|
|
8414
|
+
let j = useUtils.visibleName(r, F);
|
|
8415
|
+
if (!j || j.length <= P.length || !P.every((r, M) => r === j[M])) continue;
|
|
8416
|
+
let I = j[P.length];
|
|
8417
|
+
I && !N.has(I) && N.set(I, r.symbolFactory.create(SchemaSymbol, {
|
|
8418
|
+
name: I,
|
|
8419
|
+
parent: M
|
|
8420
|
+
}, M.filepath));
|
|
8421
|
+
}
|
|
8422
|
+
}
|
|
8423
|
+
function collectTopLevelSchemaNames(r, M) {
|
|
8424
|
+
let { ast: N } = r.parseFile(M).getValue(), P = [];
|
|
8425
|
+
for (let M of N.declarations) {
|
|
8426
|
+
let N = r.nodeFullname(M).getFiltered(UNHANDLED) || [], F = N.length <= 1 ? DEFAULT_SCHEMA_NAME : N[0];
|
|
8427
|
+
P.push(F);
|
|
8428
|
+
}
|
|
8429
|
+
let F = collectImports(r, M);
|
|
8430
|
+
for (let j of [...F.selectiveUses, ...F.selectiveReuses]) {
|
|
8431
|
+
if (j.getSymbolKind() !== SymbolKind.Schema) continue;
|
|
8432
|
+
let M = useUtils.visibleName(r, j)?.at(0);
|
|
8433
|
+
M !== void 0 && P.push(M);
|
|
8434
|
+
}
|
|
8435
|
+
return P;
|
|
8436
|
+
}
|
|
8437
|
+
function collectChildSchemaNames(r, M, N) {
|
|
8438
|
+
let { ast: P } = r.parseFile(M).getValue(), F = [];
|
|
8439
|
+
for (let M of P.declarations) {
|
|
8440
|
+
let P = r.nodeFullname(M).getFiltered(UNHANDLED) || [], I = P.length <= 1 ? [DEFAULT_SCHEMA_NAME] : P.slice(0, -1);
|
|
8441
|
+
I.length > N.length && N.every((r, j) => r === I[j]) && F.push(I[N.length]);
|
|
8442
|
+
}
|
|
8443
|
+
let I = collectImports(r, M);
|
|
8444
|
+
for (let j of [...I.selectiveUses, ...I.selectiveReuses]) {
|
|
8445
|
+
if (j.getSymbolKind() !== SymbolKind.Schema) continue;
|
|
8446
|
+
let M = useUtils.visibleName(r, j);
|
|
8447
|
+
!M || M.length <= N.length || N.every((r, j) => r === M[j]) && F.push(M[N.length]);
|
|
8448
|
+
}
|
|
8449
|
+
return F;
|
|
8450
|
+
}
|
|
8369
8451
|
var TableBinder = class {
|
|
8370
8452
|
constructor(r, j) {
|
|
8371
8453
|
this.compiler = r, this.declarationNode = j;
|
|
@@ -8685,7 +8767,7 @@ function nodeRefereeOfPartialInjection(r, N, P) {
|
|
|
8685
8767
|
}
|
|
8686
8768
|
}
|
|
8687
8769
|
let L = r.lookupMembers(N, SymbolKind.TablePartial, F);
|
|
8688
|
-
return L ? Report.create(L) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8770
|
+
return L ? Report.create(L) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `TablePartial '${F}' does not exist in Schema 'public'`, P)]);
|
|
8689
8771
|
}
|
|
8690
8772
|
function nodeRefereeOfEnumType$1(r, j, N) {
|
|
8691
8773
|
if (!isExpressionAVariableNode(N)) return new Report(void 0);
|
|
@@ -8695,13 +8777,13 @@ function nodeRefereeOfEnumType$1(r, j, N) {
|
|
|
8695
8777
|
if (F) {
|
|
8696
8778
|
if (F.isKind(SymbolKind.Schema)) {
|
|
8697
8779
|
let j = isTerminalAccessFragment(N), I = r.lookupMembers(F, j ? SymbolKind.Enum : SymbolKind.Schema, P);
|
|
8698
|
-
return I ? Report.create(I) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8780
|
+
return I ? Report.create(I) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, j ? `Enum '${P}' does not exist in Schema 'public'` : `Schema '${P}' does not exist in Schema 'public'`, N)]);
|
|
8699
8781
|
}
|
|
8700
8782
|
return new Report(void 0);
|
|
8701
8783
|
}
|
|
8702
8784
|
if (N.parentNode.leftExpression === N) {
|
|
8703
8785
|
let F = r.lookupMembers(j, SymbolKind.Schema, P);
|
|
8704
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8786
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Schema '${P}' does not exist in Schema 'public'`, N)]);
|
|
8705
8787
|
}
|
|
8706
8788
|
return new Report(void 0);
|
|
8707
8789
|
}
|
|
@@ -8748,11 +8830,11 @@ function nodeRefereeOfEnumDefault$1(r, j, N) {
|
|
|
8748
8830
|
if (F) {
|
|
8749
8831
|
if (F.isKind(SymbolKind.Schema)) {
|
|
8750
8832
|
let j = r.lookupMembers(F, [SymbolKind.Enum, SymbolKind.Schema], P);
|
|
8751
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8833
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum or schema '${P}' does not exist`, N)]);
|
|
8752
8834
|
}
|
|
8753
8835
|
if (F.isKind(SymbolKind.Enum)) {
|
|
8754
8836
|
let j = r.lookupMembers(F, SymbolKind.EnumField, P);
|
|
8755
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8837
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum field '${P}' does not exist in Enum 'public.${F.name}'`, N)]);
|
|
8756
8838
|
}
|
|
8757
8839
|
return new Report(void 0);
|
|
8758
8840
|
}
|
|
@@ -8760,10 +8842,10 @@ function nodeRefereeOfEnumDefault$1(r, j, N) {
|
|
|
8760
8842
|
if (I.leftExpression === N) {
|
|
8761
8843
|
if (isAccessExpression(I.parentNode) && I.parentNode.leftExpression === I) {
|
|
8762
8844
|
let F = r.lookupMembers(j, SymbolKind.Schema, P);
|
|
8763
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8845
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Schema '${P}' does not exist in Schema 'public'`, N)]);
|
|
8764
8846
|
}
|
|
8765
8847
|
let F = r.lookupMembers(j, SymbolKind.Enum, P);
|
|
8766
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
8848
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum '${P}' does not exist in Schema 'public'`, N)]);
|
|
8767
8849
|
}
|
|
8768
8850
|
return new Report(void 0);
|
|
8769
8851
|
}
|
|
@@ -9028,16 +9110,11 @@ function nodeRefereeOfTableGroupField(r, N, P) {
|
|
|
9028
9110
|
let F = extractVarNameFromPrimaryVariable(P) ?? "";
|
|
9029
9111
|
if (!isAccessExpression(P.parentNode)) {
|
|
9030
9112
|
let I = r.symbolMembers(N).getFiltered(UNHANDLED);
|
|
9031
|
-
if (I)
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
let P = r.symbolMembers(N).getFiltered(UNHANDLED);
|
|
9037
|
-
if (P) {
|
|
9038
|
-
let N = P.find((M) => !M.isKind(SymbolKind.Table) || !M.declaration ? !1 : r.nodeAlias(M.declaration).getFiltered(UNHANDLED) === F);
|
|
9039
|
-
if (N) return new Report(N);
|
|
9040
|
-
}
|
|
9113
|
+
if (I) {
|
|
9114
|
+
let j = I.find((r) => r instanceof SchemaSymbol && r.isPublicSchema());
|
|
9115
|
+
if (j) {
|
|
9116
|
+
let N = r.lookupMembers(j, SymbolKind.Table, F);
|
|
9117
|
+
if (N) return Report.create(N);
|
|
9041
9118
|
}
|
|
9042
9119
|
}
|
|
9043
9120
|
let L = r.lookupMembers(N, SymbolKind.Table, F);
|
|
@@ -9146,7 +9223,7 @@ var TablePartialBinder = class {
|
|
|
9146
9223
|
this.tablePartial.headerColor = M ? extractColor(M.value) : void 0;
|
|
9147
9224
|
let [N] = j[SettingName.Note] || [];
|
|
9148
9225
|
return this.tablePartial.note = N && {
|
|
9149
|
-
value:
|
|
9226
|
+
value: normalizeNote(extractQuotedStringToken(N?.value)),
|
|
9150
9227
|
token: getTokenPosition(N)
|
|
9151
9228
|
}, [];
|
|
9152
9229
|
}
|
|
@@ -9274,13 +9351,13 @@ function nodeRefereeOfEnumType(r, j, N) {
|
|
|
9274
9351
|
if (F) {
|
|
9275
9352
|
if (F.isKind(SymbolKind.Schema)) {
|
|
9276
9353
|
let j = r.lookupMembers(F, [SymbolKind.Enum, SymbolKind.Schema], P);
|
|
9277
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9354
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum or schema '${P}' does not exist`, N)]);
|
|
9278
9355
|
}
|
|
9279
9356
|
return new Report(void 0);
|
|
9280
9357
|
}
|
|
9281
9358
|
if (N.parentNode.leftExpression === N) {
|
|
9282
9359
|
let F = r.lookupMembers(j, SymbolKind.Schema, P);
|
|
9283
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9360
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Schema '${P}' does not exist in Schema 'public'`, N)]);
|
|
9284
9361
|
}
|
|
9285
9362
|
return new Report(void 0);
|
|
9286
9363
|
}
|
|
@@ -9293,21 +9370,21 @@ function nodeRefereeOfInlineRef(r, P, F) {
|
|
|
9293
9370
|
let N = r.nodeSymbol(L).getFiltered(UNHANDLED);
|
|
9294
9371
|
if (N) {
|
|
9295
9372
|
let j = r.lookupMembers(N, SymbolKind.Column, I);
|
|
9296
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9373
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Column '${I}' does not exist in TablePartial '${N.name}'`, F)]);
|
|
9297
9374
|
}
|
|
9298
9375
|
}
|
|
9299
9376
|
let R = r.lookupMembers(P, SymbolKind.Column, I);
|
|
9300
|
-
return R ? Report.create(R) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9377
|
+
return R ? Report.create(R) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Column '${I}' does not exist`, F)]);
|
|
9301
9378
|
}
|
|
9302
9379
|
let L = nodeRefereeOfLeftExpression(r, F);
|
|
9303
9380
|
if (L) {
|
|
9304
9381
|
if (L.isKind(SymbolKind.Schema)) {
|
|
9305
9382
|
let j = r.lookupMembers(L, [SymbolKind.Table, SymbolKind.Schema], I);
|
|
9306
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9383
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Table or schema '${I}' does not exist`, F)]);
|
|
9307
9384
|
}
|
|
9308
9385
|
if (L.isKind(SymbolKind.Table)) {
|
|
9309
9386
|
let j = r.lookupMembers(L, SymbolKind.Column, I);
|
|
9310
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9387
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Column '${I}' does not exist in Table 'public.${L.name}'`, F)]);
|
|
9311
9388
|
}
|
|
9312
9389
|
return new Report(void 0);
|
|
9313
9390
|
}
|
|
@@ -9315,10 +9392,10 @@ function nodeRefereeOfInlineRef(r, P, F) {
|
|
|
9315
9392
|
if (R.leftExpression === F) {
|
|
9316
9393
|
if (isAccessExpression(R.parentNode) && R.parentNode.leftExpression === R) {
|
|
9317
9394
|
let j = r.lookupMembers(P, SymbolKind.Schema, I);
|
|
9318
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9395
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Schema '${I}' does not exist in Schema 'public'`, F)]);
|
|
9319
9396
|
}
|
|
9320
9397
|
let j = r.lookupMembers(P, SymbolKind.Table, I);
|
|
9321
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9398
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Table '${I}' does not exist in Schema 'public'`, F)]);
|
|
9322
9399
|
}
|
|
9323
9400
|
return new Report(void 0);
|
|
9324
9401
|
}
|
|
@@ -9330,11 +9407,11 @@ function nodeRefereeOfEnumDefault(r, j, N) {
|
|
|
9330
9407
|
if (F) {
|
|
9331
9408
|
if (F.isKind(SymbolKind.Schema)) {
|
|
9332
9409
|
let j = r.lookupMembers(F, [SymbolKind.Enum, SymbolKind.Schema], P);
|
|
9333
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9410
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum or schema '${P}' does not exist`, N)]);
|
|
9334
9411
|
}
|
|
9335
9412
|
if (F.isKind(SymbolKind.Enum)) {
|
|
9336
9413
|
let j = r.lookupMembers(F, SymbolKind.EnumField, P);
|
|
9337
|
-
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9414
|
+
return j ? Report.create(j) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum field '${P}' does not exist in Enum 'public.${F.name}'`, N)]);
|
|
9338
9415
|
}
|
|
9339
9416
|
return new Report(void 0);
|
|
9340
9417
|
}
|
|
@@ -9342,10 +9419,10 @@ function nodeRefereeOfEnumDefault(r, j, N) {
|
|
|
9342
9419
|
if (I.leftExpression === N) {
|
|
9343
9420
|
if (isAccessExpression(I.parentNode) && I.parentNode.leftExpression === I) {
|
|
9344
9421
|
let F = r.lookupMembers(j, SymbolKind.Schema, P);
|
|
9345
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9422
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Schema '${P}' does not exist in Schema 'public'`, N)]);
|
|
9346
9423
|
}
|
|
9347
9424
|
let F = r.lookupMembers(j, SymbolKind.Enum, P);
|
|
9348
|
-
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.
|
|
9425
|
+
return F ? Report.create(F) : new Report(void 0, [new CompileError(CompileErrorCode.BINDING_ERROR, `Enum '${P}' does not exist in Schema 'public'`, N)]);
|
|
9349
9426
|
}
|
|
9350
9427
|
return new Report(void 0);
|
|
9351
9428
|
}
|
|
@@ -9358,26 +9435,38 @@ const schemaModule = { symbolMembers(N, P) {
|
|
|
9358
9435
|
let M = handleMemberSelectiveUses(N, P, r, R);
|
|
9359
9436
|
z.push(...M.getErrors());
|
|
9360
9437
|
let F = M.getFiltered(UNHANDLED);
|
|
9361
|
-
F && L.push(F);
|
|
9438
|
+
F && L.push(F), L.push(...mergeImportedSchema(N, P, r));
|
|
9362
9439
|
}
|
|
9363
9440
|
for (let { importPath: r, node: j } of I.reuses.wildcard) L.push(...handleMemberWildcardUses(N, P, r, j, R));
|
|
9364
9441
|
for (let r of I.uses.selective) {
|
|
9365
9442
|
let M = handleMemberSelectiveUses(N, P, r, R);
|
|
9366
9443
|
z.push(...M.getErrors());
|
|
9367
9444
|
let F = M.getFiltered(UNHANDLED);
|
|
9368
|
-
F && L.push(F);
|
|
9445
|
+
F && L.push(F), L.push(...mergeImportedSchema(N, P, r));
|
|
9369
9446
|
}
|
|
9370
9447
|
for (let { importPath: r, node: j } of I.uses.wildcard) L.push(...handleMemberWildcardUses(N, P, r, j, R));
|
|
9371
9448
|
L.push(...R.values());
|
|
9372
9449
|
let B = [...L];
|
|
9373
|
-
|
|
9450
|
+
{
|
|
9451
|
+
let r = L.filter((r) => r.isKind(SymbolKind.TableGroup));
|
|
9452
|
+
if (!P.isPublicSchema()) {
|
|
9453
|
+
let M = N.usableMembers(P.filepath).getFiltered(UNHANDLED)?.schemaMembers.find((r) => r.isPublicSchema());
|
|
9454
|
+
if (M) {
|
|
9455
|
+
let P = N.symbolMembers(M).getFiltered(UNHANDLED);
|
|
9456
|
+
P && r.push(...P.filter((r) => r.isKind(SymbolKind.TableGroup)));
|
|
9457
|
+
}
|
|
9458
|
+
}
|
|
9459
|
+
for (let j of r) B.push(...expandTableGroup(N, P, j));
|
|
9460
|
+
}
|
|
9374
9461
|
let V = /* @__PURE__ */ new Set(), H = B.filter((r) => {
|
|
9462
|
+
if (r instanceof UseSymbol && r.isKind(SymbolKind.Schema)) return !1;
|
|
9375
9463
|
let j = `${r.originalSymbol.intern()}:${r.name ?? ""}`;
|
|
9376
9464
|
return V.has(j) ? !1 : (V.add(j), !0);
|
|
9377
9465
|
}), U = /* @__PURE__ */ new Map();
|
|
9378
9466
|
for (let r of H) {
|
|
9379
9467
|
let j = `${r.kind}:${r.name}`;
|
|
9380
9468
|
if (U.get(j)) {
|
|
9469
|
+
if (r.isKind(SymbolKind.Schema)) continue;
|
|
9381
9470
|
let j = r instanceof UseSymbol ? r.useSpecifierDeclaration ?? r.declaration : r.declaration instanceof ElementDeclarationNode && r.declaration.name ? r.declaration.name : r.declaration;
|
|
9382
9471
|
j && r.name !== void 0 && z.push(getDuplicateSchemaMemberError(r.kind, r.name, F.join("."), j));
|
|
9383
9472
|
} else U.set(j, r);
|
|
@@ -9406,6 +9495,26 @@ function handleMemberSelectiveUses(r, N, P, F) {
|
|
|
9406
9495
|
parent: N
|
|
9407
9496
|
}, N.filepath)), Report.create(void 0);
|
|
9408
9497
|
}
|
|
9498
|
+
function mergeImportedSchema(r, M, N, P = /* @__PURE__ */ new Set()) {
|
|
9499
|
+
if (N.getSymbolKind() !== SymbolKind.Schema || !N.name) return [];
|
|
9500
|
+
let F = r.nodeReferee(N.name).getFiltered(UNHANDLED);
|
|
9501
|
+
if (!F || !F.isKind(SymbolKind.Schema) || (r.nodeAlias(N).getFiltered(UNHANDLED) ?? r.nodeFullname(N).getFiltered(UNHANDLED)?.at(0)) !== M.name) return [];
|
|
9502
|
+
let I = F.intern();
|
|
9503
|
+
if (P.has(I)) return [];
|
|
9504
|
+
P.add(I);
|
|
9505
|
+
let L = r.usableMembers(F).getFiltered(UNHANDLED);
|
|
9506
|
+
if (!L) return [];
|
|
9507
|
+
let R = L.nonSchemaMembers.filter((r) => r.canBeImported).map((j) => r.symbolFactory.create(UseSymbol, {
|
|
9508
|
+
kind: j.kind,
|
|
9509
|
+
declaration: j.originalSymbol.declaration,
|
|
9510
|
+
usedSymbol: j.originalSymbol,
|
|
9511
|
+
useSpecifierDeclaration: N,
|
|
9512
|
+
name: j.name
|
|
9513
|
+
}, M.filepath));
|
|
9514
|
+
for (let j of [...R]) j.isKind(SymbolKind.TableGroup) && R.push(...expandTableGroup(r, M, j));
|
|
9515
|
+
for (let j of L.reuses.selective) R.push(...mergeImportedSchema(r, M, j, P));
|
|
9516
|
+
return R;
|
|
9517
|
+
}
|
|
9409
9518
|
function handleMemberWildcardUses(r, M, N, P, F, I = /* @__PURE__ */ new Set()) {
|
|
9410
9519
|
if (I.has(N)) return [];
|
|
9411
9520
|
I.add(N);
|
|
@@ -9424,7 +9533,7 @@ function handleMemberWildcardUses(r, M, N, P, F, I = /* @__PURE__ */ new Set())
|
|
|
9424
9533
|
let { reuses: { selective: B, wildcard: V } } = R;
|
|
9425
9534
|
for (let N of B) {
|
|
9426
9535
|
let P = handleMemberSelectiveUses(r, M, N, F).getFiltered(UNHANDLED);
|
|
9427
|
-
P && z.push(P);
|
|
9536
|
+
P && z.push(P), z.push(...mergeImportedSchema(r, M, N));
|
|
9428
9537
|
}
|
|
9429
9538
|
for (let { importPath: j } of V) z.push(...handleMemberWildcardUses(r, M, j, P, F, I));
|
|
9430
9539
|
return z;
|
|
@@ -9442,34 +9551,36 @@ function findSchemaSymbolInFilepath(r, M, N) {
|
|
|
9442
9551
|
}
|
|
9443
9552
|
return I;
|
|
9444
9553
|
}
|
|
9445
|
-
function expandTableGroup(r, M) {
|
|
9446
|
-
if (!
|
|
9447
|
-
let
|
|
9448
|
-
if (!
|
|
9449
|
-
let
|
|
9450
|
-
for (let j of
|
|
9554
|
+
function expandTableGroup(r, M, N) {
|
|
9555
|
+
if (!N.isKind(SymbolKind.TableGroup) || !(N instanceof UseSymbol)) return [];
|
|
9556
|
+
let P = N.originalSymbol, F = r.symbolMembers(P).getFiltered(UNHANDLED);
|
|
9557
|
+
if (!F) return [];
|
|
9558
|
+
let I = M.qualifiedName, L = [];
|
|
9559
|
+
for (let j of F) {
|
|
9451
9560
|
if (!j.isKind(SymbolKind.TableGroupField) || !j.declaration) continue;
|
|
9452
|
-
let
|
|
9453
|
-
if (!
|
|
9454
|
-
let P = destructureComplexVariable(
|
|
9561
|
+
let M = j.declaration.callee;
|
|
9562
|
+
if (!M) continue;
|
|
9563
|
+
let P = destructureComplexVariable(M);
|
|
9455
9564
|
if (!P || P.length === 0) continue;
|
|
9456
|
-
let
|
|
9457
|
-
|
|
9565
|
+
let F = P.length <= 1 ? [DEFAULT_SCHEMA_NAME] : P.slice(0, -1);
|
|
9566
|
+
if (F.length !== I.length || !I.every((r, j) => r === F[j])) continue;
|
|
9567
|
+
let R = j.declaration.filepath, z = lookupTableInFile(r, R, P);
|
|
9568
|
+
z && L.push(r.symbolFactory.create(UseSymbol, {
|
|
9458
9569
|
kind: SymbolKind.Table,
|
|
9459
|
-
declaration:
|
|
9460
|
-
usedSymbol:
|
|
9570
|
+
declaration: z.declaration,
|
|
9571
|
+
usedSymbol: z,
|
|
9461
9572
|
useSpecifierDeclaration: void 0,
|
|
9462
|
-
name:
|
|
9463
|
-
},
|
|
9573
|
+
name: z.name
|
|
9574
|
+
}, N.filepath));
|
|
9464
9575
|
}
|
|
9465
|
-
return
|
|
9576
|
+
return L;
|
|
9466
9577
|
}
|
|
9467
9578
|
function lookupTableInFile(r, M, N) {
|
|
9468
9579
|
if (N.length === 1) {
|
|
9469
9580
|
let P = r.usableMembers(M).getFiltered(UNHANDLED);
|
|
9470
9581
|
return P ? P.nonSchemaMembers.find((r) => r.isKind(SymbolKind.Table) && r.name === N[0]) : void 0;
|
|
9471
9582
|
}
|
|
9472
|
-
let
|
|
9583
|
+
let P = N[0], F = N[N.length - 1], I = r.usableMembers(M).getFiltered(UNHANDLED);
|
|
9473
9584
|
if (!I) return;
|
|
9474
9585
|
let L = I.schemaMembers.find((r) => r.name === P);
|
|
9475
9586
|
if (!L) return;
|
|
@@ -9789,6 +9900,10 @@ var DiagramViewValidator = class {
|
|
|
9789
9900
|
}
|
|
9790
9901
|
validateSubBlock(r) {
|
|
9791
9902
|
let j = [], M = [];
|
|
9903
|
+
if (hasSimpleBody(r)) return j.push(new CompileError(CompileErrorCode.UNEXPECTED_SIMPLE_BODY, `${r.type?.value} body must be a block`, r.bodyColon)), {
|
|
9904
|
+
errors: j,
|
|
9905
|
+
warnings: M
|
|
9906
|
+
};
|
|
9792
9907
|
if (!r.body || !(r.body instanceof BlockExpressionNode)) return {
|
|
9793
9908
|
errors: j,
|
|
9794
9909
|
warnings: M
|
|
@@ -11023,7 +11138,7 @@ const modules = [
|
|
|
11023
11138
|
nodeFullname(j, N) {
|
|
11024
11139
|
if (!isUseSpecifier(N)) return Report.create(PASS_THROUGH);
|
|
11025
11140
|
let P = destructureComplexVariable(N.name);
|
|
11026
|
-
return !P || P.length === 0 ? Report.create(void 0, [new CompileError(CompileErrorCode.INVALID_NAME, "Use specifiers must have a valid name (simple name or schema-qualified name)", N)]) : N.isKind(ImportKind.TableGroup) && P.length > 1 ? Report.create(P, [new CompileError(CompileErrorCode.INVALID_USE_SPECIFIER_NAME, "A TableGroup name must be a simple name", N)]) : N.isKind(ImportKind.TablePartial) && P.length > 1 ? Report.create(P, [new CompileError(CompileErrorCode.INVALID_USE_SPECIFIER_NAME, "A TablePartial name must be a simple name", N)]) : N.isKind(ImportKind.Note) && P.length > 1 ? Report.create(P, [new CompileError(CompileErrorCode.INVALID_USE_SPECIFIER_NAME, "A Sticky note name must be a simple name", N)]) : (P.length === 1 && P.unshift(DEFAULT_SCHEMA_NAME), new Report(P));
|
|
11141
|
+
return !P || P.length === 0 ? Report.create(void 0, [new CompileError(CompileErrorCode.INVALID_NAME, "Use specifiers must have a valid name (simple name or schema-qualified name)", N)]) : N.isKind(ImportKind.TableGroup) && P.length > 1 ? Report.create(P, [new CompileError(CompileErrorCode.INVALID_USE_SPECIFIER_NAME, "A TableGroup name must be a simple name", N)]) : N.isKind(ImportKind.TablePartial) && P.length > 1 ? Report.create(P, [new CompileError(CompileErrorCode.INVALID_USE_SPECIFIER_NAME, "A TablePartial name must be a simple name", N)]) : N.isKind(ImportKind.Note) && P.length > 1 ? Report.create(P, [new CompileError(CompileErrorCode.INVALID_USE_SPECIFIER_NAME, "A Sticky note name must be a simple name", N)]) : (P.length === 1 && !N.isKind(ImportKind.Schema) && P.unshift(DEFAULT_SCHEMA_NAME), new Report(P));
|
|
11027
11142
|
},
|
|
11028
11143
|
nodeAlias(j, N) {
|
|
11029
11144
|
return isUseSpecifier(N) ? N.alias ? isValidAlias(N.alias) ? new Report(extractVariableFromExpression(N.alias)) : new Report(void 0, [new CompileError(CompileErrorCode.INVALID_ALIAS, "Use aliases can only contain alphanumeric and underscore unless surrounded by double quotes", N.alias)]) : new Report(void 0) : Report.create(PASS_THROUGH);
|
|
@@ -11902,77 +12017,47 @@ function isOffsetWithinElementHeader(r, j) {
|
|
|
11902
12017
|
let M = j.bodyColon?.start ?? j.body?.start;
|
|
11903
12018
|
return M === void 0 ? r >= j.start && r <= j.end : r >= j.start && r < M;
|
|
11904
12019
|
}
|
|
11905
|
-
function scanExistingUses(r, j
|
|
11906
|
-
let
|
|
11907
|
-
if (!
|
|
11908
|
-
for (let r of
|
|
11909
|
-
let j = r.importPath?.value ?? "";
|
|
11910
|
-
if (
|
|
11911
|
-
let
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
if (r.specifiers instanceof UseSpecifierListNode) {
|
|
11916
|
-
let j = new Set([
|
|
11917
|
-
"table",
|
|
11918
|
-
"enum",
|
|
11919
|
-
"tablepartial",
|
|
11920
|
-
"tablegroup",
|
|
11921
|
-
"note",
|
|
11922
|
-
"schema",
|
|
11923
|
-
"from"
|
|
11924
|
-
]);
|
|
11925
|
-
for (let N of r.specifiers.specifiers) {
|
|
11926
|
-
let r, F;
|
|
11927
|
-
if (N.name) r = N.importKind?.value, F = extractVariableFromExpression(N.name), !F && N.name.start !== void 0 && N.name.end !== void 0 && (F = M.slice(N.name.start, N.name.end).trim());
|
|
11928
|
-
else if (N.importKind) {
|
|
11929
|
-
let r = N.importKind.value ?? void 0;
|
|
11930
|
-
r && !j.has(r.toLowerCase()) && (F = r);
|
|
11931
|
-
}
|
|
11932
|
-
F && F.toLowerCase() !== "from" && P.push({
|
|
12020
|
+
function scanExistingUses(r, j) {
|
|
12021
|
+
let M = [], N = r.parseFile(j).getValue()?.ast;
|
|
12022
|
+
if (!N) return M;
|
|
12023
|
+
for (let r of N.uses) {
|
|
12024
|
+
let j = r.importPath?.value ?? "", N = [];
|
|
12025
|
+
if (r.specifiers instanceof UseSpecifierListNode) for (let j of r.specifiers.specifiers) {
|
|
12026
|
+
let r, M;
|
|
12027
|
+
if (j.name ? (r = j.importKind?.value, M = extractVariableFromExpression(j.name)) : j.importKind && (M = j.importKind.value ?? void 0), M) {
|
|
12028
|
+
let P = j.alias ? extractVariableFromExpression(j.alias) : void 0;
|
|
12029
|
+
N.push({
|
|
11933
12030
|
kind: r,
|
|
11934
|
-
name:
|
|
12031
|
+
name: M,
|
|
12032
|
+
alias: P
|
|
11935
12033
|
});
|
|
11936
12034
|
}
|
|
11937
|
-
} else r.specifiers instanceof WildcardNode && P.push({ name: "*" });
|
|
11938
|
-
if (P.length === 0 && !(r.specifiers instanceof WildcardNode)) continue;
|
|
11939
|
-
let F = r.fullEnd;
|
|
11940
|
-
if (!r.importPath) {
|
|
11941
|
-
let j = r.useKeyword?.start ?? r.fullStart, N = M.indexOf("\n", j);
|
|
11942
|
-
F = N === -1 ? M.length : N;
|
|
11943
12035
|
}
|
|
11944
|
-
N.push({
|
|
12036
|
+
else r.specifiers instanceof WildcardNode && N.push({ name: "*" });
|
|
12037
|
+
N.length === 0 && !(r.specifiers instanceof WildcardNode) || M.push({
|
|
11945
12038
|
startOffset: r.fullStart,
|
|
11946
|
-
endOffset:
|
|
12039
|
+
endOffset: r.fullEnd,
|
|
11947
12040
|
sourceFile: j,
|
|
11948
|
-
specifiers:
|
|
12041
|
+
specifiers: N,
|
|
11949
12042
|
node: r
|
|
11950
12043
|
});
|
|
11951
12044
|
}
|
|
11952
|
-
return
|
|
12045
|
+
return M;
|
|
11953
12046
|
}
|
|
11954
12047
|
function mergeSymbolIntoUses(r, j, M, N, P, F) {
|
|
11955
|
-
let I = scanExistingUses(r, P
|
|
12048
|
+
let I = scanExistingUses(r, P), L = N.relativeTo(P.dirname).replace(/\.dbml$/, ""), R = I.findIndex((r) => r.sourceFile === L), z = `${M} ${j}`;
|
|
11956
12049
|
if (R !== -1) {
|
|
11957
12050
|
let r = I[R];
|
|
11958
12051
|
return r.specifiers.some((r) => r.name === j) ? { topInsert: "" } : {
|
|
11959
|
-
topInsert: buildUseStatement(
|
|
12052
|
+
topInsert: buildUseStatement(uniq_default([...r.specifiers.filter((r) => r.name !== "*").map((r) => `${r.kind ?? M} ${r.name}${r.alias ? ` as ${r.alias}` : ""}`), z]), L, "\n"),
|
|
11960
12053
|
removeRange: expandToFullLines(F, r.startOffset, r.endOffset)
|
|
11961
12054
|
};
|
|
11962
12055
|
}
|
|
11963
|
-
return { topInsert: buildUseStatement([z], L,
|
|
12056
|
+
return { topInsert: buildUseStatement([z], L, "\n") };
|
|
11964
12057
|
}
|
|
11965
12058
|
function buildUseStatement(r, j, M) {
|
|
11966
12059
|
return `use {${M}${r.map((r) => ` ${r}`).join(M)}${M}} from '${j}'${M}${M}`;
|
|
11967
12060
|
}
|
|
11968
|
-
function uniqueInOrder(r) {
|
|
11969
|
-
let j = /* @__PURE__ */ new Set(), M = [];
|
|
11970
|
-
for (let N of r) {
|
|
11971
|
-
let r = N.trim();
|
|
11972
|
-
j.has(r) || (j.add(r), M.push(N));
|
|
11973
|
-
}
|
|
11974
|
-
return M;
|
|
11975
|
-
}
|
|
11976
12061
|
function expandToFullLines(r, j, M) {
|
|
11977
12062
|
let N = r.lastIndexOf("\n", j - 1) + 1, P = M;
|
|
11978
12063
|
for (; P < r.length && (r[P] === " " || r[P] === " ");) P++;
|
|
@@ -11981,12 +12066,6 @@ function expandToFullLines(r, j, M) {
|
|
|
11981
12066
|
endOffset: P
|
|
11982
12067
|
};
|
|
11983
12068
|
}
|
|
11984
|
-
function detectLineEnding(r) {
|
|
11985
|
-
return r.includes("\r\n") ? "\r\n" : "\n";
|
|
11986
|
-
}
|
|
11987
|
-
function normalizeSourcePath(r, j) {
|
|
11988
|
-
return r.relativeTo(j.dirname).replace(/\.dbml$/, "");
|
|
11989
|
-
}
|
|
11990
12069
|
function pickCompletionItemKind(r) {
|
|
11991
12070
|
switch (r) {
|
|
11992
12071
|
case SymbolKind.Schema: return CompletionItemKind.Module;
|
|
@@ -12046,7 +12125,7 @@ function addSuggestAllSuggestion(r, j = ", ") {
|
|
|
12046
12125
|
}
|
|
12047
12126
|
function collectCrossFileSuggestions(r, M, N) {
|
|
12048
12127
|
let P = [], F = /* @__PURE__ */ new Set(), I = r.layout.getSource(N) ?? "";
|
|
12049
|
-
for (let L of r.layout.
|
|
12128
|
+
for (let L of r.layout.getEntrypoints()) {
|
|
12050
12129
|
if (L.equals(N)) continue;
|
|
12051
12130
|
let R = r.usableMembers(L).getFiltered(UNHANDLED);
|
|
12052
12131
|
if (R) for (let j of [...R.nonSchemaMembers, ...R.schemaMembers]) {
|
|
@@ -12166,6 +12245,7 @@ function suggestUseCompletion(r, j, M, N, P) {
|
|
|
12166
12245
|
}
|
|
12167
12246
|
function suggestInUseDeclaration(r, j, M, N, P, F) {
|
|
12168
12247
|
if (N.importPath && isOffsetWithinSpan(M, N.importPath)) return suggestUseFilepath(r, j, N.importPath, P, N);
|
|
12248
|
+
if (N.importPath && M >= N.importPath.end) return noSuggestions();
|
|
12169
12249
|
if (N.fromKeyword && M > N.fromKeyword.end) return suggestUseFilepath(r, j, void 0, P, N);
|
|
12170
12250
|
if (N.specifiers instanceof UseSpecifierListNode) {
|
|
12171
12251
|
if (!N.specifiers.openBrace) {
|
|
@@ -12235,14 +12315,14 @@ function suggestUseSpecifierStart() {
|
|
|
12235
12315
|
return { suggestions: [{
|
|
12236
12316
|
label: "* from",
|
|
12237
12317
|
detail: "import all",
|
|
12238
|
-
insertText: "* from '${1
|
|
12318
|
+
insertText: "* from '${1:./path}'",
|
|
12239
12319
|
insertTextRules: CompletionItemInsertTextRule.InsertAsSnippet,
|
|
12240
12320
|
kind: CompletionItemKind.Snippet,
|
|
12241
12321
|
range: void 0
|
|
12242
12322
|
}, {
|
|
12243
12323
|
label: "{ } from",
|
|
12244
12324
|
detail: "import named",
|
|
12245
|
-
insertText: "{ ${1:
|
|
12325
|
+
insertText: "{ ${1:kind} ${2:name} } from '${3:./path}'",
|
|
12246
12326
|
insertTextRules: CompletionItemInsertTextRule.InsertAsSnippet,
|
|
12247
12327
|
kind: CompletionItemKind.Snippet,
|
|
12248
12328
|
range: void 0
|
|
@@ -12259,7 +12339,7 @@ function suggestUseFilepath(r, j, M, N, P) {
|
|
|
12259
12339
|
endColumn: r.endColumn - 1
|
|
12260
12340
|
};
|
|
12261
12341
|
}
|
|
12262
|
-
let z = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map(), V = uniqBy_default(r.layout.
|
|
12342
|
+
let z = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map(), V = uniqBy_default(r.layout.getEntrypoints().flatMap((j) => [...r.reachableFiles(j)]), (r) => r.intern());
|
|
12263
12343
|
for (let M of V) {
|
|
12264
12344
|
if (M.equals(j)) continue;
|
|
12265
12345
|
let N = M.relativeTo(F);
|
|
@@ -13115,7 +13195,7 @@ var dbmlMonarchTokensProvider = {
|
|
|
13115
13195
|
}
|
|
13116
13196
|
return [...N].sort().map(Filepath.from);
|
|
13117
13197
|
}
|
|
13118
|
-
|
|
13198
|
+
getEntrypoints() {
|
|
13119
13199
|
return [...this.files.keys()].map(Filepath.from).sort((r, j) => r.absolute.localeCompare(j.absolute));
|
|
13120
13200
|
}
|
|
13121
13201
|
clone() {
|
|
@@ -13135,7 +13215,7 @@ function containerStack(r, j) {
|
|
|
13135
13215
|
for (; R.length > 0;) {
|
|
13136
13216
|
let M = !1, N = last_default(R);
|
|
13137
13217
|
if (N instanceof FunctionApplicationNode) {
|
|
13138
|
-
let P = this.
|
|
13218
|
+
let P = this.getSource(r) || "";
|
|
13139
13219
|
for (let r = N.end; r < j; r += 1) P[r] === "\n" && (R.pop(), M = !0);
|
|
13140
13220
|
} else N instanceof PrefixExpressionNode || N instanceof InfixExpressionNode ? this.container.token(r, j).token !== N.op && (R.pop(), M = !0) : N instanceof ListExpressionNode ? N.listCloseBracket && N.end <= j && (R.pop(), M = !0) : N instanceof TupleExpressionNode ? N.tupleCloseParen && N.end <= j && (R.pop(), M = !0) : N instanceof CommaExpressionNode ? N.end <= j && (R.pop(), M = !0) : N instanceof BlockExpressionNode ? N.blockCloseBrace && N.end <= j && (R.pop(), M = !0) : N instanceof IdentifierStreamNode || N.end < j && (R.pop(), M = !0);
|
|
13141
13221
|
if (M) {
|
|
@@ -13190,33 +13270,41 @@ function containerScopeKind(r, j) {
|
|
|
13190
13270
|
default: return ScopeKind.CUSTOM;
|
|
13191
13271
|
}
|
|
13192
13272
|
}
|
|
13193
|
-
function canonicalName(r,
|
|
13194
|
-
let
|
|
13195
|
-
if (
|
|
13196
|
-
let
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
M && R.push(...M);
|
|
13202
|
-
}
|
|
13203
|
-
for (let j of R) if (j.filepath.intern() === r.intern() && j.originalSymbol === P && (j instanceof UseSymbol || j instanceof AliasSymbol)) {
|
|
13204
|
-
let r = j.name;
|
|
13205
|
-
if (!r) continue;
|
|
13206
|
-
if (r !== P.name) return Report.create({
|
|
13273
|
+
function canonicalName(r, j) {
|
|
13274
|
+
let N = j.originalSymbol;
|
|
13275
|
+
if (N.filepath.equals(r)) return Report.create(fullnameToCanonical(this, N));
|
|
13276
|
+
let P = [...this.symbolUses(N).getValue(), ...this.symbolAliases(N).getValue()].filter((j) => j.filepath.equals(r));
|
|
13277
|
+
for (let r of P) {
|
|
13278
|
+
let j = r.name;
|
|
13279
|
+
if (!j) continue;
|
|
13280
|
+
if (j !== N.name) return Report.create({
|
|
13207
13281
|
schema: "",
|
|
13208
|
-
name:
|
|
13282
|
+
name: j
|
|
13283
|
+
});
|
|
13284
|
+
let P = getSchemaChain(this, r);
|
|
13285
|
+
if (P.length > 0) return Report.create({
|
|
13286
|
+
schema: P.join("."),
|
|
13287
|
+
name: j
|
|
13209
13288
|
});
|
|
13210
|
-
let
|
|
13211
|
-
return
|
|
13212
|
-
...
|
|
13213
|
-
name:
|
|
13289
|
+
let F = fullnameToCanonical(this, N);
|
|
13290
|
+
return F ? Report.create({
|
|
13291
|
+
...F,
|
|
13292
|
+
name: j
|
|
13214
13293
|
}) : Report.create({
|
|
13215
13294
|
schema: DEFAULT_SCHEMA_NAME,
|
|
13216
|
-
name:
|
|
13295
|
+
name: j
|
|
13217
13296
|
});
|
|
13218
13297
|
}
|
|
13219
|
-
return Report.create(fullnameToCanonical(this,
|
|
13298
|
+
return Report.create(fullnameToCanonical(this, N));
|
|
13299
|
+
}
|
|
13300
|
+
function getSchemaChain(r, j) {
|
|
13301
|
+
let M = [], N = j;
|
|
13302
|
+
for (; N;) {
|
|
13303
|
+
let j = r.symbolParent(N).find((r) => r instanceof SchemaSymbol && r.isKind(SymbolKind.Schema));
|
|
13304
|
+
if (!j || j.isPublicSchema()) break;
|
|
13305
|
+
M.unshift(j.name ?? ""), N = j;
|
|
13306
|
+
}
|
|
13307
|
+
return M;
|
|
13220
13308
|
}
|
|
13221
13309
|
function fullnameToCanonical(r, M) {
|
|
13222
13310
|
if (!M.declaration) return M.name ? {
|
|
@@ -13243,16 +13331,19 @@ function fileDependencies(r) {
|
|
|
13243
13331
|
}
|
|
13244
13332
|
return M;
|
|
13245
13333
|
}
|
|
13246
|
-
function
|
|
13247
|
-
let
|
|
13248
|
-
for (;
|
|
13249
|
-
let
|
|
13250
|
-
if (!
|
|
13251
|
-
|
|
13252
|
-
for (let
|
|
13334
|
+
function walkDependencies(r, j) {
|
|
13335
|
+
let M = /* @__PURE__ */ new Set(), N = [], P = [...j], F = 0;
|
|
13336
|
+
for (; F < P.length;) {
|
|
13337
|
+
let j = P[F++], I = j.intern();
|
|
13338
|
+
if (!M.has(I)) {
|
|
13339
|
+
M.add(I), N.push(j);
|
|
13340
|
+
for (let M of r.fileDependencies(j)) P.push(M);
|
|
13253
13341
|
}
|
|
13254
13342
|
}
|
|
13255
|
-
return
|
|
13343
|
+
return N;
|
|
13344
|
+
}
|
|
13345
|
+
function reachableFiles(r) {
|
|
13346
|
+
return walkDependencies(this, r ? [r] : this.layout.getEntrypoints());
|
|
13256
13347
|
}
|
|
13257
13348
|
function ast(r) {
|
|
13258
13349
|
return this.bindFile(r), this.parseFile(r).getValue().ast;
|
|
@@ -13303,7 +13394,7 @@ function bindFile(r) {
|
|
|
13303
13394
|
return new Report(void 0, [...j.getErrors(), ...P.getErrors()], [...j.getWarnings(), ...P.getWarnings()]);
|
|
13304
13395
|
}
|
|
13305
13396
|
function bindProject() {
|
|
13306
|
-
let r = collectTransitiveDependencies(this, this.layout.
|
|
13397
|
+
let r = collectTransitiveDependencies(this, this.layout.getEntrypoints()), j = /* @__PURE__ */ new Map();
|
|
13307
13398
|
for (let M of r) {
|
|
13308
13399
|
let r = this.bindFile(M);
|
|
13309
13400
|
j.set(M.absolute, r);
|
|
@@ -13318,7 +13409,7 @@ function interpretFile(r) {
|
|
|
13318
13409
|
}
|
|
13319
13410
|
function interpretProject() {
|
|
13320
13411
|
let r = [], N = [], P = /* @__PURE__ */ new Set(), F = [];
|
|
13321
|
-
for (let r of this.layout.
|
|
13412
|
+
for (let r of this.layout.getEntrypoints()) for (let j of this.reachableFiles(r)) {
|
|
13322
13413
|
let r = j.intern();
|
|
13323
13414
|
P.has(r) || (P.add(r), F.push(j));
|
|
13324
13415
|
}
|
|
@@ -13326,8 +13417,10 @@ function interpretProject() {
|
|
|
13326
13417
|
for (let P of F) {
|
|
13327
13418
|
let F = this.parseFile(P);
|
|
13328
13419
|
r.push(...F.getErrors()), N.push(...F.getWarnings());
|
|
13329
|
-
let L =
|
|
13330
|
-
|
|
13420
|
+
let L = this.bindFile(P);
|
|
13421
|
+
r.push(...L.getErrors()), N.push(...L.getWarnings());
|
|
13422
|
+
let R = F.getValue().ast, z = this.nodeSymbol(R).getFiltered(UNHANDLED), B = z ? this.interpretSymbol(z, P) : Report.create(UNHANDLED), V = B.getFiltered(UNHANDLED);
|
|
13423
|
+
V && I.set(P.absolute, V), r.push(...B.getErrors()), N.push(...B.getWarnings());
|
|
13331
13424
|
}
|
|
13332
13425
|
let L = {};
|
|
13333
13426
|
for (let [r, j] of I) L[r] = j;
|
|
@@ -13681,7 +13774,47 @@ var ParsingContextStack = class {
|
|
|
13681
13774
|
}
|
|
13682
13775
|
}, Parser = class {
|
|
13683
13776
|
constructor(r, j, M, N) {
|
|
13684
|
-
this.current = 0, this.errors = [], this.contextStack = new ParsingContextStack(), this.
|
|
13777
|
+
this.current = 0, this.errors = [], this.contextStack = new ParsingContextStack(), this.useSpecifierList = this.contextStack.withContextDo(ParsingContext.BlockExpression, () => {
|
|
13778
|
+
let r = { specifiers: [] }, j = () => this.nodeFactory.create(UseSpecifierListNode, r);
|
|
13779
|
+
try {
|
|
13780
|
+
this.consume("Expect an opening brace '{'", SyntaxTokenKind.LBRACE), r.openBrace = this.previous();
|
|
13781
|
+
} catch (r) {
|
|
13782
|
+
if (!(r instanceof PartialParsingError)) throw r;
|
|
13783
|
+
if (!this.canHandle(r)) throw new PartialParsingError(r.token, j(), r.handlerContext);
|
|
13784
|
+
this.synchronizeUseSpecifierList();
|
|
13785
|
+
}
|
|
13786
|
+
for (; !this.isAtEnd() && !this.check(SyntaxTokenKind.RBRACE);) {
|
|
13787
|
+
try {
|
|
13788
|
+
r.specifiers.push(this.useSpecifier());
|
|
13789
|
+
} catch (M) {
|
|
13790
|
+
if (!(M instanceof PartialParsingError)) throw M;
|
|
13791
|
+
if (M.partialNode instanceof UseSpecifierNode && r.specifiers.push(M.partialNode), !this.canHandle(M)) throw new PartialParsingError(M.token, j(), M.handlerContext);
|
|
13792
|
+
this.synchronizeUseSpecifierList();
|
|
13793
|
+
}
|
|
13794
|
+
if (this.check(SyntaxTokenKind.IDENTIFIER) && isFromKeyword(this.peek())) break;
|
|
13795
|
+
!hasTrailingNewLines(this.previous()) && !this.check(SyntaxTokenKind.RBRACE) && this.logError(this.peek(), CompileErrorCode.MISSING_SPACES, "Expect a newline between use specifiers");
|
|
13796
|
+
}
|
|
13797
|
+
try {
|
|
13798
|
+
this.consume("Expect a closing brace '}'", SyntaxTokenKind.RBRACE), r.closeBrace = this.previous();
|
|
13799
|
+
} catch (r) {
|
|
13800
|
+
if (!(r instanceof PartialParsingError)) throw r;
|
|
13801
|
+
if (!this.canHandle(r)) throw new PartialParsingError(r.token, j(), r.handlerContext);
|
|
13802
|
+
this.synchronizeUseSpecifierList();
|
|
13803
|
+
}
|
|
13804
|
+
return j();
|
|
13805
|
+
}), this.synchronizeUseSpecifierList = () => {
|
|
13806
|
+
if (!this.check(SyntaxTokenKind.RBRACE)) for (markInvalid(this.advance()); !this.isAtEnd();) {
|
|
13807
|
+
let r = this.peek();
|
|
13808
|
+
if (this.check(SyntaxTokenKind.RBRACE) || this.check(SyntaxTokenKind.STRING_LITERAL) || this.check(SyntaxTokenKind.IDENTIFIER) && isFromKeyword(r) || isAtStartOfLine(this.previous(), r)) break;
|
|
13809
|
+
markInvalid(r), this.advance();
|
|
13810
|
+
}
|
|
13811
|
+
}, this.synchronizeUseSpecifier = () => {
|
|
13812
|
+
for (; !this.isAtEnd();) {
|
|
13813
|
+
let r = this.peek();
|
|
13814
|
+
if (this.check(SyntaxTokenKind.RBRACE) || isAtStartOfLine(this.previous(), r)) break;
|
|
13815
|
+
markInvalid(r), this.advance();
|
|
13816
|
+
}
|
|
13817
|
+
}, this.synchronizeProgram = () => {
|
|
13685
13818
|
let r = this.peek();
|
|
13686
13819
|
r.kind === SyntaxTokenKind.EOF ? this.logError(r, CompileErrorCode.UNEXPECTED_EOF, "Unexpected EOF") : markInvalid(this.advance());
|
|
13687
13820
|
}, this.synchronizeElementDeclarationName = () => {
|
|
@@ -13903,59 +14036,39 @@ var ParsingContextStack = class {
|
|
|
13903
14036
|
if (this.advance(), r.useKeyword = this.previous(), this.peek().kind === SyntaxTokenKind.WILDCARD) this.advance(), r.specifiers = this.nodeFactory.create(WildcardNode, { token: this.previous() });
|
|
13904
14037
|
else try {
|
|
13905
14038
|
r.specifiers = this.useSpecifierList();
|
|
13906
|
-
} catch (
|
|
13907
|
-
|
|
14039
|
+
} catch (j) {
|
|
14040
|
+
if (!(j instanceof PartialParsingError)) throw j;
|
|
14041
|
+
j.partialNode instanceof UseSpecifierListNode && (r.specifiers = j.partialNode);
|
|
13908
14042
|
}
|
|
13909
14043
|
let M = r.specifiers instanceof WildcardNode ? "'*'" : "specifier list";
|
|
13910
|
-
|
|
13911
|
-
else throw this.logError(this.peek(), CompileErrorCode.UNEXPECTED_TOKEN, `Expect 'from' after ${M}`), new PartialParsingError(this.peek(), j(), this.contextStack.findHandlerContext(this.tokens, this.current));
|
|
13912
|
-
if (this.match(SyntaxTokenKind.STRING_LITERAL)) r.importPath = this.previous();
|
|
13913
|
-
else throw this.logError(this.peek(), CompileErrorCode.UNEXPECTED_TOKEN, "Expect a string literal path"), new PartialParsingError(this.peek(), j(), this.contextStack.findHandlerContext(this.tokens, this.current));
|
|
13914
|
-
return j();
|
|
13915
|
-
}
|
|
13916
|
-
useSpecifierList() {
|
|
13917
|
-
let r = { specifiers: [] }, j = () => this.nodeFactory.create(UseSpecifierListNode, r);
|
|
13918
|
-
try {
|
|
13919
|
-
this.consume("Expect an opening brace '{'", SyntaxTokenKind.LBRACE), r.openBrace = this.previous();
|
|
13920
|
-
} catch (r) {
|
|
13921
|
-
throw r instanceof PartialParsingError ? new PartialParsingError(r.token, j(), r.handlerContext) : r;
|
|
13922
|
-
}
|
|
13923
|
-
for (; !this.isAtEnd() && !this.check(SyntaxTokenKind.RBRACE);) {
|
|
13924
|
-
try {
|
|
13925
|
-
r.specifiers.push(this.useSpecifier());
|
|
13926
|
-
} catch (M) {
|
|
13927
|
-
throw M instanceof PartialParsingError ? (M.partialNode instanceof UseSpecifierNode && r.specifiers.push(M.partialNode), new PartialParsingError(M.token, j(), M.handlerContext)) : M;
|
|
13928
|
-
}
|
|
13929
|
-
if (this.check(SyntaxTokenKind.IDENTIFIER) && isFromKeyword(this.peek())) break;
|
|
13930
|
-
!hasTrailingNewLines(this.previous()) && !this.check(SyntaxTokenKind.RBRACE) && this.logError(this.peek(), CompileErrorCode.MISSING_SPACES, "Expect a newline between use specifiers");
|
|
13931
|
-
}
|
|
13932
|
-
try {
|
|
13933
|
-
this.consume("Expect a closing brace '}'", SyntaxTokenKind.RBRACE), r.closeBrace = this.previous();
|
|
13934
|
-
} catch (r) {
|
|
13935
|
-
throw r instanceof PartialParsingError ? new PartialParsingError(r.token, j(), r.handlerContext) : r;
|
|
13936
|
-
}
|
|
13937
|
-
return j();
|
|
14044
|
+
return isFromKeyword(this.peek()) ? r.fromKeyword = this.advance() : this.logError(this.peek(), CompileErrorCode.UNEXPECTED_TOKEN, `Expect 'from' after ${M}`), this.match(SyntaxTokenKind.STRING_LITERAL) ? r.importPath = this.previous() : this.logError(this.peek(), CompileErrorCode.UNEXPECTED_TOKEN, "Expect a string literal path"), j();
|
|
13938
14045
|
}
|
|
13939
14046
|
useSpecifier() {
|
|
13940
14047
|
let r = {}, j = () => this.nodeFactory.create(UseSpecifierNode, r);
|
|
13941
14048
|
try {
|
|
13942
14049
|
this.consume("Expect an import kind specifier (e.g. table, enum)", SyntaxTokenKind.IDENTIFIER), r.importKind = this.previous();
|
|
13943
14050
|
} catch (r) {
|
|
13944
|
-
|
|
14051
|
+
if (!(r instanceof PartialParsingError)) throw r;
|
|
14052
|
+
if (!this.canHandle(r)) throw new PartialParsingError(r.token, j(), r.handlerContext);
|
|
14053
|
+
this.synchronizeUseSpecifier();
|
|
13945
14054
|
}
|
|
13946
14055
|
if (this.check(SyntaxTokenKind.IDENTIFIER, SyntaxTokenKind.QUOTED_STRING)) try {
|
|
13947
14056
|
r.name = this.normalExpression();
|
|
13948
|
-
} catch (
|
|
13949
|
-
|
|
14057
|
+
} catch (M) {
|
|
14058
|
+
if (!(M instanceof PartialParsingError)) throw M;
|
|
14059
|
+
if (M.partialNode instanceof SyntaxNode && (r.name = M.partialNode), !this.canHandle(M)) throw new PartialParsingError(M.token, j(), M.handlerContext);
|
|
14060
|
+
this.synchronizeUseSpecifier();
|
|
13950
14061
|
}
|
|
13951
|
-
else this.logError(this.peek(), CompileErrorCode.UNEXPECTED_TOKEN, "Expect an element name");
|
|
14062
|
+
else r.importKind && this.logError(this.peek(), CompileErrorCode.UNEXPECTED_TOKEN, "Expect an element name");
|
|
13952
14063
|
if (isAsKeyword(this.peek())) {
|
|
13953
14064
|
r.asKeyword = this.advance();
|
|
13954
14065
|
try {
|
|
13955
14066
|
if (!this.check(SyntaxTokenKind.IDENTIFIER, SyntaxTokenKind.QUOTED_STRING)) throw this.logError(this.peek(), CompileErrorCode.UNEXPECTED_TOKEN, "Expect an alias name after 'as'"), new PartialParsingError(this.peek(), j(), this.contextStack.findHandlerContext(this.tokens, this.current));
|
|
13956
14067
|
r.alias = this.normalExpression();
|
|
13957
14068
|
} catch (r) {
|
|
13958
|
-
|
|
14069
|
+
if (!(r instanceof PartialParsingError)) throw r;
|
|
14070
|
+
if (!this.canHandle(r)) throw new PartialParsingError(r.token, j(), r.handlerContext);
|
|
14071
|
+
this.synchronizeUseSpecifier();
|
|
13959
14072
|
}
|
|
13960
14073
|
}
|
|
13961
14074
|
return j();
|
|
@@ -14335,7 +14448,7 @@ function postfixBindingPower(r) {
|
|
|
14335
14448
|
};
|
|
14336
14449
|
}
|
|
14337
14450
|
function parseFile(r) {
|
|
14338
|
-
let j = this.
|
|
14451
|
+
let j = this.getSource(r);
|
|
14339
14452
|
return new Lexer(j ?? "", r).lex().chain((M) => new Parser(j ?? "", M, this.nodeIdGenerator, r).parse()).map(({ ast: j, tokens: M }) => ({
|
|
14340
14453
|
ast: j,
|
|
14341
14454
|
tokens: M,
|
|
@@ -14343,7 +14456,7 @@ function parseFile(r) {
|
|
|
14343
14456
|
}));
|
|
14344
14457
|
}
|
|
14345
14458
|
function parseProject() {
|
|
14346
|
-
let r = collectTransitiveDependencies(this, this.layout.
|
|
14459
|
+
let r = collectTransitiveDependencies(this, this.layout.getEntrypoints()), j = /* @__PURE__ */ new Map();
|
|
14347
14460
|
for (let M of r) {
|
|
14348
14461
|
let r = this.parseFile(M);
|
|
14349
14462
|
j.set(M.absolute, r);
|
|
@@ -14414,11 +14527,30 @@ function resolutionIndex() {
|
|
|
14414
14527
|
};
|
|
14415
14528
|
N(M);
|
|
14416
14529
|
}
|
|
14530
|
+
let L = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Set();
|
|
14531
|
+
function z(r, M) {
|
|
14532
|
+
let N = M.intern();
|
|
14533
|
+
if (R.has(N)) return;
|
|
14534
|
+
R.add(N);
|
|
14535
|
+
let P = r.symbolMembers(M).getFiltered(UNHANDLED);
|
|
14536
|
+
if (P) for (let j of P) {
|
|
14537
|
+
let N = j.intern(), P = L.get(N);
|
|
14538
|
+
P || (P = [], L.set(N, P)), P.push(M), j instanceof SchemaSymbol && j.isKind(SymbolKind.Schema) && z(r, j);
|
|
14539
|
+
}
|
|
14540
|
+
}
|
|
14541
|
+
for (let r of N.values()) {
|
|
14542
|
+
let M = r.getValue().ast, N = this.nodeSymbol(M).getFiltered(UNHANDLED);
|
|
14543
|
+
N && z(this, N);
|
|
14544
|
+
}
|
|
14417
14545
|
return {
|
|
14418
14546
|
references: r,
|
|
14419
|
-
metadata: M
|
|
14547
|
+
metadata: M,
|
|
14548
|
+
parents: L
|
|
14420
14549
|
};
|
|
14421
14550
|
}
|
|
14551
|
+
function symbolParent(r) {
|
|
14552
|
+
return this.resolutionIndex().parents.get(r.intern()) ?? [];
|
|
14553
|
+
}
|
|
14422
14554
|
function symbolReferences(r) {
|
|
14423
14555
|
return this.resolutionIndex().references.get(r.intern()) ?? [];
|
|
14424
14556
|
}
|
|
@@ -14527,59 +14659,60 @@ function findReplacements(r, j, M, N, P) {
|
|
|
14527
14659
|
return F;
|
|
14528
14660
|
}
|
|
14529
14661
|
function renameTable(r, M, N) {
|
|
14530
|
-
let P =
|
|
14531
|
-
if (!
|
|
14532
|
-
if (
|
|
14533
|
-
let M =
|
|
14534
|
-
if (this.nodeAlias(M).getFiltered(UNHANDLED) ===
|
|
14535
|
-
}
|
|
14536
|
-
return renameRealDeclaration(this,
|
|
14537
|
-
}
|
|
14538
|
-
function renameAlias(r, j, M, N, P, F
|
|
14539
|
-
let
|
|
14540
|
-
if (!
|
|
14541
|
-
let
|
|
14542
|
-
|
|
14543
|
-
start:
|
|
14544
|
-
end:
|
|
14545
|
-
newText:
|
|
14662
|
+
let P = normalizeTableName(M), F = normalizeTableName(N), I = P.schema, L = P.table, R = F.schema, z = F.table, B = lookupTableSymbol(this, r, I, L);
|
|
14663
|
+
if (!B || B instanceof AliasSymbol || checkForNameCollision(this, r, I, L, R, z)) return /* @__PURE__ */ new Map();
|
|
14664
|
+
if (B instanceof UseSymbol && B.useSpecifierDeclaration instanceof UseSpecifierNode && B.useSpecifierDeclaration.alias) {
|
|
14665
|
+
let M = B.useSpecifierDeclaration;
|
|
14666
|
+
if (this.nodeAlias(M).getFiltered(UNHANDLED) === L) return renameAlias(this, r, M, B, R, z);
|
|
14667
|
+
}
|
|
14668
|
+
return renameRealDeclaration(this, B, I, L, R, z);
|
|
14669
|
+
}
|
|
14670
|
+
function renameAlias(r, j, M, N, P, F) {
|
|
14671
|
+
let I = r.getSource(j) ?? "";
|
|
14672
|
+
if (!M.alias) return /* @__PURE__ */ new Map();
|
|
14673
|
+
let L = formatTableName(P, F, I.substring(M.alias.start, M.alias.end).includes("\"")), R = [];
|
|
14674
|
+
R.push({
|
|
14675
|
+
start: M.alias.start,
|
|
14676
|
+
end: M.alias.end,
|
|
14677
|
+
newText: L.formattedTable
|
|
14546
14678
|
});
|
|
14547
|
-
let
|
|
14548
|
-
for (let r of
|
|
14679
|
+
let z = r.symbolReferences(N);
|
|
14680
|
+
for (let r of z) r.filepath.absolute === j.absolute && r !== M.alias && R.push({
|
|
14549
14681
|
start: r.start,
|
|
14550
14682
|
end: r.end,
|
|
14551
|
-
newText:
|
|
14683
|
+
newText: L.formattedTable
|
|
14552
14684
|
});
|
|
14553
|
-
return j.
|
|
14554
|
-
}
|
|
14555
|
-
function renameRealDeclaration(r, j, M, N, P, F
|
|
14556
|
-
let
|
|
14557
|
-
if (!
|
|
14558
|
-
let
|
|
14559
|
-
if (!
|
|
14560
|
-
let
|
|
14561
|
-
let M = r.absolute, N =
|
|
14685
|
+
return new Map([[j.absolute, applyTextEdits(I, R)]]);
|
|
14686
|
+
}
|
|
14687
|
+
function renameRealDeclaration(r, j, M, N, P, F) {
|
|
14688
|
+
let I = j.originalSymbol, L = I.declaration;
|
|
14689
|
+
if (!L || !(L instanceof ElementDeclarationNode)) return /* @__PURE__ */ new Map();
|
|
14690
|
+
let R = L.filepath;
|
|
14691
|
+
if (!R) return /* @__PURE__ */ new Map();
|
|
14692
|
+
let z = formatTableName(P, F, checkIfDeclarationUsesQuotes(L, r.getSource(R) ?? "")), B = /* @__PURE__ */ new Map(), V = (r, j) => {
|
|
14693
|
+
let M = r.absolute, N = B.get(M);
|
|
14562
14694
|
N || (N = {
|
|
14563
14695
|
fp: r,
|
|
14564
14696
|
edits: []
|
|
14565
|
-
},
|
|
14566
|
-
},
|
|
14567
|
-
|
|
14568
|
-
start:
|
|
14569
|
-
end:
|
|
14570
|
-
newText: buildReplacementText(
|
|
14697
|
+
}, B.set(M, N)), N.edits.push(j);
|
|
14698
|
+
}, H = L.name;
|
|
14699
|
+
H && V(R, {
|
|
14700
|
+
start: H.start,
|
|
14701
|
+
end: H.end,
|
|
14702
|
+
newText: buildReplacementText(z)
|
|
14571
14703
|
});
|
|
14572
|
-
let
|
|
14573
|
-
for (let j of
|
|
14574
|
-
if (j ===
|
|
14575
|
-
let
|
|
14576
|
-
for (let r of findReplacements([j],
|
|
14704
|
+
let U = r.symbolReferences(I);
|
|
14705
|
+
for (let j of U) {
|
|
14706
|
+
if (j === H) continue;
|
|
14707
|
+
let P = j.filepath, F = r.getSource(P) ?? "";
|
|
14708
|
+
for (let r of findReplacements([j], M, N, z, F)) V(P, r);
|
|
14577
14709
|
}
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14710
|
+
let W = /* @__PURE__ */ new Map();
|
|
14711
|
+
for (let { fp: j, edits: M } of B.values()) {
|
|
14712
|
+
let N = r.getSource(j) ?? "";
|
|
14713
|
+
W.set(j.absolute, applyTextEdits(N, M));
|
|
14581
14714
|
}
|
|
14582
|
-
return
|
|
14715
|
+
return W;
|
|
14583
14716
|
}
|
|
14584
14717
|
function findDiagramViewBlocks(r) {
|
|
14585
14718
|
let j = [], M = new Lexer(r, DEFAULT_ENTRY).lex();
|
|
@@ -14642,7 +14775,7 @@ function generateDiagramViewBlock(r, j) {
|
|
|
14642
14775
|
return B.length > 0 && emitTablesBlock(G, B), V.length > 0 && emitTableGroupsBlock(G, V), H.length > 0 && emitSchemasBlock(G, H), W && emitNotesBlock(G, I), G.push("}"), G.join("\n");
|
|
14643
14776
|
}
|
|
14644
14777
|
function syncDiagramView(r, j, M) {
|
|
14645
|
-
let N = this.
|
|
14778
|
+
let N = this.getSource(r) ?? "", P = M ?? findDiagramViewBlocks(N), F = [];
|
|
14646
14779
|
for (let r of j) {
|
|
14647
14780
|
let j = applyOperation(N, r, P);
|
|
14648
14781
|
F.push(...j);
|
|
@@ -14702,12 +14835,12 @@ function computeDeleteEdit(r, j, M) {
|
|
|
14702
14835
|
}];
|
|
14703
14836
|
}
|
|
14704
14837
|
var COMPUTING = Symbol("COMPUTING"), Compiler = class {
|
|
14705
|
-
constructor() {
|
|
14706
|
-
this.nodeIdGenerator = new SyntaxNodeIdGenerator(), this.symbolIdGenerator = new NodeSymbolIdGenerator(), this.symbolFactory = new SymbolFactory(this.symbolIdGenerator), this.
|
|
14838
|
+
constructor(r = new MemoryProjectLayout()) {
|
|
14839
|
+
this.nodeIdGenerator = new SyntaxNodeIdGenerator(), this.symbolIdGenerator = new NodeSymbolIdGenerator(), this.symbolFactory = new SymbolFactory(this.symbolIdGenerator), this.sourceSnapshot = /* @__PURE__ */ new Map(), this.globalCache = /* @__PURE__ */ new Map(), this.localCache = /* @__PURE__ */ new Map(), this.parseFile = this.localQuery(parseFile), this.parseProject = this.globalQuery(parseProject), this.validateNode = this.localQuery(validateNode), this.validateFile = this.localQuery(validateFile), this.nodeFullname = this.localQuery(nodeFullname), this.nodeAlias = this.localQuery(nodeAlias), this.nodeSettings = this.localQuery(nodeSettings), this.canonicalName = this.globalQuery(canonicalName), this.bindNode = this.globalQuery(bindNode), this.bindFile = this.globalQuery(bindFile), this.bindProject = this.globalQuery(bindProject), this.interpretSymbol = this.globalQuery(interpretSymbol), this.interpretMetadata = interpretMetadata.bind(this), this.interpretFile = this.globalQuery(interpretFile), this.interpretProject = this.globalQuery(interpretProject), this.nodeSymbol = this.globalQuery(nodeSymbol), this.nodeMetadata = this.globalQuery(nodeMetadata), this.symbolMembers = this.globalQuery(symbolMembers), this.lookupMembers = this.globalQuery(lookupMembers), this.nodeReferee = this.globalQuery(nodeReferee), this.resolutionIndex = this.globalQuery(resolutionIndex), this.symbolReferences = this.globalQuery(symbolReferences), this.symbolParent = this.globalQuery(symbolParent), this.symbolMetadata = this.globalQuery(symbolMetadata), this.symbolAliases = this.globalQuery(symbolAliases), this.symbolUses = this.globalQuery(symbolUses), this.fileDependencies = this.localQuery(fileDependencies), this.reachableFiles = this.globalQuery(reachableFiles), this.usableMembers = this.globalQuery(usableMembers), this.nodeAtPosition = this.localQuery(nodeAtPosition), this.renameTable = renameTable.bind(this), this.syncDiagramView = syncDiagramView.bind(this), this.token = {
|
|
14707
14840
|
invalidStream: this.localQuery(invalidStream),
|
|
14708
14841
|
flatStream: this.localQuery(flatStream)
|
|
14709
14842
|
}, this.parse = {
|
|
14710
|
-
source: (r) => this.
|
|
14843
|
+
source: (r) => this.getSource(r) || "",
|
|
14711
14844
|
ast: (r = DEFAULT_ENTRY) => ast.call(this, r),
|
|
14712
14845
|
errors: (r = DEFAULT_ENTRY) => errors.call(this, r),
|
|
14713
14846
|
warnings: (r = DEFAULT_ENTRY) => warnings.call(this, r),
|
|
@@ -14720,21 +14853,25 @@ var COMPUTING = Symbol("COMPUTING"), Compiler = class {
|
|
|
14720
14853
|
element: this.localQuery(containerElement),
|
|
14721
14854
|
scope: this.localQuery(containerScope),
|
|
14722
14855
|
scopeKind: this.localQuery(containerScopeKind)
|
|
14723
|
-
};
|
|
14856
|
+
}, this.layout = r;
|
|
14724
14857
|
}
|
|
14725
|
-
|
|
14726
|
-
this.layout.
|
|
14858
|
+
getSource(r) {
|
|
14859
|
+
return this.layout.getSource(r);
|
|
14727
14860
|
}
|
|
14728
|
-
|
|
14729
|
-
|
|
14861
|
+
cleanStaleLocalCache(r) {
|
|
14862
|
+
let j = this.layout.getSource(r), M = r.absolute;
|
|
14863
|
+
this.sourceSnapshot.has(M) && this.sourceSnapshot.get(M) !== j && (this.localCache.delete(r.intern()), this.globalCache.clear()), this.sourceSnapshot.set(M, j);
|
|
14730
14864
|
}
|
|
14731
|
-
|
|
14732
|
-
|
|
14865
|
+
cleanStaleGlobalCache() {
|
|
14866
|
+
let r = this.layout.getEntrypoints(), j = !1;
|
|
14867
|
+
this.entrypointsSnapshot !== void 0 && (this.entrypointsSnapshot.length !== r.length || this.entrypointsSnapshot.some((j, M) => j.absolute !== r[M].absolute)) && (j = !0), this.entrypointsSnapshot = r;
|
|
14868
|
+
for (let j of walkDependencies(this, r)) this.cleanStaleLocalCache(j);
|
|
14869
|
+
j && this.globalCache.clear();
|
|
14733
14870
|
}
|
|
14734
14871
|
globalQuery(r) {
|
|
14735
14872
|
let j = Symbol();
|
|
14736
14873
|
return ((...M) => {
|
|
14737
|
-
this.globalCache.has(j) || this.globalCache.set(j, /* @__PURE__ */ new Map());
|
|
14874
|
+
this.cleanStaleGlobalCache(), this.globalCache.has(j) || this.globalCache.set(j, /* @__PURE__ */ new Map());
|
|
14738
14875
|
let N = M.map((r) => intern(r)).join("\0"), P = this.globalCache.get(j);
|
|
14739
14876
|
if (P.has(N)) {
|
|
14740
14877
|
let j = P.get(N);
|
|
@@ -14753,25 +14890,27 @@ var COMPUTING = Symbol("COMPUTING"), Compiler = class {
|
|
|
14753
14890
|
localQuery(r) {
|
|
14754
14891
|
let j = Symbol();
|
|
14755
14892
|
return ((...M) => {
|
|
14756
|
-
let [N] = M, P =
|
|
14757
|
-
|
|
14758
|
-
let
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14893
|
+
let [N] = M, P = N instanceof SyntaxNode ? N.filepath : N;
|
|
14894
|
+
this.cleanStaleLocalCache(P);
|
|
14895
|
+
let F = P.intern(), I = M.map((r) => intern(r)).join("\0"), L = this.localCache.get(F);
|
|
14896
|
+
L || (L = /* @__PURE__ */ new Map(), this.localCache.set(F, L));
|
|
14897
|
+
let R = L.get(j);
|
|
14898
|
+
if (R || (R = /* @__PURE__ */ new Map(), L.set(j, R)), R.has(I)) {
|
|
14899
|
+
let j = R.get(I);
|
|
14900
|
+
if (j === COMPUTING) throw Error(`Cycle detected in query: ${r.name}(${F}, ${I})`);
|
|
14762
14901
|
return j;
|
|
14763
14902
|
}
|
|
14764
|
-
|
|
14903
|
+
R.set(I, COMPUTING);
|
|
14765
14904
|
try {
|
|
14766
14905
|
let j = r.apply(this, M);
|
|
14767
|
-
return
|
|
14906
|
+
return R.set(I, j), j;
|
|
14768
14907
|
} catch (r) {
|
|
14769
|
-
throw
|
|
14908
|
+
throw R.delete(I), r;
|
|
14770
14909
|
}
|
|
14771
14910
|
});
|
|
14772
14911
|
}
|
|
14773
14912
|
findDiagramViewBlocks(r) {
|
|
14774
|
-
return findDiagramViewBlocks(this.
|
|
14913
|
+
return findDiagramViewBlocks(this.getSource(r) ?? "");
|
|
14775
14914
|
}
|
|
14776
14915
|
initMonacoServices(r) {
|
|
14777
14916
|
let j = r?.autocompletion?.triggerCharacters ?? [
|
|
@@ -14797,4 +14936,4 @@ var COMPUTING = Symbol("COMPUTING"), Compiler = class {
|
|
|
14797
14936
|
};
|
|
14798
14937
|
}
|
|
14799
14938
|
};
|
|
14800
|
-
export { ArrayNode, AttributeNode, BlockExpressionNode, CallExpressionNode, CommaExpressionNode, CompileError, CompileErrorCode, Compiler, CompletionItemInsertTextRule, CompletionItemKind, DBMLCompletionItemProvider, DBMLDefinitionProvider, DBMLDiagnosticsProvider, DBMLReferencesProvider, DEFAULT_ENTRY, ElementDeclarationNode, ElementKind, EmptyNode, FALSY_VALUES, Filepath, FunctionApplicationNode, FunctionExpressionNode, GroupExpressionNode, IdentifierStreamNode, InfixExpressionNode, ListExpressionNode, LiteralNode, MarkerSeverity, MemoryProjectLayout, PostfixExpressionNode, PrefixExpressionNode, PrimaryExpressionNode, ProgramNode, ScopeKind, SymbolKind, SyntaxNode, SyntaxNodeIdGenerator, SyntaxNodeKind, SyntaxToken, SyntaxTokenKind, TRUTHY_VALUES, TupleExpressionNode, UNHANDLED, URI as Uri, UseDeclarationNode, UseSpecifierListNode, UseSpecifierNode, VariableNode, WildcardNode, addDoubleQuoteIfNeeded, dbmlLanguageConfig, dbmlMonarchTokensProvider, escapeString, extractNumericLiteral, extractSignedNumber, formatRecordValue, getRecordValueType, isBinaryType, isBooleanType, isDateTimeType, isEmptyStringLiteral, isFloatType, isFunctionExpression, isIntegerType, isNullish, isNumericType, isOp, isOpToken, isSerialType, isStringType, isTriviaToken, isValidIdentifier, normalizeTypeName, splitQualifiedIdentifier, tryExtractBoolean, tryExtractDateTime, tryExtractEnum, tryExtractInteger, tryExtractNumeric, tryExtractString, unescapeString };
|
|
14939
|
+
export { ArrayNode, AttributeNode, BlockExpressionNode, CallExpressionNode, CommaExpressionNode, CompileError, CompileErrorCode, Compiler, CompletionItemInsertTextRule, CompletionItemKind, DBMLCompletionItemProvider, DBMLDefinitionProvider, DBMLDiagnosticsProvider, DBMLReferencesProvider, DEFAULT_ENTRY, ElementDeclarationNode, ElementKind, EmptyNode, FALSY_VALUES, Filepath, FunctionApplicationNode, FunctionExpressionNode, GroupExpressionNode, IdentifierStreamNode, InfixExpressionNode, ListExpressionNode, LiteralNode, MarkerSeverity, MemoryProjectLayout, PostfixExpressionNode, PrefixExpressionNode, PrimaryExpressionNode, ProgramNode, ScopeKind, SymbolKind, SyntaxNode, SyntaxNodeIdGenerator, SyntaxNodeKind, SyntaxToken, SyntaxTokenKind, TRUTHY_VALUES, TupleExpressionNode, UNHANDLED, URI as Uri, UseDeclarationNode, UseSpecifierListNode, UseSpecifierNode, VariableNode, WildcardNode, addDoubleQuoteIfNeeded, dbmlLanguageConfig, dbmlMonarchTokensProvider, escapeString, extractNumericLiteral, extractSignedNumber, formatRecordValue, getRecordValueType, isBinaryType, isBooleanType, isDateTimeType, isEmptyStringLiteral, isFloatType, isFunctionExpression, isIntegerType, isNullish, isNumericType, isOp, isOpToken, isSerialType, isStringType, isTriviaToken, isValidIdentifier, normalizeTypeName, splitQualifiedIdentifier, tryExtractBoolean, tryExtractDateTime, tryExtractEnum, tryExtractInteger, tryExtractNumeric, tryExtractString, unescapeString, validateForeignKeys, validatePrimaryKey, validateUnique };
|