@abaplint/core 2.111.1 → 2.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abaplint.d.ts +17 -8
- package/build/src/abap/5_syntax/_builtin.js +2 -2
- package/build/src/abap/5_syntax/_current_scope.js +2 -0
- package/build/src/abap/5_syntax/_procedural.js +6 -2
- package/build/src/abap/5_syntax/_syntax_input.js +11 -0
- package/build/src/abap/5_syntax/assert_error.js +7 -0
- package/build/src/abap/5_syntax/basic_types.js +78 -79
- package/build/src/abap/5_syntax/expressions/attribute_chain.js +15 -8
- package/build/src/abap/5_syntax/expressions/attribute_name.js +24 -11
- package/build/src/abap/5_syntax/expressions/cast.js +24 -13
- package/build/src/abap/5_syntax/expressions/compare.js +4 -4
- package/build/src/abap/5_syntax/expressions/component_chain.js +26 -11
- package/build/src/abap/5_syntax/expressions/component_compare.js +7 -4
- package/build/src/abap/5_syntax/expressions/component_compare_simple.js +11 -6
- package/build/src/abap/5_syntax/expressions/component_cond.js +3 -3
- package/build/src/abap/5_syntax/expressions/component_name.js +10 -5
- package/build/src/abap/5_syntax/expressions/cond.js +3 -6
- package/build/src/abap/5_syntax/expressions/cond_body.js +6 -6
- package/build/src/abap/5_syntax/expressions/conv_body.js +9 -8
- package/build/src/abap/5_syntax/expressions/corresponding_body.js +3 -3
- package/build/src/abap/5_syntax/expressions/data_definition.js +7 -7
- package/build/src/abap/5_syntax/expressions/database_table.js +9 -7
- package/build/src/abap/5_syntax/expressions/default.js +2 -2
- package/build/src/abap/5_syntax/expressions/dereference.js +5 -2
- package/build/src/abap/5_syntax/expressions/dynamic.js +2 -2
- package/build/src/abap/5_syntax/expressions/field_assignment.js +12 -5
- package/build/src/abap/5_syntax/expressions/field_chain.js +40 -25
- package/build/src/abap/5_syntax/expressions/field_length.js +2 -2
- package/build/src/abap/5_syntax/expressions/field_offset.js +2 -2
- package/build/src/abap/5_syntax/expressions/filter_body.js +3 -3
- package/build/src/abap/5_syntax/expressions/for.js +11 -11
- package/build/src/abap/5_syntax/expressions/form_param.js +10 -9
- package/build/src/abap/5_syntax/expressions/fstarget.js +8 -5
- package/build/src/abap/5_syntax/expressions/inline_data.js +11 -8
- package/build/src/abap/5_syntax/expressions/inline_field_definition.js +12 -8
- package/build/src/abap/5_syntax/expressions/inline_fs.js +7 -7
- package/build/src/abap/5_syntax/expressions/inline_loop_definition.js +16 -11
- package/build/src/abap/5_syntax/expressions/let.js +3 -3
- package/build/src/abap/5_syntax/expressions/loop_group_by.js +5 -15
- package/build/src/abap/5_syntax/expressions/message_source.js +4 -4
- package/build/src/abap/5_syntax/expressions/method_call_body.js +4 -4
- package/build/src/abap/5_syntax/expressions/method_call_chain.js +34 -25
- package/build/src/abap/5_syntax/expressions/method_call_param.js +33 -14
- package/build/src/abap/5_syntax/expressions/method_def_returning.js +7 -6
- package/build/src/abap/5_syntax/expressions/method_param.js +11 -10
- package/build/src/abap/5_syntax/expressions/method_parameters.js +76 -49
- package/build/src/abap/5_syntax/expressions/method_source.js +47 -38
- package/build/src/abap/5_syntax/expressions/new_object.js +48 -28
- package/build/src/abap/5_syntax/expressions/raise_with.js +2 -2
- package/build/src/abap/5_syntax/expressions/reduce_body.js +10 -10
- package/build/src/abap/5_syntax/expressions/reduce_next.js +3 -3
- package/build/src/abap/5_syntax/expressions/select.js +48 -33
- package/build/src/abap/5_syntax/expressions/select_loop.js +2 -2
- package/build/src/abap/5_syntax/expressions/source.js +74 -64
- package/build/src/abap/5_syntax/expressions/source_field.js +12 -6
- package/build/src/abap/5_syntax/expressions/source_field_symbol.js +8 -4
- package/build/src/abap/5_syntax/expressions/sql_compare.js +11 -19
- package/build/src/abap/5_syntax/expressions/sql_for_all_entries.js +7 -4
- package/build/src/abap/5_syntax/expressions/sql_from.js +3 -3
- package/build/src/abap/5_syntax/expressions/sql_in.js +34 -0
- package/build/src/abap/5_syntax/expressions/sql_order_by.js +2 -2
- package/build/src/abap/5_syntax/expressions/sql_source.js +3 -3
- package/build/src/abap/5_syntax/expressions/string_template.js +16 -8
- package/build/src/abap/5_syntax/expressions/switch_body.js +8 -4
- package/build/src/abap/5_syntax/expressions/table_expression.js +2 -2
- package/build/src/abap/5_syntax/expressions/target.js +50 -29
- package/build/src/abap/5_syntax/expressions/type_table.js +7 -7
- package/build/src/abap/5_syntax/expressions/value_body.js +17 -12
- package/build/src/abap/5_syntax/global_definitions/find_global_definitions.js +19 -6
- package/build/src/abap/5_syntax/spaghetti_scope.js +2 -1
- package/build/src/abap/5_syntax/statements/add.js +3 -3
- package/build/src/abap/5_syntax/statements/add_corresponding.js +3 -3
- package/build/src/abap/5_syntax/statements/append.js +25 -14
- package/build/src/abap/5_syntax/statements/assert.js +2 -2
- package/build/src/abap/5_syntax/statements/assign.js +17 -12
- package/build/src/abap/5_syntax/statements/authority_check.js +2 -2
- package/build/src/abap/5_syntax/statements/call.js +8 -5
- package/build/src/abap/5_syntax/statements/call_badi.js +4 -4
- package/build/src/abap/5_syntax/statements/call_function.js +12 -9
- package/build/src/abap/5_syntax/statements/call_kernel.js +2 -2
- package/build/src/abap/5_syntax/statements/call_transaction.js +3 -3
- package/build/src/abap/5_syntax/statements/call_transformation.js +5 -5
- package/build/src/abap/5_syntax/statements/case.js +2 -2
- package/build/src/abap/5_syntax/statements/case_type.js +2 -2
- package/build/src/abap/5_syntax/statements/catch.js +24 -19
- package/build/src/abap/5_syntax/statements/check.js +2 -2
- package/build/src/abap/5_syntax/statements/class_data.js +9 -5
- package/build/src/abap/5_syntax/statements/class_deferred.js +2 -2
- package/build/src/abap/5_syntax/statements/class_implementation.js +16 -13
- package/build/src/abap/5_syntax/statements/class_local_friends.js +16 -9
- package/build/src/abap/5_syntax/statements/clear.js +3 -3
- package/build/src/abap/5_syntax/statements/close_dataset.js +2 -2
- package/build/src/abap/5_syntax/statements/collect.js +4 -4
- package/build/src/abap/5_syntax/statements/commit_entities.js +4 -4
- package/build/src/abap/5_syntax/statements/concatenate.js +18 -11
- package/build/src/abap/5_syntax/statements/condense.js +2 -2
- package/build/src/abap/5_syntax/statements/constant.js +6 -5
- package/build/src/abap/5_syntax/statements/controls.js +5 -5
- package/build/src/abap/5_syntax/statements/convert.js +8 -8
- package/build/src/abap/5_syntax/statements/create_data.js +11 -11
- package/build/src/abap/5_syntax/statements/create_object.js +49 -26
- package/build/src/abap/5_syntax/statements/data.js +8 -4
- package/build/src/abap/5_syntax/statements/delete_cluster.js +4 -4
- package/build/src/abap/5_syntax/statements/delete_database.js +5 -5
- package/build/src/abap/5_syntax/statements/delete_internal.js +7 -7
- package/build/src/abap/5_syntax/statements/delete_report.js +2 -2
- package/build/src/abap/5_syntax/statements/describe.js +13 -13
- package/build/src/abap/5_syntax/statements/divide.js +3 -3
- package/build/src/abap/5_syntax/statements/do.js +8 -5
- package/build/src/abap/5_syntax/statements/editor_call.js +3 -3
- package/build/src/abap/5_syntax/statements/else_if.js +2 -2
- package/build/src/abap/5_syntax/statements/export.js +5 -5
- package/build/src/abap/5_syntax/statements/fieldsymbol.js +4 -4
- package/build/src/abap/5_syntax/statements/find.js +13 -13
- package/build/src/abap/5_syntax/statements/form.js +10 -7
- package/build/src/abap/5_syntax/statements/format.js +2 -2
- package/build/src/abap/5_syntax/statements/get_badi.js +4 -4
- package/build/src/abap/5_syntax/statements/get_bit.js +9 -6
- package/build/src/abap/5_syntax/statements/get_cursor.js +2 -2
- package/build/src/abap/5_syntax/statements/get_locale.js +3 -3
- package/build/src/abap/5_syntax/statements/get_parameter.js +4 -4
- package/build/src/abap/5_syntax/statements/get_reference.js +8 -5
- package/build/src/abap/5_syntax/statements/get_run_time.js +3 -3
- package/build/src/abap/5_syntax/statements/get_time.js +3 -3
- package/build/src/abap/5_syntax/statements/if.js +2 -2
- package/build/src/abap/5_syntax/statements/import.js +5 -5
- package/build/src/abap/5_syntax/statements/import_dynpro.js +3 -3
- package/build/src/abap/5_syntax/statements/include_type.js +9 -5
- package/build/src/abap/5_syntax/statements/insert_database.js +5 -5
- package/build/src/abap/5_syntax/statements/insert_field_group.js +4 -4
- package/build/src/abap/5_syntax/statements/insert_internal.js +22 -13
- package/build/src/abap/5_syntax/statements/insert_report.js +2 -2
- package/build/src/abap/5_syntax/statements/insert_textpool.js +2 -2
- package/build/src/abap/5_syntax/statements/interface_deferred.js +2 -2
- package/build/src/abap/5_syntax/statements/log_point.js +2 -2
- package/build/src/abap/5_syntax/statements/loop.js +29 -16
- package/build/src/abap/5_syntax/statements/loop_at_screen.js +3 -3
- package/build/src/abap/5_syntax/statements/message.js +6 -6
- package/build/src/abap/5_syntax/statements/method_implementation.js +18 -13
- package/build/src/abap/5_syntax/statements/modify_database.js +8 -8
- package/build/src/abap/5_syntax/statements/modify_entities.js +4 -4
- package/build/src/abap/5_syntax/statements/modify_internal.js +15 -8
- package/build/src/abap/5_syntax/statements/modify_screen.js +2 -2
- package/build/src/abap/5_syntax/statements/move.js +17 -10
- package/build/src/abap/5_syntax/statements/move_corresponding.js +14 -7
- package/build/src/abap/5_syntax/statements/multiply.js +3 -3
- package/build/src/abap/5_syntax/statements/open_dataset.js +3 -3
- package/build/src/abap/5_syntax/statements/pack.js +3 -3
- package/build/src/abap/5_syntax/statements/parameter.js +11 -6
- package/build/src/abap/5_syntax/statements/perform.js +12 -8
- package/build/src/abap/5_syntax/statements/raise.js +23 -18
- package/build/src/abap/5_syntax/statements/raise_event.js +4 -4
- package/build/src/abap/5_syntax/statements/ranges.js +6 -5
- package/build/src/abap/5_syntax/statements/read_entities.js +4 -4
- package/build/src/abap/5_syntax/statements/read_report.js +3 -3
- package/build/src/abap/5_syntax/statements/read_table.js +40 -21
- package/build/src/abap/5_syntax/statements/read_textpool.js +3 -3
- package/build/src/abap/5_syntax/statements/receive.js +3 -3
- package/build/src/abap/5_syntax/statements/replace.js +3 -3
- package/build/src/abap/5_syntax/statements/scan.js +3 -3
- package/build/src/abap/5_syntax/statements/search.js +2 -2
- package/build/src/abap/5_syntax/statements/select.js +2 -2
- package/build/src/abap/5_syntax/statements/select_loop.js +2 -2
- package/build/src/abap/5_syntax/statements/selection_screen.js +4 -4
- package/build/src/abap/5_syntax/statements/selectoption.js +9 -6
- package/build/src/abap/5_syntax/statements/set_bit.js +8 -5
- package/build/src/abap/5_syntax/statements/set_handler.js +3 -3
- package/build/src/abap/5_syntax/statements/set_locale.js +3 -3
- package/build/src/abap/5_syntax/statements/set_parameter.js +2 -2
- package/build/src/abap/5_syntax/statements/set_pf_status.js +2 -2
- package/build/src/abap/5_syntax/statements/set_titlebar.js +2 -2
- package/build/src/abap/5_syntax/statements/shift.js +15 -8
- package/build/src/abap/5_syntax/statements/sort.js +16 -7
- package/build/src/abap/5_syntax/statements/split.js +12 -7
- package/build/src/abap/5_syntax/statements/static.js +4 -4
- package/build/src/abap/5_syntax/statements/submit.js +4 -4
- package/build/src/abap/5_syntax/statements/subtract.js +3 -3
- package/build/src/abap/5_syntax/statements/subtract_corresponding.js +3 -3
- package/build/src/abap/5_syntax/statements/syntax_check.js +3 -3
- package/build/src/abap/5_syntax/statements/system_call.js +2 -2
- package/build/src/abap/5_syntax/statements/tables.js +7 -7
- package/build/src/abap/5_syntax/statements/transfer.js +3 -3
- package/build/src/abap/5_syntax/statements/translate.js +3 -3
- package/build/src/abap/5_syntax/statements/truncate_dataset.js +2 -2
- package/build/src/abap/5_syntax/statements/type.js +12 -7
- package/build/src/abap/5_syntax/statements/unassign.js +7 -4
- package/build/src/abap/5_syntax/statements/unpack.js +3 -3
- package/build/src/abap/5_syntax/statements/update_database.js +11 -11
- package/build/src/abap/5_syntax/statements/wait.js +3 -3
- package/build/src/abap/5_syntax/statements/when.js +2 -2
- package/build/src/abap/5_syntax/statements/when_type.js +9 -6
- package/build/src/abap/5_syntax/statements/while.js +4 -4
- package/build/src/abap/5_syntax/statements/with.js +3 -3
- package/build/src/abap/5_syntax/statements/with_loop.js +3 -3
- package/build/src/abap/5_syntax/statements/write.js +14 -10
- package/build/src/abap/5_syntax/structures/class_data.js +3 -3
- package/build/src/abap/5_syntax/structures/constants.js +6 -5
- package/build/src/abap/5_syntax/structures/data.js +17 -13
- package/build/src/abap/5_syntax/structures/statics.js +16 -11
- package/build/src/abap/5_syntax/structures/type_enum.js +15 -13
- package/build/src/abap/5_syntax/structures/types.js +9 -9
- package/build/src/abap/5_syntax/syntax.js +32 -16
- package/build/src/abap/types/class_attributes.js +30 -30
- package/build/src/abap/types/class_definition.js +29 -29
- package/build/src/abap/types/event_definition.js +5 -5
- package/build/src/abap/types/form_definition.js +13 -13
- package/build/src/abap/types/interface_definition.js +19 -19
- package/build/src/abap/types/method_definition.js +10 -10
- package/build/src/abap/types/method_definitions.js +9 -10
- package/build/src/abap/types/method_parameters.js +29 -29
- package/build/src/issue.js +12 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/check_syntax.js +2 -1
- package/package.json +3 -3
|
@@ -3,16 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FieldAssignment = void 0;
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const basic_1 = require("../../types/basic");
|
|
6
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
6
7
|
const source_1 = require("./source");
|
|
7
8
|
class FieldAssignment {
|
|
8
|
-
runSyntax(node,
|
|
9
|
+
runSyntax(node, input, targetType) {
|
|
9
10
|
const fieldSub = node.findDirectExpression(Expressions.FieldSub);
|
|
10
11
|
if (fieldSub === undefined) {
|
|
11
|
-
|
|
12
|
+
const message = "FieldAssignment, FieldSub node not found";
|
|
13
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
14
|
+
return;
|
|
12
15
|
}
|
|
13
16
|
const s = node.findDirectExpression(Expressions.Source);
|
|
14
17
|
if (s === undefined) {
|
|
15
|
-
|
|
18
|
+
const message = "FieldAssignment, Source node not found";
|
|
19
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
20
|
+
return;
|
|
16
21
|
}
|
|
17
22
|
let type = undefined;
|
|
18
23
|
if (targetType instanceof basic_1.StructureType) {
|
|
@@ -22,7 +27,9 @@ class FieldAssignment {
|
|
|
22
27
|
if (text !== "-" && context instanceof basic_1.StructureType) {
|
|
23
28
|
context = context.getComponentByName(text);
|
|
24
29
|
if (context === undefined && targetType.containsVoid() === false) {
|
|
25
|
-
|
|
30
|
+
const message = `field ${text} does not exist in structure`;
|
|
31
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
32
|
+
return;
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
}
|
|
@@ -31,7 +38,7 @@ class FieldAssignment {
|
|
|
31
38
|
else if (targetType instanceof basic_1.VoidType) {
|
|
32
39
|
type = targetType;
|
|
33
40
|
}
|
|
34
|
-
new source_1.Source().runSyntax(s,
|
|
41
|
+
new source_1.Source().runSyntax(s, input, type);
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
exports.FieldAssignment = FieldAssignment;
|
|
@@ -15,8 +15,9 @@ const expressions_1 = require("../../2_statements/expressions");
|
|
|
15
15
|
const dereference_1 = require("./dereference");
|
|
16
16
|
const source_field_symbol_1 = require("./source_field_symbol");
|
|
17
17
|
const source_field_1 = require("./source_field");
|
|
18
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
18
19
|
class FieldChain {
|
|
19
|
-
runSyntax(node,
|
|
20
|
+
runSyntax(node, input, refType) {
|
|
20
21
|
var _a, _b, _c;
|
|
21
22
|
if (((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SourceField
|
|
22
23
|
&& node.findDirectExpression(Expressions.ComponentName)) {
|
|
@@ -24,10 +25,10 @@ class FieldChain {
|
|
|
24
25
|
const concat = node.concatTokens();
|
|
25
26
|
const offset = ((_b = node.findDirectExpression(Expressions.FieldOffset)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
|
|
26
27
|
const length = ((_c = node.findDirectExpression(Expressions.FieldLength)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
|
|
27
|
-
const found = scope.findVariable(concat.replace(offset, "").replace(length, ""));
|
|
28
|
+
const found = input.scope.findVariable(concat.replace(offset, "").replace(length, ""));
|
|
28
29
|
if (found) {
|
|
29
30
|
if (refType) {
|
|
30
|
-
scope.addReference(node.getFirstToken(), found, refType, filename);
|
|
31
|
+
input.scope.addReference(node.getFirstToken(), found, refType, input.filename);
|
|
31
32
|
}
|
|
32
33
|
// this is not completely correct, but will work, dashes in names is a mess anyhow
|
|
33
34
|
return found.getType();
|
|
@@ -35,18 +36,22 @@ class FieldChain {
|
|
|
35
36
|
}
|
|
36
37
|
let context = undefined;
|
|
37
38
|
const children = node.getChildren();
|
|
38
|
-
context = this.findTop(children[0],
|
|
39
|
+
context = this.findTop(children[0], input, refType);
|
|
39
40
|
for (let i = 1; i < children.length; i++) {
|
|
40
41
|
const current = children[i];
|
|
41
42
|
if (current === undefined) {
|
|
42
43
|
break;
|
|
43
44
|
}
|
|
44
45
|
if (current.get() instanceof tokens_1.DashW) {
|
|
45
|
-
|
|
46
|
+
const message = "Ending with dash";
|
|
47
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
|
|
48
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
46
49
|
}
|
|
47
50
|
else if (current.get() instanceof tokens_1.Dash) {
|
|
48
51
|
if (context instanceof basic_1.UnknownType) {
|
|
49
|
-
|
|
52
|
+
const message = "Not a structure, type unknown, FieldChain";
|
|
53
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
|
|
54
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
50
55
|
}
|
|
51
56
|
else if (!(context instanceof basic_1.StructureType)
|
|
52
57
|
&& !(context instanceof basic_1.TableType && context.isWithHeader())
|
|
@@ -56,7 +61,7 @@ class FieldChain {
|
|
|
56
61
|
for (let j = 0; j < i; j++) {
|
|
57
62
|
contextName += children[j].concatTokens();
|
|
58
63
|
}
|
|
59
|
-
if (scope.isAllowHeaderUse(contextName)) {
|
|
64
|
+
if (input.scope.isAllowHeaderUse(contextName)) {
|
|
60
65
|
// FOR ALL ENTRIES workaround
|
|
61
66
|
context = context.getRowType();
|
|
62
67
|
if (!(context instanceof basic_1.StructureType) && !(context instanceof basic_1.VoidType)) {
|
|
@@ -64,11 +69,15 @@ class FieldChain {
|
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
else {
|
|
67
|
-
|
|
72
|
+
const message = "Table without header, cannot access fields, " + contextName;
|
|
73
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
|
|
74
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
else {
|
|
71
|
-
|
|
78
|
+
const message = "Not a structure, FieldChain";
|
|
79
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
|
|
80
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
72
81
|
}
|
|
73
82
|
}
|
|
74
83
|
}
|
|
@@ -76,33 +85,37 @@ class FieldChain {
|
|
|
76
85
|
if (!(context instanceof basic_1.ObjectReferenceType)
|
|
77
86
|
&& !(context instanceof basic_1.DataReference)
|
|
78
87
|
&& !(context instanceof basic_1.VoidType)) {
|
|
79
|
-
|
|
88
|
+
const message = "Not an object reference, field chain";
|
|
89
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
|
|
90
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
else if (current.get() instanceof expressions_1.Dereference) {
|
|
83
|
-
context = new dereference_1.Dereference().runSyntax(context);
|
|
94
|
+
context = new dereference_1.Dereference().runSyntax(current, context, input);
|
|
84
95
|
}
|
|
85
96
|
else if (current.get() instanceof Expressions.ComponentName) {
|
|
86
97
|
if (context instanceof basic_1.TableType && context.isWithHeader()) {
|
|
87
98
|
context = context.getRowType();
|
|
88
99
|
}
|
|
89
|
-
context = new component_name_1.ComponentName().runSyntax(context, current);
|
|
100
|
+
context = new component_name_1.ComponentName().runSyntax(context, current, input);
|
|
90
101
|
}
|
|
91
102
|
else if (current instanceof nodes_1.ExpressionNode
|
|
92
103
|
&& current.get() instanceof Expressions.TableExpression) {
|
|
93
104
|
if (!(context instanceof basic_1.TableType) && !(context instanceof basic_1.VoidType)) {
|
|
94
|
-
|
|
105
|
+
const message = "Table expression, expected table";
|
|
106
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
|
|
107
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
95
108
|
}
|
|
96
|
-
new table_expression_1.TableExpression().runSyntax(current,
|
|
109
|
+
new table_expression_1.TableExpression().runSyntax(current, input);
|
|
97
110
|
if (!(context instanceof basic_1.VoidType)) {
|
|
98
111
|
context = context.getRowType();
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
114
|
else if (current.get() instanceof Expressions.AttributeName) {
|
|
102
|
-
context = new attribute_name_1.AttributeName().runSyntax(context, current,
|
|
115
|
+
context = new attribute_name_1.AttributeName().runSyntax(context, current, input, refType);
|
|
103
116
|
}
|
|
104
117
|
else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {
|
|
105
|
-
const offset = new field_offset_1.FieldOffset().runSyntax(current,
|
|
118
|
+
const offset = new field_offset_1.FieldOffset().runSyntax(current, input);
|
|
106
119
|
if (offset) {
|
|
107
120
|
if (context instanceof basic_1.CharacterType) {
|
|
108
121
|
context = new basic_1.CharacterType(context.getLength() - offset);
|
|
@@ -113,7 +126,7 @@ class FieldChain {
|
|
|
113
126
|
}
|
|
114
127
|
}
|
|
115
128
|
else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {
|
|
116
|
-
const length = new field_length_1.FieldLength().runSyntax(current,
|
|
129
|
+
const length = new field_length_1.FieldLength().runSyntax(current, input);
|
|
117
130
|
if (length) {
|
|
118
131
|
if (context instanceof basic_1.CharacterType) {
|
|
119
132
|
context = new basic_1.CharacterType(length);
|
|
@@ -127,17 +140,17 @@ class FieldChain {
|
|
|
127
140
|
return context;
|
|
128
141
|
}
|
|
129
142
|
////////////////
|
|
130
|
-
findTop(node,
|
|
143
|
+
findTop(node, input, type) {
|
|
131
144
|
if (node === undefined) {
|
|
132
145
|
return undefined;
|
|
133
146
|
}
|
|
134
147
|
if (node instanceof nodes_1.ExpressionNode
|
|
135
148
|
&& node.get() instanceof Expressions.SourceFieldSymbol) {
|
|
136
|
-
return new source_field_symbol_1.SourceFieldSymbol().runSyntax(node,
|
|
149
|
+
return new source_field_symbol_1.SourceFieldSymbol().runSyntax(node, input);
|
|
137
150
|
}
|
|
138
151
|
else if (node instanceof nodes_1.ExpressionNode
|
|
139
152
|
&& node.get() instanceof Expressions.SourceField) {
|
|
140
|
-
return new source_field_1.SourceField().runSyntax(node,
|
|
153
|
+
return new source_field_1.SourceField().runSyntax(node, input, type);
|
|
141
154
|
}
|
|
142
155
|
else if (node.get() instanceof Expressions.ClassName) {
|
|
143
156
|
const classTok = node.getFirstToken();
|
|
@@ -145,17 +158,19 @@ class FieldChain {
|
|
|
145
158
|
if (classNam.toUpperCase() === "OBJECT") {
|
|
146
159
|
return new basic_1.GenericObjectReferenceType();
|
|
147
160
|
}
|
|
148
|
-
const found = scope.existsObject(classNam);
|
|
161
|
+
const found = input.scope.existsObject(classNam);
|
|
149
162
|
if (found === null || found === void 0 ? void 0 : found.id) {
|
|
150
|
-
scope.addReference(classTok, found.id, _reference_1.ReferenceType.ObjectOrientedReference, filename);
|
|
163
|
+
input.scope.addReference(classTok, found.id, _reference_1.ReferenceType.ObjectOrientedReference, input.filename);
|
|
151
164
|
return new basic_1.ObjectReferenceType(found.id);
|
|
152
165
|
}
|
|
153
|
-
else if (scope.getDDIC().inErrorNamespace(classNam) === false) {
|
|
154
|
-
scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, { ooName: classNam.toUpperCase() });
|
|
166
|
+
else if (input.scope.getDDIC().inErrorNamespace(classNam) === false) {
|
|
167
|
+
input.scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename, { ooName: classNam.toUpperCase() });
|
|
155
168
|
return new basic_1.VoidType(classNam);
|
|
156
169
|
}
|
|
157
170
|
else {
|
|
158
|
-
|
|
171
|
+
const message = "Unknown class " + classNam;
|
|
172
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
173
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
159
174
|
}
|
|
160
175
|
}
|
|
161
176
|
return undefined;
|
|
@@ -5,10 +5,10 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const _reference_1 = require("../_reference");
|
|
6
6
|
const field_chain_1 = require("./field_chain");
|
|
7
7
|
class FieldLength {
|
|
8
|
-
runSyntax(node,
|
|
8
|
+
runSyntax(node, input) {
|
|
9
9
|
const field = node.findDirectExpression(Expressions.SimpleFieldChain2);
|
|
10
10
|
if (field) {
|
|
11
|
-
new field_chain_1.FieldChain().runSyntax(field,
|
|
11
|
+
new field_chain_1.FieldChain().runSyntax(field, input, _reference_1.ReferenceType.DataReadReference);
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
@@ -5,10 +5,10 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const _reference_1 = require("../_reference");
|
|
6
6
|
const field_chain_1 = require("./field_chain");
|
|
7
7
|
class FieldOffset {
|
|
8
|
-
runSyntax(node,
|
|
8
|
+
runSyntax(node, input) {
|
|
9
9
|
const field = node.findDirectExpression(Expressions.SimpleFieldChain2);
|
|
10
10
|
if (field) {
|
|
11
|
-
new field_chain_1.FieldChain().runSyntax(field,
|
|
11
|
+
new field_chain_1.FieldChain().runSyntax(field, input, _reference_1.ReferenceType.DataReadReference);
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
@@ -4,17 +4,17 @@ exports.FilterBody = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const source_1 = require("./source");
|
|
6
6
|
class FilterBody {
|
|
7
|
-
runSyntax(node,
|
|
7
|
+
runSyntax(node, input, targetType) {
|
|
8
8
|
if (node === undefined) {
|
|
9
9
|
return targetType;
|
|
10
10
|
}
|
|
11
11
|
let type = undefined;
|
|
12
12
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
13
13
|
if (type === undefined) {
|
|
14
|
-
type = new source_1.Source().runSyntax(s,
|
|
14
|
+
type = new source_1.Source().runSyntax(s, input);
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
new source_1.Source().runSyntax(s,
|
|
17
|
+
new source_1.Source().runSyntax(s, input);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
return type ? type : targetType;
|
|
@@ -13,7 +13,7 @@ const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
|
13
13
|
const _reference_1 = require("../_reference");
|
|
14
14
|
const let_1 = require("./let");
|
|
15
15
|
class For {
|
|
16
|
-
runSyntax(node,
|
|
16
|
+
runSyntax(node, input) {
|
|
17
17
|
var _a;
|
|
18
18
|
let scoped = false;
|
|
19
19
|
const inlineLoop = node.findDirectExpressions(Expressions.InlineLoopDefinition);
|
|
@@ -26,32 +26,32 @@ class For {
|
|
|
26
26
|
|| groupsToken !== undefined;
|
|
27
27
|
if (addScope) {
|
|
28
28
|
// this scope is popped in parent expressions
|
|
29
|
-
scope.push(_scope_type_1.ScopeType.For, "FOR", node.getFirstToken().getStart(), filename);
|
|
29
|
+
input.scope.push(_scope_type_1.ScopeType.For, "FOR", node.getFirstToken().getStart(), input.filename);
|
|
30
30
|
scoped = true;
|
|
31
31
|
}
|
|
32
32
|
for (const s of inlineLoop) {
|
|
33
|
-
new inline_loop_definition_1.InlineLoopDefinition().runSyntax(s,
|
|
33
|
+
new inline_loop_definition_1.InlineLoopDefinition().runSyntax(s, input);
|
|
34
34
|
}
|
|
35
35
|
for (const f of inlineField) {
|
|
36
|
-
new inline_field_definition_1.InlineFieldDefinition().runSyntax(f,
|
|
36
|
+
new inline_field_definition_1.InlineFieldDefinition().runSyntax(f, input);
|
|
37
37
|
}
|
|
38
38
|
if (groupsToken !== undefined) {
|
|
39
39
|
const type = new basic_1.VoidType("todoGroupBy");
|
|
40
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(groupsToken, filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
41
|
-
scope.addIdentifier(identifier);
|
|
42
|
-
scope.addReference(groupsToken, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
40
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(groupsToken, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
41
|
+
input.scope.addIdentifier(identifier);
|
|
42
|
+
input.scope.addReference(groupsToken, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
43
43
|
}
|
|
44
44
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
45
|
-
new source_1.Source().runSyntax(s,
|
|
45
|
+
new source_1.Source().runSyntax(s, input);
|
|
46
46
|
}
|
|
47
47
|
for (const s of node.findDirectExpressions(Expressions.ComponentCond)) {
|
|
48
|
-
new component_cond_1.ComponentCond().runSyntax(s,
|
|
48
|
+
new component_cond_1.ComponentCond().runSyntax(s, input);
|
|
49
49
|
}
|
|
50
50
|
for (const s of node.findDirectExpressions(Expressions.Cond)) {
|
|
51
|
-
new cond_1.Cond().runSyntax(s,
|
|
51
|
+
new cond_1.Cond().runSyntax(s, input);
|
|
52
52
|
}
|
|
53
53
|
if (lett) {
|
|
54
|
-
new let_1.Let().runSyntax(lett,
|
|
54
|
+
new let_1.Let().runSyntax(lett, input, true);
|
|
55
55
|
}
|
|
56
56
|
return scoped;
|
|
57
57
|
}
|
|
@@ -5,8 +5,9 @@ const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
|
5
5
|
const basic_1 = require("../../types/basic");
|
|
6
6
|
const expressions_1 = require("../../2_statements/expressions");
|
|
7
7
|
const basic_types_1 = require("../basic_types");
|
|
8
|
+
const assert_error_1 = require("../assert_error");
|
|
8
9
|
class FormParam {
|
|
9
|
-
runSyntax(node,
|
|
10
|
+
runSyntax(node, input) {
|
|
10
11
|
var _a, _b, _c;
|
|
11
12
|
const nameToken = (_a = node.findFirstExpression(expressions_1.FormParamName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
12
13
|
if (node.findDirectTokenByText("STRUCTURE") && nameToken) {
|
|
@@ -14,28 +15,28 @@ class FormParam {
|
|
|
14
15
|
const typeName = (_b = node.findDirectExpression(expressions_1.SimpleFieldChain)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
15
16
|
let type = undefined;
|
|
16
17
|
if (typeName) {
|
|
17
|
-
type = (_c = scope.findType(typeName)) === null || _c === void 0 ? void 0 : _c.getType();
|
|
18
|
+
type = (_c = input.scope.findType(typeName)) === null || _c === void 0 ? void 0 : _c.getType();
|
|
18
19
|
if (type === undefined) {
|
|
19
|
-
type = scope.getDDIC().lookupTableOrView(typeName).type;
|
|
20
|
+
type = input.scope.getDDIC().lookupTableOrView(typeName).type;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
else {
|
|
23
24
|
type = new basic_1.UnknownType("todo, FORM STRUCTURES typing");
|
|
24
25
|
}
|
|
25
|
-
return new _typed_identifier_1.TypedIdentifier(nameToken, filename, type, ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
26
|
+
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, type, ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
26
27
|
}
|
|
27
28
|
if (node.getChildren().length === 1 && nameToken) {
|
|
28
29
|
// untyped FORM parameter
|
|
29
|
-
return new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.AnyType(), ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
30
|
+
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, new basic_1.AnyType(), ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
30
31
|
}
|
|
31
|
-
const bfound = new basic_types_1.BasicTypes(
|
|
32
|
+
const bfound = new basic_types_1.BasicTypes(input).parseType(node);
|
|
32
33
|
if (nameToken && bfound) {
|
|
33
|
-
return new _typed_identifier_1.TypedIdentifier(nameToken, filename, bfound, ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
34
|
+
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, bfound, ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
34
35
|
}
|
|
35
36
|
if (nameToken) {
|
|
36
|
-
return new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.UnknownType("FormParam, todo"), ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
37
|
+
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, new basic_1.UnknownType("FormParam, todo"), ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
37
38
|
}
|
|
38
|
-
throw new
|
|
39
|
+
throw new assert_error_1.AssertError("FormParam, unexpected node");
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
exports.FormParam = FormParam;
|
|
@@ -4,20 +4,23 @@ exports.FSTarget = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const inline_fs_1 = require("./inline_fs");
|
|
6
6
|
const _reference_1 = require("../_reference");
|
|
7
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
7
8
|
class FSTarget {
|
|
8
|
-
runSyntax(node,
|
|
9
|
+
runSyntax(node, input, type) {
|
|
9
10
|
const inlinefs = node === null || node === void 0 ? void 0 : node.findDirectExpression(Expressions.InlineFS);
|
|
10
11
|
if (inlinefs) {
|
|
11
|
-
new inline_fs_1.InlineFS().runSyntax(inlinefs,
|
|
12
|
+
new inline_fs_1.InlineFS().runSyntax(inlinefs, input, type);
|
|
12
13
|
}
|
|
13
14
|
const target = node === null || node === void 0 ? void 0 : node.findDirectExpression(Expressions.TargetFieldSymbol);
|
|
14
15
|
if (target) {
|
|
15
16
|
const token = target.getFirstToken();
|
|
16
|
-
const found = scope.findVariable(token.getStr());
|
|
17
|
+
const found = input.scope.findVariable(token.getStr());
|
|
17
18
|
if (found === undefined) {
|
|
18
|
-
|
|
19
|
+
const message = `"${token.getStr()}" not found, FSTarget`;
|
|
20
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
21
|
+
return;
|
|
19
22
|
}
|
|
20
|
-
scope.addReference(token, found, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
23
|
+
input.scope.addReference(token, found, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -5,8 +5,9 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
6
6
|
const basic_1 = require("../../types/basic");
|
|
7
7
|
const _reference_1 = require("../_reference");
|
|
8
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
8
9
|
class InlineData {
|
|
9
|
-
runSyntax(node,
|
|
10
|
+
runSyntax(node, input, type) {
|
|
10
11
|
var _a;
|
|
11
12
|
const token = (_a = node.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
12
13
|
if (token && type) {
|
|
@@ -14,17 +15,19 @@ class InlineData {
|
|
|
14
15
|
type = basic_1.StringType.get();
|
|
15
16
|
}
|
|
16
17
|
else if (type instanceof basic_1.CGenericType) {
|
|
17
|
-
|
|
18
|
+
const message = "InlineData, generic type C cannot be used for inferred type";
|
|
19
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
20
|
+
return;
|
|
18
21
|
}
|
|
19
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(token, filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
20
|
-
scope.addIdentifier(identifier);
|
|
21
|
-
scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
22
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
23
|
+
input.scope.addIdentifier(identifier);
|
|
24
|
+
input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
22
25
|
}
|
|
23
26
|
else if (token) {
|
|
24
27
|
const message = "InlineData, could not determine type for \"" + token.getStr() + "\"";
|
|
25
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(token, filename, new basic_1.UnknownType(message), ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
26
|
-
scope.addIdentifier(identifier);
|
|
27
|
-
scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
28
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, new basic_1.UnknownType(message), ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
29
|
+
input.scope.addIdentifier(identifier);
|
|
30
|
+
input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
}
|
|
@@ -7,8 +7,10 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
7
7
|
const basic_types_1 = require("../basic_types");
|
|
8
8
|
const unknown_type_1 = require("../../types/basic/unknown_type");
|
|
9
9
|
const _reference_1 = require("../_reference");
|
|
10
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
11
|
+
const basic_1 = require("../../types/basic");
|
|
10
12
|
class InlineFieldDefinition {
|
|
11
|
-
runSyntax(node,
|
|
13
|
+
runSyntax(node, input, targetType) {
|
|
12
14
|
var _a;
|
|
13
15
|
let type = undefined;
|
|
14
16
|
const field = (_a = node.findDirectExpression(Expressions.Field)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
@@ -17,11 +19,11 @@ class InlineFieldDefinition {
|
|
|
17
19
|
}
|
|
18
20
|
const source = node.findDirectExpression(Expressions.Source);
|
|
19
21
|
if (source) {
|
|
20
|
-
type = new source_1.Source().runSyntax(source,
|
|
22
|
+
type = new source_1.Source().runSyntax(source, input);
|
|
21
23
|
}
|
|
22
24
|
const typeName = node.findDirectExpression(Expressions.TypeName);
|
|
23
25
|
if (typeName) {
|
|
24
|
-
type = new basic_types_1.BasicTypes(
|
|
26
|
+
type = new basic_types_1.BasicTypes(input).parseType(typeName);
|
|
25
27
|
}
|
|
26
28
|
if (targetType !== undefined) {
|
|
27
29
|
type = targetType;
|
|
@@ -30,12 +32,14 @@ class InlineFieldDefinition {
|
|
|
30
32
|
type = new unknown_type_1.UnknownType("InlineFieldDefinition, fallback");
|
|
31
33
|
}
|
|
32
34
|
const name = field.getStr();
|
|
33
|
-
if (scope.findVariable(name) !== undefined) {
|
|
34
|
-
|
|
35
|
+
if (input.scope.findVariable(name) !== undefined) {
|
|
36
|
+
const message = `Variable ${name} already defined`;
|
|
37
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
38
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
35
39
|
}
|
|
36
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(field, filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
37
|
-
scope.addReference(field, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
38
|
-
scope.addIdentifier(identifier);
|
|
40
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(field, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
41
|
+
input.scope.addReference(field, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
42
|
+
input.scope.addIdentifier(identifier);
|
|
39
43
|
return type;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
@@ -6,19 +6,19 @@ const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
|
6
6
|
const basic_1 = require("../../types/basic");
|
|
7
7
|
const _reference_1 = require("../_reference");
|
|
8
8
|
class InlineFS {
|
|
9
|
-
runSyntax(node,
|
|
9
|
+
runSyntax(node, input, type) {
|
|
10
10
|
var _a;
|
|
11
11
|
const token = (_a = node.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
12
12
|
if (token && type) {
|
|
13
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(token, filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
14
|
-
scope.addIdentifier(identifier);
|
|
15
|
-
scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
13
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
14
|
+
input.scope.addIdentifier(identifier);
|
|
15
|
+
input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
16
16
|
}
|
|
17
17
|
else if (token) {
|
|
18
18
|
const message = "InlineFS, could not determine type for \"" + token.getStr() + "\"";
|
|
19
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(token, filename, new basic_1.UnknownType(message), ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
20
|
-
scope.addIdentifier(identifier);
|
|
21
|
-
scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
19
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, new basic_1.UnknownType(message), ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
20
|
+
input.scope.addIdentifier(identifier);
|
|
21
|
+
input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -6,8 +6,9 @@ const source_1 = require("./source");
|
|
|
6
6
|
const basic_1 = require("../../types/basic");
|
|
7
7
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
8
8
|
const _reference_1 = require("../_reference");
|
|
9
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
9
10
|
class InlineLoopDefinition {
|
|
10
|
-
runSyntax(node,
|
|
11
|
+
runSyntax(node, input) {
|
|
11
12
|
if (node === undefined) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
@@ -17,7 +18,7 @@ class InlineLoopDefinition {
|
|
|
17
18
|
}
|
|
18
19
|
const source = node.findDirectExpression(Expressions.Source);
|
|
19
20
|
if (source && target) {
|
|
20
|
-
const sourceType = new source_1.Source().runSyntax(source,
|
|
21
|
+
const sourceType = new source_1.Source().runSyntax(source, input);
|
|
21
22
|
let rowType = undefined;
|
|
22
23
|
if (sourceType instanceof basic_1.TableType) {
|
|
23
24
|
rowType = sourceType.getRowType();
|
|
@@ -26,7 +27,9 @@ class InlineLoopDefinition {
|
|
|
26
27
|
rowType = sourceType;
|
|
27
28
|
}
|
|
28
29
|
else if (sourceType instanceof basic_1.UnknownType) {
|
|
29
|
-
|
|
30
|
+
const message = "Unknown type, " + sourceType.getError();
|
|
31
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
32
|
+
return;
|
|
30
33
|
}
|
|
31
34
|
if (rowType === undefined
|
|
32
35
|
&& node.concatTokens().toUpperCase().includes(" IN GROUP ")
|
|
@@ -34,18 +37,20 @@ class InlineLoopDefinition {
|
|
|
34
37
|
rowType = sourceType;
|
|
35
38
|
}
|
|
36
39
|
else if (rowType === undefined) {
|
|
37
|
-
|
|
40
|
+
const message = "InlineLoopDefinition, not a table type";
|
|
41
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
42
|
+
return;
|
|
38
43
|
}
|
|
39
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(target.getFirstToken(), filename, rowType, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
40
|
-
scope.addReference(target.getFirstToken(), identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
41
|
-
scope.addReference(target.getFirstToken(), identifier, _reference_1.ReferenceType.DataReadReference, filename);
|
|
42
|
-
scope.addIdentifier(identifier);
|
|
44
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(target.getFirstToken(), input.filename, rowType, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
45
|
+
input.scope.addReference(target.getFirstToken(), identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
46
|
+
input.scope.addReference(target.getFirstToken(), identifier, _reference_1.ReferenceType.DataReadReference, input.filename);
|
|
47
|
+
input.scope.addIdentifier(identifier);
|
|
43
48
|
}
|
|
44
49
|
const index = node.findExpressionAfterToken("INTO");
|
|
45
50
|
if (index && index.get() instanceof Expressions.TargetField) {
|
|
46
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(index.getFirstToken(), filename, basic_1.IntegerType.get(), ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
47
|
-
scope.addReference(index.getFirstToken(), identifier, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
48
|
-
scope.addIdentifier(identifier);
|
|
51
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(index.getFirstToken(), input.filename, basic_1.IntegerType.get(), ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
52
|
+
input.scope.addReference(index.getFirstToken(), identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
53
|
+
input.scope.addIdentifier(identifier);
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -5,15 +5,15 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const inline_field_definition_1 = require("./inline_field_definition");
|
|
6
6
|
const _scope_type_1 = require("../_scope_type");
|
|
7
7
|
class Let {
|
|
8
|
-
runSyntax(node,
|
|
8
|
+
runSyntax(node, input, skipScope = false) {
|
|
9
9
|
if (node === undefined) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
if (skipScope !== true) {
|
|
13
|
-
scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), filename);
|
|
13
|
+
input.scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), input.filename);
|
|
14
14
|
}
|
|
15
15
|
for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {
|
|
16
|
-
new inline_field_definition_1.InlineFieldDefinition().runSyntax(f,
|
|
16
|
+
new inline_field_definition_1.InlineFieldDefinition().runSyntax(f, input);
|
|
17
17
|
}
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
@@ -8,32 +8,22 @@ const inline_data_1 = require("./inline_data");
|
|
|
8
8
|
const fstarget_1 = require("./fstarget");
|
|
9
9
|
const target_1 = require("./target");
|
|
10
10
|
class LoopGroupBy {
|
|
11
|
-
runSyntax(node,
|
|
11
|
+
runSyntax(node, input) {
|
|
12
12
|
for (const t of node.findAllExpressions(Expressions.Target)) {
|
|
13
13
|
const inline = t.findDirectExpression(Expressions.InlineData);
|
|
14
14
|
if (inline) {
|
|
15
|
-
new inline_data_1.InlineData().runSyntax(inline,
|
|
15
|
+
new inline_data_1.InlineData().runSyntax(inline, input, new basic_1.VoidType("todoGroupBy"));
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
new target_1.Target().runSyntax(t,
|
|
18
|
+
new target_1.Target().runSyntax(t, input);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
for (const t of node.findAllExpressions(Expressions.FSTarget)) {
|
|
22
|
-
new fstarget_1.FSTarget().runSyntax(t,
|
|
22
|
+
new fstarget_1.FSTarget().runSyntax(t, input, new basic_1.VoidType("todoGroupBy"));
|
|
23
23
|
}
|
|
24
|
-
/*
|
|
25
|
-
const components: IStructureComponent[] = [];
|
|
26
|
-
for (const c of node.findDirectExpressions(Expressions.LoopGroupByComponent)) {
|
|
27
|
-
components.push({name: c.getFirstToken().getStr(), type: new VoidType("todoGroupBy")});
|
|
28
|
-
}
|
|
29
|
-
if (components.length === 0) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
*/
|
|
33
|
-
// const sourceType = new StructureType(components);
|
|
34
24
|
for (const c of node.findDirectExpressions(Expressions.LoopGroupByComponent)) {
|
|
35
25
|
for (const t of c.findDirectExpressions(Expressions.ComponentCompareSingle)) {
|
|
36
|
-
new component_compare_1.ComponentCompare().runSyntax(t,
|
|
26
|
+
new component_compare_1.ComponentCompare().runSyntax(t, input);
|
|
37
27
|
}
|
|
38
28
|
}
|
|
39
29
|
}
|