@abaplint/core 2.111.1 → 2.112.1
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 +23 -22
- 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/build/src/rules/double_space.js +6 -3
- package/package.json +3 -3
|
@@ -10,49 +10,49 @@ const reduce_next_1 = require("./reduce_next");
|
|
|
10
10
|
const let_1 = require("./let");
|
|
11
11
|
const _scope_type_1 = require("../_scope_type");
|
|
12
12
|
class ReduceBody {
|
|
13
|
-
runSyntax(node,
|
|
13
|
+
runSyntax(node, input, targetType) {
|
|
14
14
|
if (node === undefined) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
let scoped = false;
|
|
18
18
|
const letNode = node.findDirectExpression(Expressions.Let);
|
|
19
19
|
if (letNode) {
|
|
20
|
-
scoped = new let_1.Let().runSyntax(letNode,
|
|
20
|
+
scoped = new let_1.Let().runSyntax(letNode, input);
|
|
21
21
|
}
|
|
22
22
|
let first = undefined;
|
|
23
23
|
for (const i of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {
|
|
24
24
|
if (scoped === false) {
|
|
25
|
-
scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), filename);
|
|
25
|
+
input.scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), input.filename);
|
|
26
26
|
scoped = true;
|
|
27
27
|
}
|
|
28
28
|
let foundType = targetType;
|
|
29
29
|
const source = i.findDirectExpression(Expressions.Source);
|
|
30
30
|
if (source) {
|
|
31
|
-
foundType = new source_1.Source().runSyntax(source,
|
|
31
|
+
foundType = new source_1.Source().runSyntax(source, input, targetType);
|
|
32
32
|
}
|
|
33
|
-
const found = new inline_field_definition_1.InlineFieldDefinition().runSyntax(i,
|
|
33
|
+
const found = new inline_field_definition_1.InlineFieldDefinition().runSyntax(i, input, foundType);
|
|
34
34
|
if (found && first === undefined) {
|
|
35
35
|
first = found;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
let forScopes = 0;
|
|
39
39
|
for (const forNode of node.findDirectExpressions(Expressions.For) || []) {
|
|
40
|
-
const scoped = new for_1.For().runSyntax(forNode,
|
|
40
|
+
const scoped = new for_1.For().runSyntax(forNode, input);
|
|
41
41
|
if (scoped === true) {
|
|
42
42
|
forScopes++;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
46
|
-
new source_1.Source().runSyntax(s,
|
|
46
|
+
new source_1.Source().runSyntax(s, input);
|
|
47
47
|
}
|
|
48
48
|
for (const s of node.findDirectExpressions(Expressions.ReduceNext)) {
|
|
49
|
-
new reduce_next_1.ReduceNext().runSyntax(s,
|
|
49
|
+
new reduce_next_1.ReduceNext().runSyntax(s, input);
|
|
50
50
|
}
|
|
51
51
|
if (scoped === true) {
|
|
52
|
-
scope.pop(node.getLastToken().getEnd());
|
|
52
|
+
input.scope.pop(node.getLastToken().getEnd());
|
|
53
53
|
}
|
|
54
54
|
for (let i = 0; i < forScopes; i++) {
|
|
55
|
-
scope.pop(node.getLastToken().getEnd());
|
|
55
|
+
input.scope.pop(node.getLastToken().getEnd());
|
|
56
56
|
}
|
|
57
57
|
if (first) {
|
|
58
58
|
return first;
|
|
@@ -5,15 +5,15 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const source_1 = require("./source");
|
|
6
6
|
const target_1 = require("./target");
|
|
7
7
|
class ReduceNext {
|
|
8
|
-
runSyntax(node,
|
|
8
|
+
runSyntax(node, input) {
|
|
9
9
|
if (node === undefined) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
13
|
-
new source_1.Source().runSyntax(s,
|
|
13
|
+
new source_1.Source().runSyntax(s, input);
|
|
14
14
|
}
|
|
15
15
|
for (const s of node.findDirectExpressions(Expressions.SimpleTarget)) {
|
|
16
|
-
new target_1.Target().runSyntax(s,
|
|
16
|
+
new target_1.Target().runSyntax(s, input);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -13,30 +13,35 @@ const sql_compare_1 = require("./sql_compare");
|
|
|
13
13
|
const sql_order_by_1 = require("./sql_order_by");
|
|
14
14
|
const dynamic_1 = require("./dynamic");
|
|
15
15
|
const _reference_1 = require("../_reference");
|
|
16
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
16
17
|
const isSimple = /^\w+$/;
|
|
17
18
|
class Select {
|
|
18
|
-
runSyntax(node,
|
|
19
|
+
runSyntax(node, input, skipImplicitInto = false) {
|
|
19
20
|
var _a;
|
|
20
21
|
const token = node.getFirstToken();
|
|
21
22
|
const from = node.findDirectExpression(Expressions.SQLFrom);
|
|
22
|
-
const dbSources = from ? new sql_from_1.SQLFrom().runSyntax(from,
|
|
23
|
+
const dbSources = from ? new sql_from_1.SQLFrom().runSyntax(from, input) : [];
|
|
23
24
|
if (from === undefined) {
|
|
24
|
-
|
|
25
|
+
const message = `Missing FROM`;
|
|
26
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
27
|
+
return;
|
|
25
28
|
}
|
|
26
|
-
const fields = this.findFields(node,
|
|
29
|
+
const fields = this.findFields(node, input);
|
|
27
30
|
if (fields.length === 0
|
|
28
31
|
&& node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
|
|
29
|
-
|
|
32
|
+
const message = `fields missing`;
|
|
33
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
34
|
+
return;
|
|
30
35
|
}
|
|
31
|
-
this.checkFields(fields, dbSources,
|
|
32
|
-
this.handleInto(node,
|
|
36
|
+
this.checkFields(fields, dbSources, input, node);
|
|
37
|
+
this.handleInto(node, input, fields, dbSources);
|
|
33
38
|
const fae = node.findDirectExpression(Expressions.SQLForAllEntries);
|
|
34
39
|
if (fae) {
|
|
35
|
-
scope.push(_scope_type_1.ScopeType.OpenSQL, "SELECT", token.getStart(), filename);
|
|
36
|
-
new sql_for_all_entries_1.SQLForAllEntries().runSyntax(fae,
|
|
40
|
+
input.scope.push(_scope_type_1.ScopeType.OpenSQL, "SELECT", token.getStart(), input.filename);
|
|
41
|
+
new sql_for_all_entries_1.SQLForAllEntries().runSyntax(fae, input);
|
|
37
42
|
}
|
|
38
43
|
for (const t of node.findAllExpressions(Expressions.Target)) {
|
|
39
|
-
new target_1.Target().runSyntax(t,
|
|
44
|
+
new target_1.Target().runSyntax(t, input);
|
|
40
45
|
}
|
|
41
46
|
// check implicit into, the target field is implict equal to the table name
|
|
42
47
|
if (skipImplicitInto === false
|
|
@@ -48,53 +53,55 @@ class Select {
|
|
|
48
53
|
if (fields === undefined || c.test(fields) === false) {
|
|
49
54
|
const nameToken = from === null || from === void 0 ? void 0 : from.findDirectExpression(Expressions.SQLFromSource);
|
|
50
55
|
if (nameToken) {
|
|
51
|
-
const found = scope.findVariable(nameToken.concatTokens());
|
|
56
|
+
const found = input.scope.findVariable(nameToken.concatTokens());
|
|
52
57
|
if (found) {
|
|
53
|
-
scope.addReference(nameToken.getFirstToken(), found, _reference_1.ReferenceType.DataWriteReference, filename);
|
|
58
|
+
input.scope.addReference(nameToken.getFirstToken(), found, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
54
59
|
}
|
|
55
60
|
else {
|
|
56
|
-
|
|
61
|
+
const message = `Target variable ${nameToken.concatTokens()} not found in scope`;
|
|
62
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
63
|
+
return;
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
}
|
|
61
68
|
// OFFSET
|
|
62
69
|
for (const s of node.findDirectExpressions(Expressions.SQLSource)) {
|
|
63
|
-
new sql_source_1.SQLSource().runSyntax(s,
|
|
70
|
+
new sql_source_1.SQLSource().runSyntax(s, input);
|
|
64
71
|
}
|
|
65
72
|
for (const up of node.findDirectExpressions(Expressions.SQLUpTo)) {
|
|
66
73
|
for (const s of up.findDirectExpressions(Expressions.SQLSource)) {
|
|
67
|
-
new sql_source_1.SQLSource().runSyntax(s,
|
|
74
|
+
new sql_source_1.SQLSource().runSyntax(s, input);
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
for (const fae of node.findDirectExpressions(Expressions.SQLForAllEntries)) {
|
|
71
78
|
for (const s of fae.findDirectExpressions(Expressions.SQLSource)) {
|
|
72
|
-
new sql_source_1.SQLSource().runSyntax(s,
|
|
79
|
+
new sql_source_1.SQLSource().runSyntax(s, input);
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
for (const s of node.findAllExpressions(Expressions.SQLCompare)) {
|
|
76
|
-
new sql_compare_1.SQLCompare().runSyntax(s,
|
|
83
|
+
new sql_compare_1.SQLCompare().runSyntax(s, input, dbSources);
|
|
77
84
|
}
|
|
78
85
|
for (const s of node.findDirectExpressions(Expressions.SQLOrderBy)) {
|
|
79
|
-
new sql_order_by_1.SQLOrderBy().runSyntax(s,
|
|
86
|
+
new sql_order_by_1.SQLOrderBy().runSyntax(s, input);
|
|
80
87
|
}
|
|
81
|
-
if (scope.getType() === _scope_type_1.ScopeType.OpenSQL) {
|
|
82
|
-
scope.pop(node.getLastToken().getEnd());
|
|
88
|
+
if (input.scope.getType() === _scope_type_1.ScopeType.OpenSQL) {
|
|
89
|
+
input.scope.pop(node.getLastToken().getEnd());
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
|
-
handleInto(node,
|
|
92
|
+
handleInto(node, input, fields, dbSources) {
|
|
86
93
|
const intoTable = node.findDirectExpression(Expressions.SQLIntoTable);
|
|
87
94
|
if (intoTable) {
|
|
88
95
|
const inline = intoTable.findFirstExpression(Expressions.InlineData);
|
|
89
96
|
if (inline) {
|
|
90
|
-
new inline_data_1.InlineData().runSyntax(inline,
|
|
97
|
+
new inline_data_1.InlineData().runSyntax(inline, input, this.buildTableType(fields, dbSources, input.scope));
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
const intoStructure = node.findDirectExpression(Expressions.SQLIntoStructure);
|
|
94
101
|
if (intoStructure) {
|
|
95
102
|
for (const inline of intoStructure.findAllExpressions(Expressions.InlineData)) {
|
|
96
103
|
// todo, for now these are voided
|
|
97
|
-
new inline_data_1.InlineData().runSyntax(inline,
|
|
104
|
+
new inline_data_1.InlineData().runSyntax(inline, input, new basic_1.VoidType("SELECT_todo"));
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
107
|
const intoList = node.findDirectExpression(Expressions.SQLIntoList);
|
|
@@ -102,7 +109,9 @@ class Select {
|
|
|
102
109
|
const isDynamic = fields.length === 1 && fields[0].expression.findDirectExpression(Expressions.Dynamic) !== undefined;
|
|
103
110
|
const targets = intoList.findDirectExpressions(Expressions.SQLTarget);
|
|
104
111
|
if (targets.length !== fields.length && isDynamic !== true) {
|
|
105
|
-
|
|
112
|
+
const message = `number of fields selected vs list does not match`;
|
|
113
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
114
|
+
return;
|
|
106
115
|
}
|
|
107
116
|
for (let i = 0; i < targets.length; i++) {
|
|
108
117
|
const target = targets[i];
|
|
@@ -110,7 +119,9 @@ class Select {
|
|
|
110
119
|
const inline = target.findFirstExpression(Expressions.InlineData);
|
|
111
120
|
if (inline) {
|
|
112
121
|
if (isDynamic) {
|
|
113
|
-
|
|
122
|
+
const message = `dynamic field list, inlining not possible`;
|
|
123
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
124
|
+
return;
|
|
114
125
|
}
|
|
115
126
|
let type = new basic_1.VoidType("SELECT_todo");
|
|
116
127
|
if (isSimple.test(field.code)) {
|
|
@@ -118,7 +129,7 @@ class Select {
|
|
|
118
129
|
if (dbSource === undefined) {
|
|
119
130
|
continue;
|
|
120
131
|
}
|
|
121
|
-
const dbType = dbSource.parseType(scope.getRegistry());
|
|
132
|
+
const dbType = dbSource.parseType(input.scope.getRegistry());
|
|
122
133
|
if (dbType instanceof basic_1.StructureType) {
|
|
123
134
|
const found = dbType.getComponentByName(field.code);
|
|
124
135
|
if (found) {
|
|
@@ -128,12 +139,12 @@ class Select {
|
|
|
128
139
|
}
|
|
129
140
|
}
|
|
130
141
|
}
|
|
131
|
-
new inline_data_1.InlineData().runSyntax(inline,
|
|
142
|
+
new inline_data_1.InlineData().runSyntax(inline, input, type);
|
|
132
143
|
}
|
|
133
144
|
}
|
|
134
145
|
}
|
|
135
146
|
}
|
|
136
|
-
checkFields(fields, dbSources,
|
|
147
|
+
checkFields(fields, dbSources, input, node) {
|
|
137
148
|
if (dbSources.length > 1) {
|
|
138
149
|
return;
|
|
139
150
|
}
|
|
@@ -142,19 +153,23 @@ class Select {
|
|
|
142
153
|
// then its voided
|
|
143
154
|
return;
|
|
144
155
|
}
|
|
145
|
-
const type = first.parseType(scope.getRegistry());
|
|
156
|
+
const type = first.parseType(input.scope.getRegistry());
|
|
146
157
|
if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
|
|
147
158
|
return;
|
|
148
159
|
}
|
|
149
160
|
if (!(type instanceof basic_1.StructureType)) {
|
|
150
|
-
|
|
161
|
+
const message = "checkFields, expected structure, " + type.constructor.name;
|
|
162
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
163
|
+
return;
|
|
151
164
|
}
|
|
152
165
|
for (const field of fields) {
|
|
153
166
|
if (field.code === "*") {
|
|
154
167
|
continue;
|
|
155
168
|
}
|
|
156
169
|
if (isSimple.test(field.code) && type.getComponentByName(field.code) === undefined) {
|
|
157
|
-
|
|
170
|
+
const message = `checkFields, field ${field.code} not found`;
|
|
171
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
172
|
+
return;
|
|
158
173
|
}
|
|
159
174
|
}
|
|
160
175
|
}
|
|
@@ -187,7 +202,7 @@ class Select {
|
|
|
187
202
|
}
|
|
188
203
|
return new basic_1.VoidType("SELECT_todo");
|
|
189
204
|
}
|
|
190
|
-
findFields(node,
|
|
205
|
+
findFields(node, input) {
|
|
191
206
|
var _a, _b;
|
|
192
207
|
let expr = undefined;
|
|
193
208
|
const ret = [];
|
|
@@ -196,7 +211,7 @@ class Select {
|
|
|
196
211
|
expr = node.findDirectExpression(Expressions.SQLFieldListLoop);
|
|
197
212
|
}
|
|
198
213
|
if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
|
|
199
|
-
new dynamic_1.Dynamic().runSyntax(expr.getFirstChild(),
|
|
214
|
+
new dynamic_1.Dynamic().runSyntax(expr.getFirstChild(), input);
|
|
200
215
|
}
|
|
201
216
|
for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName])) || []) {
|
|
202
217
|
let code = field.concatTokens().toUpperCase();
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SelectLoop = void 0;
|
|
4
4
|
const select_1 = require("./select");
|
|
5
5
|
class SelectLoop {
|
|
6
|
-
runSyntax(node,
|
|
6
|
+
runSyntax(node, input) {
|
|
7
7
|
// try using the other Select, they should look very much the same
|
|
8
|
-
new select_1.Select().runSyntax(node,
|
|
8
|
+
new select_1.Select().runSyntax(node, input);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.SelectLoop = SelectLoop;
|
|
@@ -25,6 +25,8 @@ const attribute_chain_1 = require("./attribute_chain");
|
|
|
25
25
|
const dereference_1 = require("./dereference");
|
|
26
26
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
27
27
|
const _type_utils_1 = require("../_type_utils");
|
|
28
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
29
|
+
const assert_error_1 = require("../assert_error");
|
|
28
30
|
/*
|
|
29
31
|
* Type interference, valid scenarios:
|
|
30
32
|
* typed = VALUE #( ... ). right hand side must follow left hand type
|
|
@@ -35,7 +37,7 @@ const _type_utils_1 = require("../_type_utils");
|
|
|
35
37
|
* DATA(bar) = VALUE #( ... ). give error, no type can be derived
|
|
36
38
|
*/
|
|
37
39
|
class Source {
|
|
38
|
-
runSyntax(node,
|
|
40
|
+
runSyntax(node, input, targetType, writeReference = false) {
|
|
39
41
|
if (node === undefined) {
|
|
40
42
|
return undefined;
|
|
41
43
|
}
|
|
@@ -53,72 +55,74 @@ class Source {
|
|
|
53
55
|
case "BOOLC":
|
|
54
56
|
{
|
|
55
57
|
const method = new _builtin_1.BuiltIn().searchBuiltin(tok);
|
|
56
|
-
scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, filename);
|
|
57
|
-
new cond_1.Cond().runSyntax(node.findDirectExpression(Expressions.Cond),
|
|
58
|
+
input.scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, input.filename);
|
|
59
|
+
new cond_1.Cond().runSyntax(node.findDirectExpression(Expressions.Cond), input);
|
|
58
60
|
return basic_1.StringType.get();
|
|
59
61
|
}
|
|
60
62
|
case "XSDBOOL":
|
|
61
63
|
{
|
|
62
64
|
const method = new _builtin_1.BuiltIn().searchBuiltin(tok);
|
|
63
|
-
scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, filename);
|
|
64
|
-
new cond_1.Cond().runSyntax(node.findDirectExpression(Expressions.Cond),
|
|
65
|
+
input.scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, input.filename);
|
|
66
|
+
new cond_1.Cond().runSyntax(node.findDirectExpression(Expressions.Cond), input);
|
|
65
67
|
return new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" });
|
|
66
68
|
}
|
|
67
69
|
case "REDUCE":
|
|
68
70
|
{
|
|
69
|
-
const foundType = this.determineType(node,
|
|
70
|
-
const bodyType = new reduce_body_1.ReduceBody().runSyntax(node.findDirectExpression(Expressions.ReduceBody),
|
|
71
|
+
const foundType = this.determineType(node, input, targetType);
|
|
72
|
+
const bodyType = new reduce_body_1.ReduceBody().runSyntax(node.findDirectExpression(Expressions.ReduceBody), input, foundType);
|
|
71
73
|
if (foundType === undefined || foundType.isGeneric()) {
|
|
72
|
-
this.addIfInferred(node,
|
|
74
|
+
this.addIfInferred(node, input, bodyType);
|
|
73
75
|
}
|
|
74
76
|
else {
|
|
75
|
-
this.addIfInferred(node,
|
|
77
|
+
this.addIfInferred(node, input, foundType);
|
|
76
78
|
}
|
|
77
79
|
return foundType ? foundType : bodyType;
|
|
78
80
|
}
|
|
79
81
|
case "SWITCH":
|
|
80
82
|
{
|
|
81
|
-
const foundType = this.determineType(node,
|
|
82
|
-
const bodyType = new switch_body_1.SwitchBody().runSyntax(node.findDirectExpression(Expressions.SwitchBody),
|
|
83
|
+
const foundType = this.determineType(node, input, targetType);
|
|
84
|
+
const bodyType = new switch_body_1.SwitchBody().runSyntax(node.findDirectExpression(Expressions.SwitchBody), input);
|
|
83
85
|
if (foundType === undefined || foundType.isGeneric()) {
|
|
84
|
-
this.addIfInferred(node,
|
|
86
|
+
this.addIfInferred(node, input, bodyType);
|
|
85
87
|
}
|
|
86
88
|
else {
|
|
87
|
-
this.addIfInferred(node,
|
|
89
|
+
this.addIfInferred(node, input, foundType);
|
|
88
90
|
}
|
|
89
91
|
return foundType ? foundType : bodyType;
|
|
90
92
|
}
|
|
91
93
|
case "COND":
|
|
92
94
|
{
|
|
93
|
-
const foundType = this.determineType(node,
|
|
94
|
-
const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody),
|
|
95
|
+
const foundType = this.determineType(node, input, targetType);
|
|
96
|
+
const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), input);
|
|
95
97
|
if (foundType === undefined || foundType.isGeneric()) {
|
|
96
|
-
this.addIfInferred(node,
|
|
98
|
+
this.addIfInferred(node, input, bodyType);
|
|
97
99
|
}
|
|
98
100
|
else {
|
|
99
|
-
this.addIfInferred(node,
|
|
101
|
+
this.addIfInferred(node, input, foundType);
|
|
100
102
|
}
|
|
101
103
|
children.shift();
|
|
102
104
|
children.shift();
|
|
103
105
|
children.shift();
|
|
104
106
|
children.shift();
|
|
105
|
-
this.traverseRemainingChildren(children,
|
|
107
|
+
this.traverseRemainingChildren(children, input);
|
|
106
108
|
return foundType ? foundType : bodyType;
|
|
107
109
|
}
|
|
108
110
|
case "CONV":
|
|
109
111
|
{
|
|
110
|
-
const foundType = this.determineType(node,
|
|
111
|
-
const bodyType = new conv_body_1.ConvBody().runSyntax(node.findDirectExpression(Expressions.ConvBody),
|
|
112
|
-
if (new _type_utils_1.TypeUtils(scope).isAssignable(foundType, bodyType) === false) {
|
|
113
|
-
|
|
112
|
+
const foundType = this.determineType(node, input, targetType);
|
|
113
|
+
const bodyType = new conv_body_1.ConvBody().runSyntax(node.findDirectExpression(Expressions.ConvBody), input);
|
|
114
|
+
if (new _type_utils_1.TypeUtils(input.scope).isAssignable(foundType, bodyType) === false) {
|
|
115
|
+
const message = "CONV: Types not compatible";
|
|
116
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
117
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
114
118
|
}
|
|
115
|
-
this.addIfInferred(node,
|
|
119
|
+
this.addIfInferred(node, input, foundType);
|
|
116
120
|
return foundType;
|
|
117
121
|
}
|
|
118
122
|
case "REF":
|
|
119
123
|
{
|
|
120
|
-
const foundType = this.determineType(node,
|
|
121
|
-
const s = new Source().runSyntax(node.findDirectExpression(Expressions.Source),
|
|
124
|
+
const foundType = this.determineType(node, input, targetType);
|
|
125
|
+
const s = new Source().runSyntax(node.findDirectExpression(Expressions.Source), input);
|
|
122
126
|
if (foundType === undefined && s) {
|
|
123
127
|
return new basic_1.DataReference(s);
|
|
124
128
|
}
|
|
@@ -128,13 +132,13 @@ class Source {
|
|
|
128
132
|
}
|
|
129
133
|
case "FILTER":
|
|
130
134
|
{
|
|
131
|
-
const foundType = this.determineType(node,
|
|
132
|
-
const bodyType = new filter_body_1.FilterBody().runSyntax(node.findDirectExpression(Expressions.FilterBody),
|
|
135
|
+
const foundType = this.determineType(node, input, targetType);
|
|
136
|
+
const bodyType = new filter_body_1.FilterBody().runSyntax(node.findDirectExpression(Expressions.FilterBody), input, foundType);
|
|
133
137
|
if (foundType === undefined || foundType.isGeneric()) {
|
|
134
|
-
this.addIfInferred(node,
|
|
138
|
+
this.addIfInferred(node, input, bodyType);
|
|
135
139
|
}
|
|
136
140
|
else {
|
|
137
|
-
this.addIfInferred(node,
|
|
141
|
+
this.addIfInferred(node, input, foundType);
|
|
138
142
|
}
|
|
139
143
|
if (foundType && !(foundType instanceof unknown_type_1.UnknownType)) {
|
|
140
144
|
return foundType;
|
|
@@ -145,22 +149,22 @@ class Source {
|
|
|
145
149
|
}
|
|
146
150
|
case "CORRESPONDING":
|
|
147
151
|
{
|
|
148
|
-
const foundType = this.determineType(node,
|
|
149
|
-
new corresponding_body_1.CorrespondingBody().runSyntax(node.findDirectExpression(Expressions.CorrespondingBody),
|
|
150
|
-
this.addIfInferred(node,
|
|
152
|
+
const foundType = this.determineType(node, input, targetType);
|
|
153
|
+
new corresponding_body_1.CorrespondingBody().runSyntax(node.findDirectExpression(Expressions.CorrespondingBody), input, foundType);
|
|
154
|
+
this.addIfInferred(node, input, foundType);
|
|
151
155
|
return foundType;
|
|
152
156
|
}
|
|
153
157
|
case "EXACT":
|
|
154
|
-
return this.determineType(node,
|
|
158
|
+
return this.determineType(node, input, targetType);
|
|
155
159
|
case "VALUE":
|
|
156
160
|
{
|
|
157
|
-
const foundType = this.determineType(node,
|
|
158
|
-
const bodyType = new value_body_1.ValueBody().runSyntax(node.findDirectExpression(Expressions.ValueBody),
|
|
161
|
+
const foundType = this.determineType(node, input, targetType);
|
|
162
|
+
const bodyType = new value_body_1.ValueBody().runSyntax(node.findDirectExpression(Expressions.ValueBody), input, foundType);
|
|
159
163
|
if (foundType === undefined || foundType.isGeneric()) {
|
|
160
|
-
this.addIfInferred(node,
|
|
164
|
+
this.addIfInferred(node, input, bodyType);
|
|
161
165
|
}
|
|
162
166
|
else {
|
|
163
|
-
this.addIfInferred(node,
|
|
167
|
+
this.addIfInferred(node, input, foundType);
|
|
164
168
|
}
|
|
165
169
|
return foundType ? foundType : bodyType;
|
|
166
170
|
}
|
|
@@ -180,19 +184,21 @@ class Source {
|
|
|
180
184
|
let hexNext = false;
|
|
181
185
|
while (children.length >= 0) {
|
|
182
186
|
if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.MethodCallChain) {
|
|
183
|
-
context = new method_call_chain_1.MethodCallChain().runSyntax(first,
|
|
187
|
+
context = new method_call_chain_1.MethodCallChain().runSyntax(first, input, targetType);
|
|
184
188
|
if (context === undefined) {
|
|
185
|
-
|
|
189
|
+
const message = "Method has no RETURNING value";
|
|
190
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
191
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.FieldChain) {
|
|
189
|
-
context = new field_chain_1.FieldChain().runSyntax(first,
|
|
195
|
+
context = new field_chain_1.FieldChain().runSyntax(first, input, type);
|
|
190
196
|
}
|
|
191
197
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.StringTemplate) {
|
|
192
|
-
context = new string_template_1.StringTemplate().runSyntax(first,
|
|
198
|
+
context = new string_template_1.StringTemplate().runSyntax(first, input);
|
|
193
199
|
}
|
|
194
200
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Source) {
|
|
195
|
-
const found = new Source().runSyntax(first,
|
|
201
|
+
const found = new Source().runSyntax(first, input);
|
|
196
202
|
context = this.infer(context, found);
|
|
197
203
|
}
|
|
198
204
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Constant) {
|
|
@@ -200,10 +206,10 @@ class Source {
|
|
|
200
206
|
context = this.infer(context, found);
|
|
201
207
|
}
|
|
202
208
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Dereference) {
|
|
203
|
-
context = new dereference_1.Dereference().runSyntax(context);
|
|
209
|
+
context = new dereference_1.Dereference().runSyntax(first, context, input);
|
|
204
210
|
}
|
|
205
211
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
|
|
206
|
-
context = new component_chain_1.ComponentChain().runSyntax(context, first,
|
|
212
|
+
context = new component_chain_1.ComponentChain().runSyntax(context, first, input);
|
|
207
213
|
}
|
|
208
214
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArithOperator) {
|
|
209
215
|
if (first.concatTokens() === "**") {
|
|
@@ -216,7 +222,7 @@ class Source {
|
|
|
216
222
|
}
|
|
217
223
|
}
|
|
218
224
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
|
|
219
|
-
context = new attribute_chain_1.AttributeChain().runSyntax(context, first,
|
|
225
|
+
context = new attribute_chain_1.AttributeChain().runSyntax(context, first, input, type);
|
|
220
226
|
}
|
|
221
227
|
if (hexExpected === true) {
|
|
222
228
|
if (!(context instanceof basic_1.VoidType)
|
|
@@ -225,7 +231,9 @@ class Source {
|
|
|
225
231
|
&& !(context instanceof basic_1.XGenericType)
|
|
226
232
|
&& !(context instanceof basic_1.XSequenceType)
|
|
227
233
|
&& !(context instanceof unknown_type_1.UnknownType)) {
|
|
228
|
-
|
|
234
|
+
const message = "Operator only valid for XSTRING or HEX";
|
|
235
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
236
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
229
237
|
}
|
|
230
238
|
if (hexNext === false) {
|
|
231
239
|
hexExpected = false;
|
|
@@ -243,10 +251,10 @@ class Source {
|
|
|
243
251
|
return context;
|
|
244
252
|
}
|
|
245
253
|
////////////////////////////////
|
|
246
|
-
traverseRemainingChildren(children,
|
|
254
|
+
traverseRemainingChildren(children, input) {
|
|
247
255
|
const last = children[children.length - 1];
|
|
248
256
|
if (last && last.get() instanceof Expressions.Source) {
|
|
249
|
-
new Source().runSyntax(last,
|
|
257
|
+
new Source().runSyntax(last, input);
|
|
250
258
|
}
|
|
251
259
|
}
|
|
252
260
|
infer(context, found) {
|
|
@@ -257,37 +265,37 @@ class Source {
|
|
|
257
265
|
return found;
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
|
-
addIfInferred(node,
|
|
261
|
-
const basic = new basic_types_1.BasicTypes(
|
|
268
|
+
addIfInferred(node, input, inferredType) {
|
|
269
|
+
const basic = new basic_types_1.BasicTypes(input);
|
|
262
270
|
const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
|
|
263
271
|
const typeToken = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.getFirstToken();
|
|
264
272
|
const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
|
|
265
273
|
if (typeName === "#" && inferredType && typeToken) {
|
|
266
274
|
const found = basic.lookupQualifiedName(inferredType.getQualifiedName());
|
|
267
275
|
if (found) {
|
|
268
|
-
scope.addReference(typeToken, found, _reference_1.ReferenceType.InferredType, filename);
|
|
276
|
+
input.scope.addReference(typeToken, found, _reference_1.ReferenceType.InferredType, input.filename);
|
|
269
277
|
}
|
|
270
278
|
else if (inferredType instanceof basic_1.ObjectReferenceType) {
|
|
271
|
-
const def = scope.findObjectDefinition(inferredType.getQualifiedName());
|
|
279
|
+
const def = input.scope.findObjectDefinition(inferredType.getQualifiedName());
|
|
272
280
|
if (def) {
|
|
273
|
-
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, filename, inferredType);
|
|
274
|
-
scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, filename);
|
|
281
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, inferredType);
|
|
282
|
+
input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, input.filename);
|
|
275
283
|
}
|
|
276
284
|
}
|
|
277
285
|
else if (inferredType instanceof basic_1.CharacterType) {
|
|
278
286
|
// character is bit special it does not have a qualified name eg "TYPE c LENGTH 6"
|
|
279
|
-
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, filename, inferredType);
|
|
280
|
-
scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, filename);
|
|
287
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, inferredType);
|
|
288
|
+
input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, input.filename);
|
|
281
289
|
}
|
|
282
290
|
}
|
|
283
291
|
}
|
|
284
|
-
determineType(node,
|
|
285
|
-
const basic = new basic_types_1.BasicTypes(
|
|
292
|
+
determineType(node, input, targetType) {
|
|
293
|
+
const basic = new basic_types_1.BasicTypes(input);
|
|
286
294
|
const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
|
|
287
295
|
const typeToken = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.getFirstToken();
|
|
288
296
|
const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
|
|
289
297
|
if (typeExpression === undefined) {
|
|
290
|
-
throw new
|
|
298
|
+
throw new assert_error_1.AssertError("determineType, child TypeNameOrInfer not found");
|
|
291
299
|
}
|
|
292
300
|
else if (typeName === "#" && targetType) {
|
|
293
301
|
return targetType;
|
|
@@ -295,18 +303,20 @@ class Source {
|
|
|
295
303
|
if (typeName !== "#" && typeToken) {
|
|
296
304
|
const found = basic.parseType(typeExpression);
|
|
297
305
|
if (found && found instanceof unknown_type_1.UnknownType) {
|
|
298
|
-
if (scope.getDDIC().inErrorNamespace(typeName) === false) {
|
|
299
|
-
scope.addReference(typeToken, undefined, _reference_1.ReferenceType.VoidType, filename);
|
|
306
|
+
if (input.scope.getDDIC().inErrorNamespace(typeName) === false) {
|
|
307
|
+
input.scope.addReference(typeToken, undefined, _reference_1.ReferenceType.VoidType, input.filename);
|
|
300
308
|
return new basic_1.VoidType(typeName);
|
|
301
309
|
}
|
|
302
310
|
else {
|
|
303
|
-
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, filename, found);
|
|
304
|
-
scope.addReference(typeToken, tid, _reference_1.ReferenceType.TypeReference, filename);
|
|
311
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, found);
|
|
312
|
+
input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.TypeReference, input.filename);
|
|
305
313
|
return found;
|
|
306
314
|
}
|
|
307
315
|
}
|
|
308
316
|
else if (found === undefined) {
|
|
309
|
-
|
|
317
|
+
const message = "Type \"" + typeName + "\" not found in scope, VALUE";
|
|
318
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
319
|
+
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
310
320
|
}
|
|
311
321
|
return found;
|
|
312
322
|
}
|