@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
|
@@ -8,9 +8,10 @@ const nodes_1 = require("../../nodes");
|
|
|
8
8
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
9
9
|
const Basic = require("../../types/basic");
|
|
10
10
|
const static_1 = require("../statements/static");
|
|
11
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
11
12
|
// todo, this is much like DATA, refactor?
|
|
12
13
|
class Statics {
|
|
13
|
-
runSyntax(node,
|
|
14
|
+
runSyntax(node, input) {
|
|
14
15
|
var _a, _b;
|
|
15
16
|
const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();
|
|
16
17
|
let table = false;
|
|
@@ -18,13 +19,13 @@ class Statics {
|
|
|
18
19
|
for (const c of node.getChildren()) {
|
|
19
20
|
const ctyp = c.get();
|
|
20
21
|
if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Static) {
|
|
21
|
-
const found = new static_1.Static().runSyntax(c,
|
|
22
|
+
const found = new static_1.Static().runSyntax(c, input);
|
|
22
23
|
if (found) {
|
|
23
24
|
components.push({ name: found.getName(), type: found.getType() });
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Statics) {
|
|
27
|
-
const found = new Statics().runSyntax(c,
|
|
28
|
+
const found = new Statics().runSyntax(c, input);
|
|
28
29
|
if (found) {
|
|
29
30
|
components.push({ name: found.getName(), type: found.getType() });
|
|
30
31
|
}
|
|
@@ -37,9 +38,9 @@ class Statics {
|
|
|
37
38
|
else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {
|
|
38
39
|
// INCLUDES
|
|
39
40
|
const typeName = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
|
|
40
|
-
let found = (_b = scope.findType(typeName)) === null || _b === void 0 ? void 0 : _b.getType();
|
|
41
|
+
let found = (_b = input.scope.findType(typeName)) === null || _b === void 0 ? void 0 : _b.getType();
|
|
41
42
|
if (found === undefined) {
|
|
42
|
-
const f = scope.getDDIC().lookupTableOrView(typeName).type;
|
|
43
|
+
const f = input.scope.getDDIC().lookupTableOrView(typeName).type;
|
|
43
44
|
if (f instanceof _typed_identifier_1.TypedIdentifier) {
|
|
44
45
|
found = f.getType();
|
|
45
46
|
}
|
|
@@ -49,17 +50,20 @@ class Statics {
|
|
|
49
50
|
}
|
|
50
51
|
if (found instanceof Basic.VoidType) {
|
|
51
52
|
if (table === true) {
|
|
52
|
-
|
|
53
|
+
const ttyp = new Basic.TableType(found, { withHeader: true, keyType: Basic.TableKeyType.default });
|
|
54
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, ttyp);
|
|
53
55
|
}
|
|
54
56
|
else {
|
|
55
|
-
return new _typed_identifier_1.TypedIdentifier(name, filename, found);
|
|
57
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, found);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
if (found instanceof Basic.UnknownType) {
|
|
59
|
-
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.UnknownType("unknown type, " + typeName));
|
|
61
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.UnknownType("unknown type, " + typeName));
|
|
60
62
|
}
|
|
61
63
|
if (!(found instanceof Basic.StructureType)) {
|
|
62
|
-
|
|
64
|
+
const message = "not structured, " + typeName;
|
|
65
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
66
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.VoidType(_syntax_input_1.CheckSyntaxKey));
|
|
63
67
|
}
|
|
64
68
|
for (const c of found.getComponents()) {
|
|
65
69
|
components.push(c);
|
|
@@ -67,10 +71,11 @@ class Statics {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
if (table === true) {
|
|
70
|
-
|
|
74
|
+
const ttyp = new Basic.TableType(new Basic.StructureType(components), { withHeader: true, keyType: Basic.TableKeyType.default });
|
|
75
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, ttyp);
|
|
71
76
|
}
|
|
72
77
|
else {
|
|
73
|
-
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components));
|
|
78
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.StructureType(components));
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
}
|
|
@@ -9,17 +9,18 @@ const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
|
9
9
|
const _reference_1 = require("../_reference");
|
|
10
10
|
const enum_type_1 = require("../../types/basic/enum_type");
|
|
11
11
|
const _scope_type_1 = require("../_scope_type");
|
|
12
|
+
const assert_error_1 = require("../assert_error");
|
|
12
13
|
class TypeEnum {
|
|
13
|
-
runSyntax(node,
|
|
14
|
+
runSyntax(node, input) {
|
|
14
15
|
var _a;
|
|
15
16
|
let values = [];
|
|
16
17
|
const types = [];
|
|
17
18
|
if (!(node.get() instanceof Structures.TypeEnum)) {
|
|
18
|
-
throw new
|
|
19
|
+
throw new assert_error_1.AssertError("TypeEnum, unexpected type");
|
|
19
20
|
}
|
|
20
21
|
const begin = node.findDirectStatement(Statements.TypeEnumBegin);
|
|
21
22
|
if (begin === undefined) {
|
|
22
|
-
throw new
|
|
23
|
+
throw new assert_error_1.AssertError("TypeEnum, unexpected type, begin");
|
|
23
24
|
}
|
|
24
25
|
for (const type of node.findDirectStatements(Statements.Type)) {
|
|
25
26
|
const expr = type.findFirstExpression(Expressions.NamespaceSimpleName);
|
|
@@ -28,7 +29,7 @@ class TypeEnum {
|
|
|
28
29
|
}
|
|
29
30
|
const token = expr.getFirstToken();
|
|
30
31
|
// integer is default if BASE TYPE is not specified
|
|
31
|
-
values.push(new _typed_identifier_1.TypedIdentifier(token, filename, basic_1.IntegerType.get()));
|
|
32
|
+
values.push(new _typed_identifier_1.TypedIdentifier(token, input.filename, basic_1.IntegerType.get()));
|
|
32
33
|
}
|
|
33
34
|
for (const type of node.findDirectStatements(Statements.TypeEnum)) {
|
|
34
35
|
const expr = type.findFirstExpression(Expressions.NamespaceSimpleName);
|
|
@@ -37,25 +38,26 @@ class TypeEnum {
|
|
|
37
38
|
}
|
|
38
39
|
const token = expr.getFirstToken();
|
|
39
40
|
// integer is default if BASE TYPE is not specified
|
|
40
|
-
values.push(new _typed_identifier_1.TypedIdentifier(token, filename, basic_1.IntegerType.get()));
|
|
41
|
+
values.push(new _typed_identifier_1.TypedIdentifier(token, input.filename, basic_1.IntegerType.get()));
|
|
41
42
|
}
|
|
42
43
|
const baseType = (_a = begin.findExpressionAfterToken("TYPE")) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
43
44
|
const baseName = baseType === null || baseType === void 0 ? void 0 : baseType.getStr();
|
|
44
45
|
if (baseType && baseName) {
|
|
45
|
-
const found = scope.findType(baseName);
|
|
46
|
+
const found = input.scope.findType(baseName);
|
|
46
47
|
if (found) {
|
|
47
|
-
scope.addReference(baseType, found, _reference_1.ReferenceType.TypeReference, filename);
|
|
48
|
+
input.scope.addReference(baseType, found, _reference_1.ReferenceType.TypeReference, input.filename);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
const name = begin.findFirstExpression(Expressions.NamespaceSimpleName);
|
|
51
52
|
if (name) {
|
|
52
53
|
let qualifiedName = name.concatTokens();
|
|
53
|
-
if (scope.getType() === _scope_type_1.ScopeType.ClassDefinition
|
|
54
|
-
|| scope.getType() === _scope_type_1.ScopeType.Interface) {
|
|
55
|
-
qualifiedName = scope.getName() + "=>" + qualifiedName;
|
|
54
|
+
if (input.scope.getType() === _scope_type_1.ScopeType.ClassDefinition
|
|
55
|
+
|| input.scope.getType() === _scope_type_1.ScopeType.Interface) {
|
|
56
|
+
qualifiedName = input.scope.getName() + "=>" + qualifiedName;
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
58
|
+
const etype = new enum_type_1.EnumType({ qualifiedName: qualifiedName });
|
|
59
|
+
const id = new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, etype, ["enum" /* IdentifierMeta.Enum */]);
|
|
60
|
+
input.scope.addType(id);
|
|
59
61
|
types.push(id);
|
|
60
62
|
}
|
|
61
63
|
const stru = begin.findExpressionAfterToken("STRUCTURE");
|
|
@@ -68,7 +70,7 @@ class TypeEnum {
|
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
values = [];
|
|
71
|
-
const id = new _typed_identifier_1.TypedIdentifier(stru.getFirstToken(), filename, new basic_1.StructureType(components), ["enum" /* IdentifierMeta.Enum */]);
|
|
73
|
+
const id = new _typed_identifier_1.TypedIdentifier(stru.getFirstToken(), input.filename, new basic_1.StructureType(components), ["enum" /* IdentifierMeta.Enum */]);
|
|
72
74
|
values.push(id);
|
|
73
75
|
}
|
|
74
76
|
return { values, types };
|
|
@@ -12,7 +12,7 @@ const type_1 = require("../statements/type");
|
|
|
12
12
|
const Basic = require("../../types/basic");
|
|
13
13
|
const _scope_type_1 = require("../_scope_type");
|
|
14
14
|
class Types {
|
|
15
|
-
runSyntax(node,
|
|
15
|
+
runSyntax(node, input, qualifiedNamePrefix) {
|
|
16
16
|
const name = node.findFirstExpression(Expressions.NamespaceSimpleName).getFirstToken();
|
|
17
17
|
const components = [];
|
|
18
18
|
let voidd = undefined;
|
|
@@ -23,13 +23,13 @@ class Types {
|
|
|
23
23
|
const ctyp = c.get();
|
|
24
24
|
if (c instanceof nodes_1.StatementNode) {
|
|
25
25
|
if (ctyp instanceof Statements.Type) {
|
|
26
|
-
const found = new type_1.Type().runSyntax(c,
|
|
26
|
+
const found = new type_1.Type().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
|
|
27
27
|
if (found) {
|
|
28
28
|
components.push({ name: found.getName(), type: found.getType() });
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
else if (ctyp instanceof Statements.IncludeType) {
|
|
32
|
-
const found = new include_type_1.IncludeType().runSyntax(c,
|
|
32
|
+
const found = new include_type_1.IncludeType().runSyntax(c, input);
|
|
33
33
|
if (found instanceof basic_1.VoidType) {
|
|
34
34
|
voidd = found;
|
|
35
35
|
}
|
|
@@ -39,24 +39,24 @@ class Types {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Types) {
|
|
42
|
-
const found = new Types().runSyntax(c,
|
|
42
|
+
const found = new Types().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
|
|
43
43
|
if (found) {
|
|
44
44
|
components.push({ name: found.getName(), type: found.getType() });
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
if (voidd) {
|
|
49
|
-
return new _typed_identifier_1.TypedIdentifier(name, filename, voidd);
|
|
49
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, voidd);
|
|
50
50
|
}
|
|
51
51
|
else if (components.length === 0) { // todo, remove this check
|
|
52
52
|
return undefined;
|
|
53
53
|
}
|
|
54
54
|
let qualifiedName = qualifiedNamePrefix + name.getStr();
|
|
55
|
-
if (scope.getType() === _scope_type_1.ScopeType.ClassDefinition
|
|
56
|
-
|| scope.getType() === _scope_type_1.ScopeType.Interface) {
|
|
57
|
-
qualifiedName = scope.getName() + "=>" + qualifiedName;
|
|
55
|
+
if (input.scope.getType() === _scope_type_1.ScopeType.ClassDefinition
|
|
56
|
+
|| input.scope.getType() === _scope_type_1.ScopeType.Interface) {
|
|
57
|
+
qualifiedName = input.scope.getName() + "=>" + qualifiedName;
|
|
58
58
|
}
|
|
59
|
-
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components, qualifiedName));
|
|
59
|
+
return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.StructureType(components, qualifiedName));
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.Types = Types;
|
|
@@ -142,11 +142,13 @@ const insert_field_group_1 = require("./statements/insert_field_group");
|
|
|
142
142
|
const read_entities_1 = require("./statements/read_entities");
|
|
143
143
|
const modify_entities_1 = require("./statements/modify_entities");
|
|
144
144
|
const commit_entities_1 = require("./statements/commit_entities");
|
|
145
|
+
const _syntax_input_1 = require("./_syntax_input");
|
|
146
|
+
const assert_error_1 = require("./assert_error");
|
|
145
147
|
// -----------------------------------
|
|
146
148
|
const map = {};
|
|
147
149
|
function addToMap(handler) {
|
|
148
150
|
if (map[handler.constructor.name] !== undefined) {
|
|
149
|
-
throw new
|
|
151
|
+
throw new assert_error_1.AssertError("syntax.ts duplicate statement syntax handler");
|
|
150
152
|
}
|
|
151
153
|
map[handler.constructor.name] = handler;
|
|
152
154
|
}
|
|
@@ -341,7 +343,7 @@ class SyntaxLogic {
|
|
|
341
343
|
return this.scope;
|
|
342
344
|
}
|
|
343
345
|
newIssue(token, message) {
|
|
344
|
-
const issue = issue_1.Issue.atToken(this.currentFile, token, message,
|
|
346
|
+
const issue = issue_1.Issue.atToken(this.currentFile, token, message, _syntax_input_1.CheckSyntaxKey, severity_1.Severity.Error);
|
|
345
347
|
this.issues.push(issue);
|
|
346
348
|
}
|
|
347
349
|
traverse(node) {
|
|
@@ -378,36 +380,43 @@ class SyntaxLogic {
|
|
|
378
380
|
}
|
|
379
381
|
}
|
|
380
382
|
}
|
|
381
|
-
|
|
383
|
+
/**
|
|
384
|
+
* if this returns true, then the traversal should continue with next child
|
|
385
|
+
*/
|
|
382
386
|
updateScopeStructure(node) {
|
|
383
387
|
const filename = this.currentFile.getFilename();
|
|
384
388
|
const stru = node.get();
|
|
389
|
+
const input = {
|
|
390
|
+
scope: this.scope,
|
|
391
|
+
filename,
|
|
392
|
+
issues: this.issues,
|
|
393
|
+
};
|
|
385
394
|
if (stru instanceof Structures.ClassDefinition) {
|
|
386
|
-
new class_definition_1.ClassDefinition(node,
|
|
395
|
+
new class_definition_1.ClassDefinition(node, input);
|
|
387
396
|
return true;
|
|
388
397
|
}
|
|
389
398
|
else if (stru instanceof Structures.Interface) {
|
|
390
|
-
new interface_definition_1.InterfaceDefinition(node,
|
|
399
|
+
new interface_definition_1.InterfaceDefinition(node, input);
|
|
391
400
|
return true;
|
|
392
401
|
}
|
|
393
402
|
else if (stru instanceof Structures.Types) {
|
|
394
|
-
this.scope.addType(new types_1.Types().runSyntax(node,
|
|
403
|
+
this.scope.addType(new types_1.Types().runSyntax(node, input));
|
|
395
404
|
return true;
|
|
396
405
|
}
|
|
397
406
|
else if (stru instanceof Structures.Constants) {
|
|
398
|
-
this.scope.addIdentifier(new constants_1.Constants().runSyntax(node,
|
|
407
|
+
this.scope.addIdentifier(new constants_1.Constants().runSyntax(node, input).type);
|
|
399
408
|
return true;
|
|
400
409
|
}
|
|
401
410
|
else if (stru instanceof Structures.Data) {
|
|
402
|
-
this.scope.addIdentifier(new data_1.Data().runSyntax(node,
|
|
411
|
+
this.scope.addIdentifier(new data_1.Data().runSyntax(node, input));
|
|
403
412
|
return true;
|
|
404
413
|
}
|
|
405
414
|
else if (stru instanceof Structures.Statics) {
|
|
406
|
-
this.scope.addIdentifier(new statics_1.Statics().runSyntax(node,
|
|
415
|
+
this.scope.addIdentifier(new statics_1.Statics().runSyntax(node, input));
|
|
407
416
|
return true;
|
|
408
417
|
}
|
|
409
418
|
else if (stru instanceof Structures.TypeEnum) {
|
|
410
|
-
const values = new type_enum_1.TypeEnum().runSyntax(node,
|
|
419
|
+
const values = new type_enum_1.TypeEnum().runSyntax(node, input).values;
|
|
411
420
|
this.scope.addList(values);
|
|
412
421
|
return true;
|
|
413
422
|
}
|
|
@@ -416,26 +425,31 @@ class SyntaxLogic {
|
|
|
416
425
|
updateScopeStatement(node) {
|
|
417
426
|
const filename = this.currentFile.getFilename();
|
|
418
427
|
const s = node.get();
|
|
428
|
+
const input = {
|
|
429
|
+
scope: this.scope,
|
|
430
|
+
filename,
|
|
431
|
+
issues: this.issues,
|
|
432
|
+
};
|
|
419
433
|
// todo, refactor
|
|
420
434
|
if (s instanceof Statements.Type) {
|
|
421
|
-
this.scope.addType(new type_1.Type().runSyntax(node,
|
|
435
|
+
this.scope.addType(new type_1.Type().runSyntax(node, input));
|
|
422
436
|
return;
|
|
423
437
|
}
|
|
424
438
|
else if (s instanceof Statements.Constant) {
|
|
425
|
-
this.scope.addIdentifier(new constant_1.Constant().runSyntax(node,
|
|
439
|
+
this.scope.addIdentifier(new constant_1.Constant().runSyntax(node, input));
|
|
426
440
|
return;
|
|
427
441
|
}
|
|
428
442
|
else if (s instanceof Statements.Static) {
|
|
429
|
-
this.scope.addIdentifier(new static_1.Static().runSyntax(node,
|
|
443
|
+
this.scope.addIdentifier(new static_1.Static().runSyntax(node, input));
|
|
430
444
|
return;
|
|
431
445
|
}
|
|
432
446
|
else if (s instanceof Statements.Data) {
|
|
433
|
-
this.scope.addIdentifier(new data_2.Data().runSyntax(node,
|
|
447
|
+
this.scope.addIdentifier(new data_2.Data().runSyntax(node, input));
|
|
434
448
|
return;
|
|
435
449
|
}
|
|
436
450
|
const name = s.constructor.name;
|
|
437
451
|
if (map[name]) {
|
|
438
|
-
map[name].runSyntax(node,
|
|
452
|
+
map[name].runSyntax(node, input);
|
|
439
453
|
return;
|
|
440
454
|
}
|
|
441
455
|
if (s instanceof Statements.FunctionModule) {
|
|
@@ -448,7 +462,9 @@ class SyntaxLogic {
|
|
|
448
462
|
this.scope.pop(node.getLastToken().getEnd());
|
|
449
463
|
}
|
|
450
464
|
else if (s instanceof Statements.EndMethod) {
|
|
451
|
-
this.scope.
|
|
465
|
+
if (this.scope.getType() === _scope_type_1.ScopeType.Method) {
|
|
466
|
+
this.scope.pop(node.getLastToken().getEnd());
|
|
467
|
+
}
|
|
452
468
|
if (this.scope.getType() === _scope_type_1.ScopeType.MethodInstance) {
|
|
453
469
|
this.scope.pop(node.getLastToken().getEnd());
|
|
454
470
|
}
|
|
@@ -18,13 +18,13 @@ const type_definitions_1 = require("./type_definitions");
|
|
|
18
18
|
const types_1 = require("../5_syntax/structures/types");
|
|
19
19
|
const type_1 = require("../5_syntax/statements/type");
|
|
20
20
|
class Attributes {
|
|
21
|
-
constructor(node,
|
|
21
|
+
constructor(node, input) {
|
|
22
22
|
this.static = [];
|
|
23
23
|
this.instance = [];
|
|
24
24
|
this.constants = [];
|
|
25
|
-
this.filename = filename;
|
|
25
|
+
this.filename = input.filename;
|
|
26
26
|
this.tlist = [];
|
|
27
|
-
this.parse(node,
|
|
27
|
+
this.parse(node, input);
|
|
28
28
|
this.types = new type_definitions_1.TypeDefinitions(this.tlist);
|
|
29
29
|
}
|
|
30
30
|
getTypes() {
|
|
@@ -93,22 +93,22 @@ class Attributes {
|
|
|
93
93
|
return undefined;
|
|
94
94
|
}
|
|
95
95
|
/////////////////////////////
|
|
96
|
-
parse(node,
|
|
96
|
+
parse(node, input) {
|
|
97
97
|
const cdef = node.findDirectStructure(Structures.ClassDefinition);
|
|
98
98
|
if (cdef) {
|
|
99
|
-
this.parseSection(cdef.findDirectStructure(Structures.PublicSection), visibility_1.Visibility.Public,
|
|
100
|
-
this.parseSection(cdef.findDirectStructure(Structures.ProtectedSection), visibility_1.Visibility.Protected,
|
|
101
|
-
this.parseSection(cdef.findDirectStructure(Structures.PrivateSection), visibility_1.Visibility.Private,
|
|
99
|
+
this.parseSection(cdef.findDirectStructure(Structures.PublicSection), visibility_1.Visibility.Public, input);
|
|
100
|
+
this.parseSection(cdef.findDirectStructure(Structures.ProtectedSection), visibility_1.Visibility.Protected, input);
|
|
101
|
+
this.parseSection(cdef.findDirectStructure(Structures.PrivateSection), visibility_1.Visibility.Private, input);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
const idef = node.findDirectStructure(Structures.Interface);
|
|
105
105
|
if (idef) {
|
|
106
|
-
this.parseSection(idef.findDirectStructure(Structures.SectionContents), visibility_1.Visibility.Public,
|
|
106
|
+
this.parseSection(idef.findDirectStructure(Structures.SectionContents), visibility_1.Visibility.Public, input);
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
throw new Error("MethodDefinition, expected ClassDefinition or InterfaceDefinition");
|
|
110
110
|
}
|
|
111
|
-
parseSection(node, visibility,
|
|
111
|
+
parseSection(node, visibility, input) {
|
|
112
112
|
if (node === undefined) {
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
@@ -116,36 +116,36 @@ class Attributes {
|
|
|
116
116
|
const ctyp = c.get();
|
|
117
117
|
if (c instanceof nodes_1.StructureNode) {
|
|
118
118
|
if (ctyp instanceof Structures.Data) {
|
|
119
|
-
const found = new data_2.Data().runSyntax(c,
|
|
119
|
+
const found = new data_2.Data().runSyntax(c, input);
|
|
120
120
|
if (found !== undefined) {
|
|
121
121
|
const attr = new class_attribute_1.ClassAttribute(found, visibility, found.getMeta(), found.getValue());
|
|
122
122
|
this.instance.push(attr);
|
|
123
|
-
scope.addIdentifier(attr);
|
|
123
|
+
input.scope.addIdentifier(attr);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
else if (ctyp instanceof Structures.ClassData) {
|
|
127
|
-
const found = new class_data_2.ClassData().runSyntax(c,
|
|
127
|
+
const found = new class_data_2.ClassData().runSyntax(c, input);
|
|
128
128
|
if (found !== undefined) {
|
|
129
129
|
const attr = new class_attribute_1.ClassAttribute(found, visibility, found.getMeta(), found.getValue());
|
|
130
130
|
this.static.push(attr);
|
|
131
|
-
scope.addIdentifier(attr);
|
|
131
|
+
input.scope.addIdentifier(attr);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
else if (ctyp instanceof Structures.Constants) {
|
|
135
|
-
const { type: found, values } = new constants_1.Constants().runSyntax(c,
|
|
135
|
+
const { type: found, values } = new constants_1.Constants().runSyntax(c, input);
|
|
136
136
|
if (found !== undefined) {
|
|
137
137
|
const attr = new class_constant_1.ClassConstant(found, visibility, values);
|
|
138
138
|
this.constants.push(attr);
|
|
139
|
-
scope.addIdentifier(attr);
|
|
139
|
+
input.scope.addIdentifier(attr);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
else if (ctyp instanceof Structures.TypeEnum) {
|
|
143
|
-
const { values, types } = new type_enum_1.TypeEnum().runSyntax(c,
|
|
143
|
+
const { values, types } = new type_enum_1.TypeEnum().runSyntax(c, input);
|
|
144
144
|
for (const v of values) {
|
|
145
145
|
// for now add ENUM values as constants
|
|
146
146
|
const attr = new class_constant_1.ClassConstant(v, visibility, "novalueClassAttributeEnum");
|
|
147
147
|
this.constants.push(attr);
|
|
148
|
-
scope.addIdentifier(attr);
|
|
148
|
+
input.scope.addIdentifier(attr);
|
|
149
149
|
}
|
|
150
150
|
for (const t of types) {
|
|
151
151
|
this.tlist.push({ type: t, visibility });
|
|
@@ -153,50 +153,50 @@ class Attributes {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
else if (ctyp instanceof Structures.Types) {
|
|
156
|
-
const res = new types_1.Types().runSyntax(c,
|
|
156
|
+
const res = new types_1.Types().runSyntax(c, input);
|
|
157
157
|
if (res) {
|
|
158
|
-
scope.addType(res);
|
|
158
|
+
input.scope.addType(res);
|
|
159
159
|
this.tlist.push({ type: res, visibility });
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
else {
|
|
163
163
|
// begin recursion
|
|
164
|
-
this.parseSection(c, visibility,
|
|
164
|
+
this.parseSection(c, visibility, input);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
else if (c instanceof nodes_1.StatementNode) {
|
|
168
168
|
if (ctyp instanceof Statements.Data) {
|
|
169
|
-
this.instance.push(this.parseAttribute(c, visibility,
|
|
169
|
+
this.instance.push(this.parseAttribute(c, visibility, input));
|
|
170
170
|
}
|
|
171
171
|
else if (ctyp instanceof Statements.ClassData) {
|
|
172
|
-
this.static.push(this.parseAttribute(c, visibility,
|
|
172
|
+
this.static.push(this.parseAttribute(c, visibility, input));
|
|
173
173
|
}
|
|
174
174
|
else if (ctyp instanceof Statements.Constant) {
|
|
175
|
-
const found = new constant_1.Constant().runSyntax(c,
|
|
175
|
+
const found = new constant_1.Constant().runSyntax(c, input);
|
|
176
176
|
if (found) {
|
|
177
177
|
const attr = new class_constant_1.ClassConstant(found, visibility, found.getValue());
|
|
178
178
|
this.constants.push(attr);
|
|
179
|
-
scope.addIdentifier(attr);
|
|
179
|
+
input.scope.addIdentifier(attr);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
else if (ctyp instanceof Statements.Type) {
|
|
183
|
-
const res = new type_1.Type().runSyntax(c,
|
|
183
|
+
const res = new type_1.Type().runSyntax(c, input);
|
|
184
184
|
if (res) {
|
|
185
|
-
scope.addType(res);
|
|
185
|
+
input.scope.addType(res);
|
|
186
186
|
this.tlist.push({ type: res, visibility });
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
parseAttribute(node, visibility,
|
|
192
|
+
parseAttribute(node, visibility, input) {
|
|
193
193
|
let found = undefined;
|
|
194
194
|
const s = node.get();
|
|
195
195
|
if (s instanceof Statements.Data) {
|
|
196
|
-
found = new data_1.Data().runSyntax(node,
|
|
196
|
+
found = new data_1.Data().runSyntax(node, input);
|
|
197
197
|
}
|
|
198
198
|
else if (s instanceof Statements.ClassData) {
|
|
199
|
-
found = new class_data_1.ClassData().runSyntax(node,
|
|
199
|
+
found = new class_data_1.ClassData().runSyntax(node, input);
|
|
200
200
|
}
|
|
201
201
|
else {
|
|
202
202
|
throw new Error("ClassAttribute, unexpected node, 1, " + this.filename);
|
|
@@ -204,7 +204,7 @@ class Attributes {
|
|
|
204
204
|
if (found === undefined) {
|
|
205
205
|
throw new Error("ClassAttribute, unexpected node, " + this.filename);
|
|
206
206
|
}
|
|
207
|
-
scope.addIdentifier(found);
|
|
207
|
+
input.scope.addIdentifier(found);
|
|
208
208
|
return new class_attribute_1.ClassAttribute(found, visibility, found.getMeta(), found.getValue());
|
|
209
209
|
}
|
|
210
210
|
}
|
|
@@ -15,39 +15,39 @@ const visibility_1 = require("../4_file_information/visibility");
|
|
|
15
15
|
const _object_oriented_1 = require("../5_syntax/_object_oriented");
|
|
16
16
|
const _reference_1 = require("../5_syntax/_reference");
|
|
17
17
|
class ClassDefinition extends _identifier_1.Identifier {
|
|
18
|
-
constructor(node,
|
|
18
|
+
constructor(node, input) {
|
|
19
19
|
if (!(node.get() instanceof Structures.ClassDefinition)) {
|
|
20
20
|
throw new Error("ClassDefinition, unexpected node type");
|
|
21
21
|
}
|
|
22
22
|
const def = node.findFirstStatement(Statements.ClassDefinition);
|
|
23
23
|
const name = def.findDirectExpression(Expressions.ClassName).getFirstToken();
|
|
24
|
-
super(name, filename);
|
|
25
|
-
scope.addClassDefinition(this);
|
|
24
|
+
super(name, input.filename);
|
|
25
|
+
input.scope.addClassDefinition(this);
|
|
26
26
|
this.events = [];
|
|
27
27
|
this.implementing = [];
|
|
28
28
|
this.globalValue = def.findFirstExpression(Expressions.ClassGlobal) !== undefined;
|
|
29
29
|
this.finalValue = def.findFirstExpression(Expressions.ClassFinal) !== undefined;
|
|
30
|
-
scope.push(_scope_type_1.ScopeType.ClassDefinition, name.getStr(), name.getStart(), filename);
|
|
31
|
-
this.superClass = this.findSuper(def,
|
|
32
|
-
this.friends = this.findFriends(def,
|
|
33
|
-
this.parse(
|
|
34
|
-
const helper = new _object_oriented_1.ObjectOriented(scope);
|
|
30
|
+
input.scope.push(_scope_type_1.ScopeType.ClassDefinition, name.getStr(), name.getStart(), input.filename);
|
|
31
|
+
this.superClass = this.findSuper(def, input);
|
|
32
|
+
this.friends = this.findFriends(def, input);
|
|
33
|
+
this.parse(input, node);
|
|
34
|
+
const helper = new _object_oriented_1.ObjectOriented(input.scope);
|
|
35
35
|
helper.fromSuperClassesAndInterfaces(this);
|
|
36
36
|
helper.addAliasedTypes(this.aliases);
|
|
37
|
-
this.attributes = new class_attributes_1.Attributes(node,
|
|
37
|
+
this.attributes = new class_attributes_1.Attributes(node, input);
|
|
38
38
|
this.types = this.attributes.getTypes();
|
|
39
39
|
const events = node.findAllStatements(Statements.Events);
|
|
40
40
|
for (const e of events) {
|
|
41
|
-
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public,
|
|
41
|
+
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input)); // todo, all these are not Public
|
|
42
42
|
}
|
|
43
|
-
this.methodDefs = new method_definitions_1.MethodDefinitions(node,
|
|
44
|
-
scope.pop(node.getLastToken().getEnd());
|
|
43
|
+
this.methodDefs = new method_definitions_1.MethodDefinitions(node, input);
|
|
44
|
+
input.scope.pop(node.getLastToken().getEnd());
|
|
45
45
|
const concat = def.concatTokens().toUpperCase();
|
|
46
46
|
this.testing = concat.includes(" FOR TESTING");
|
|
47
47
|
this.sharedMemory = concat.includes(" SHARED MEMORY ENABLED");
|
|
48
48
|
this.abstract = (def === null || def === void 0 ? void 0 : def.findDirectTokenByText("ABSTRACT")) !== undefined;
|
|
49
49
|
// perform checks after everything has been initialized
|
|
50
|
-
this.checkMethodsFromSuperClasses(scope);
|
|
50
|
+
this.checkMethodsFromSuperClasses(input.scope);
|
|
51
51
|
}
|
|
52
52
|
getFriends() {
|
|
53
53
|
return this.friends;
|
|
@@ -93,10 +93,10 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
93
93
|
}
|
|
94
94
|
*/
|
|
95
95
|
///////////////////
|
|
96
|
-
findSuper(def,
|
|
96
|
+
findSuper(def, input) {
|
|
97
97
|
var _a;
|
|
98
98
|
const token = (_a = def === null || def === void 0 ? void 0 : def.findDirectExpression(expressions_1.SuperClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
99
|
-
this.addReference(token,
|
|
99
|
+
this.addReference(token, input);
|
|
100
100
|
const name = token === null || token === void 0 ? void 0 : token.getStr();
|
|
101
101
|
return name;
|
|
102
102
|
}
|
|
@@ -127,30 +127,30 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
findFriends(def,
|
|
130
|
+
findFriends(def, input) {
|
|
131
131
|
var _a;
|
|
132
132
|
const result = [];
|
|
133
133
|
for (const n of ((_a = def === null || def === void 0 ? void 0 : def.findDirectExpression(Expressions.ClassFriends)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.ClassName)) || []) {
|
|
134
134
|
const token = n.getFirstToken();
|
|
135
|
-
this.addReference(token,
|
|
135
|
+
this.addReference(token, input);
|
|
136
136
|
const name = token.getStr();
|
|
137
137
|
result.push(name);
|
|
138
138
|
}
|
|
139
139
|
return result;
|
|
140
140
|
}
|
|
141
|
-
addReference(token,
|
|
141
|
+
addReference(token, input) {
|
|
142
142
|
const name = token === null || token === void 0 ? void 0 : token.getStr();
|
|
143
143
|
if (name) {
|
|
144
|
-
const s = scope.findClassDefinition(name);
|
|
144
|
+
const s = input.scope.findClassDefinition(name);
|
|
145
145
|
if (s) {
|
|
146
|
-
scope.addReference(token, s, _reference_1.ReferenceType.ObjectOrientedReference, filename, { ooName: name.toUpperCase(), ooType: "CLAS" });
|
|
146
|
+
input.scope.addReference(token, s, _reference_1.ReferenceType.ObjectOrientedReference, input.filename, { ooName: name.toUpperCase(), ooType: "CLAS" });
|
|
147
147
|
}
|
|
148
|
-
else if (scope.getDDIC().inErrorNamespace(name) === false) {
|
|
149
|
-
scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename);
|
|
148
|
+
else if (input.scope.getDDIC().inErrorNamespace(name) === false) {
|
|
149
|
+
input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
parse(
|
|
153
|
+
parse(input, inputNode) {
|
|
154
154
|
var _a;
|
|
155
155
|
for (const node of inputNode.findAllStatements(Statements.InterfaceDef)) {
|
|
156
156
|
const partial = node.findDirectTokenByText("PARTIALLY") !== undefined;
|
|
@@ -160,18 +160,18 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
160
160
|
}
|
|
161
161
|
const name = token.getStr().toUpperCase();
|
|
162
162
|
this.implementing.push({ name, partial });
|
|
163
|
-
const intf = scope.findInterfaceDefinition(name);
|
|
163
|
+
const intf = input.scope.findInterfaceDefinition(name);
|
|
164
164
|
if (intf) {
|
|
165
|
-
scope.addReference(token, intf, _reference_1.ReferenceType.ObjectOrientedReference, filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
165
|
+
input.scope.addReference(token, intf, _reference_1.ReferenceType.ObjectOrientedReference, input.filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
166
166
|
}
|
|
167
|
-
else if (scope.getDDIC().inErrorNamespace(name) === false) {
|
|
168
|
-
scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
167
|
+
else if (input.scope.getDDIC().inErrorNamespace(name) === false) {
|
|
168
|
+
input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
|
-
scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedUnknownReference, filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
171
|
+
input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedUnknownReference, input.filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
this.aliases = new aliases_1.Aliases(inputNode, this.filename, scope);
|
|
174
|
+
this.aliases = new aliases_1.Aliases(inputNode, this.filename, input.scope);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
exports.ClassDefinition = ClassDefinition;
|