@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
package/build/abaplint.d.ts
CHANGED
|
@@ -346,7 +346,7 @@ declare class Attributes implements IAttributes {
|
|
|
346
346
|
private readonly types;
|
|
347
347
|
private readonly tlist;
|
|
348
348
|
private readonly filename;
|
|
349
|
-
constructor(node: StructureNode,
|
|
349
|
+
constructor(node: StructureNode, input: SyntaxInput);
|
|
350
350
|
getTypes(): TypeDefinitions;
|
|
351
351
|
getStatic(): ClassAttribute[];
|
|
352
352
|
getAll(): readonly ClassAttribute[];
|
|
@@ -1030,7 +1030,7 @@ declare class ClassDefinition_3 extends Identifier implements IClassDefinition {
|
|
|
1030
1030
|
private readonly globalValue;
|
|
1031
1031
|
private readonly sharedMemory;
|
|
1032
1032
|
private aliases;
|
|
1033
|
-
constructor(node: StructureNode,
|
|
1033
|
+
constructor(node: StructureNode, input: SyntaxInput);
|
|
1034
1034
|
getFriends(): string[];
|
|
1035
1035
|
getEvents(): IEventDefinition[];
|
|
1036
1036
|
getMethodDefinitions(): IMethodDefinitions;
|
|
@@ -2522,7 +2522,7 @@ declare class FormDefinition_2 extends Identifier implements IFormDefinition {
|
|
|
2522
2522
|
private readonly tableParameters;
|
|
2523
2523
|
private readonly usingParameters;
|
|
2524
2524
|
private readonly changingParameters;
|
|
2525
|
-
constructor(node: StructureNode | StatementNode,
|
|
2525
|
+
constructor(node: StructureNode | StatementNode, input: SyntaxInput);
|
|
2526
2526
|
getTablesParameters(): TypedIdentifier[];
|
|
2527
2527
|
getUsingParameters(): TypedIdentifier[];
|
|
2528
2528
|
getChangingParameters(): TypedIdentifier[];
|
|
@@ -3576,7 +3576,7 @@ declare class InterfaceDefinition extends Identifier implements IInterfaceDefini
|
|
|
3576
3576
|
private readonly events;
|
|
3577
3577
|
private readonly globalValue;
|
|
3578
3578
|
private aliases;
|
|
3579
|
-
constructor(node: StructureNode,
|
|
3579
|
+
constructor(node: StructureNode, input: SyntaxInput);
|
|
3580
3580
|
getSuperClass(): undefined;
|
|
3581
3581
|
getImplementing(): readonly IImplementing[];
|
|
3582
3582
|
getAliases(): IAliases;
|
|
@@ -3846,6 +3846,7 @@ export declare class Issue {
|
|
|
3846
3846
|
static atRowRange(file: IFile, row: number, startCol: number, endCol: number, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3847
3847
|
static atRange(file: IFile, start: Position, end: Position, message: string, key: string, severity?: Severity, fix?: IEdit, alternativeFixes?: Fix[]): Issue;
|
|
3848
3848
|
static atToken(file: IFile, token: Token, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3849
|
+
static atTokenFilename(filename: string, token: Token, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3849
3850
|
static atIdentifier(identifier: Identifier, message: string, key: string, severity?: Severity, fix?: IEdit): Issue;
|
|
3850
3851
|
constructor(data: IIssueData);
|
|
3851
3852
|
getData(): IIssueData;
|
|
@@ -4221,7 +4222,7 @@ declare class MethodDefinition extends Identifier implements IMethodDefinition {
|
|
|
4221
4222
|
private readonly static;
|
|
4222
4223
|
private readonly raising;
|
|
4223
4224
|
private readonly exceptions;
|
|
4224
|
-
constructor(node: StatementNode, visibility: Visibility,
|
|
4225
|
+
constructor(node: StatementNode, visibility: Visibility, input: SyntaxInput);
|
|
4225
4226
|
getVisibility(): Visibility;
|
|
4226
4227
|
isRedefinition(): boolean;
|
|
4227
4228
|
isAbstract(): boolean;
|
|
@@ -4234,8 +4235,7 @@ declare class MethodDefinition extends Identifier implements IMethodDefinition {
|
|
|
4234
4235
|
|
|
4235
4236
|
declare class MethodDefinitions implements IMethodDefinitions {
|
|
4236
4237
|
private readonly all;
|
|
4237
|
-
|
|
4238
|
-
constructor(node: StructureNode, filename: string, scope: CurrentScope);
|
|
4238
|
+
constructor(node: StructureNode, input: SyntaxInput);
|
|
4239
4239
|
getAll(): Generator<IMethodDefinition, void, undefined>;
|
|
4240
4240
|
getByName(name: string | undefined): IMethodDefinition | undefined;
|
|
4241
4241
|
private parseInterface;
|
|
@@ -4292,7 +4292,7 @@ declare class MethodParameters_2 implements IMethodParameters {
|
|
|
4292
4292
|
private readonly exceptions;
|
|
4293
4293
|
private readonly defaults;
|
|
4294
4294
|
private readonly filename;
|
|
4295
|
-
constructor(node: StatementNode,
|
|
4295
|
+
constructor(node: StatementNode, input: SyntaxInput, abstractMethod: boolean);
|
|
4296
4296
|
getFilename(): string;
|
|
4297
4297
|
getOptional(): string[];
|
|
4298
4298
|
getAll(): TypedIdentifier[];
|
|
@@ -6543,6 +6543,12 @@ declare class SyntaxCheck implements IStatement {
|
|
|
6543
6543
|
getMatcher(): IStatementRunnable;
|
|
6544
6544
|
}
|
|
6545
6545
|
|
|
6546
|
+
declare type SyntaxInput = {
|
|
6547
|
+
scope: CurrentScope;
|
|
6548
|
+
filename: string;
|
|
6549
|
+
issues: Issue[];
|
|
6550
|
+
};
|
|
6551
|
+
|
|
6546
6552
|
export declare class SyntaxLogic {
|
|
6547
6553
|
private currentFile;
|
|
6548
6554
|
private issues;
|
|
@@ -6555,6 +6561,9 @@ export declare class SyntaxLogic {
|
|
|
6555
6561
|
private traverseObject;
|
|
6556
6562
|
private newIssue;
|
|
6557
6563
|
private traverse;
|
|
6564
|
+
/**
|
|
6565
|
+
* if this returns true, then the traversal should continue with next child
|
|
6566
|
+
*/
|
|
6558
6567
|
private updateScopeStructure;
|
|
6559
6568
|
private updateScopeStatement;
|
|
6560
6569
|
}
|
|
@@ -24,10 +24,10 @@ class BuiltInMethod extends _identifier_1.Identifier {
|
|
|
24
24
|
return ret;
|
|
25
25
|
}
|
|
26
26
|
getOptional() {
|
|
27
|
-
throw new Error("BuiltInMethod->Method not implemented
|
|
27
|
+
throw new Error("BuiltInMethod->Method not implemented");
|
|
28
28
|
}
|
|
29
29
|
getAll() {
|
|
30
|
-
throw new Error("BuiltInMethod->getAll, Method not implemented
|
|
30
|
+
throw new Error("BuiltInMethod->getAll, Method not implemented");
|
|
31
31
|
}
|
|
32
32
|
getImporting() {
|
|
33
33
|
const ret = [];
|
|
@@ -403,6 +403,7 @@ class CurrentScope {
|
|
|
403
403
|
}
|
|
404
404
|
push(stype, sname, start, filename) {
|
|
405
405
|
const identifier = { stype, sname, start, filename, end: undefined };
|
|
406
|
+
// console.dir("push scope, " + stype);
|
|
406
407
|
if (this.current === undefined) {
|
|
407
408
|
// the top node
|
|
408
409
|
this.current = new spaghetti_scope_1.SpaghettiScopeNode(identifier, undefined);
|
|
@@ -442,6 +443,7 @@ class CurrentScope {
|
|
|
442
443
|
return name.toUpperCase() === ((_a = this.allowHeaderUse) === null || _a === void 0 ? void 0 : _a.toUpperCase());
|
|
443
444
|
}
|
|
444
445
|
pop(end) {
|
|
446
|
+
// console.dir("pop scope, " + this.current?.getIdentifier().stype);
|
|
445
447
|
this.allowHeaderUse = undefined;
|
|
446
448
|
if (this.current === undefined) {
|
|
447
449
|
throw new Error("something wrong, top scope popped");
|
|
@@ -21,9 +21,13 @@ class Procedural {
|
|
|
21
21
|
addAllFormDefinitions(file, obj) {
|
|
22
22
|
const structure = file.getStructure();
|
|
23
23
|
if (structure) {
|
|
24
|
-
const
|
|
24
|
+
const input = {
|
|
25
|
+
scope: _current_scope_1.CurrentScope.buildDefault(this.reg, obj),
|
|
26
|
+
filename: file.getFilename(),
|
|
27
|
+
issues: [],
|
|
28
|
+
};
|
|
25
29
|
for (const found of structure.findAllStructures(Structures.Form)) {
|
|
26
|
-
this.scope.addFormDefinitions([new types_1.FormDefinition(found,
|
|
30
|
+
this.scope.addFormDefinitions([new types_1.FormDefinition(found, input)]);
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
const stru = file.getStructure();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckSyntaxKey = void 0;
|
|
4
|
+
exports.syntaxIssue = syntaxIssue;
|
|
5
|
+
const issue_1 = require("../../issue");
|
|
6
|
+
const severity_1 = require("../../severity");
|
|
7
|
+
exports.CheckSyntaxKey = "check_syntax";
|
|
8
|
+
function syntaxIssue(input, token, message) {
|
|
9
|
+
return issue_1.Issue.atTokenFilename(input.filename, token, message, exports.CheckSyntaxKey, severity_1.Severity.Error);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=_syntax_input.js.map
|
|
@@ -18,9 +18,8 @@ const expressions_1 = require("../2_statements/expressions");
|
|
|
18
18
|
const _builtin_1 = require("./_builtin");
|
|
19
19
|
const position_1 = require("../../position");
|
|
20
20
|
class BasicTypes {
|
|
21
|
-
constructor(
|
|
22
|
-
this.
|
|
23
|
-
this.scope = scope;
|
|
21
|
+
constructor(input) {
|
|
22
|
+
this.input = input;
|
|
24
23
|
}
|
|
25
24
|
lookupQualifiedName(name) {
|
|
26
25
|
var _a;
|
|
@@ -28,7 +27,7 @@ class BasicTypes {
|
|
|
28
27
|
if (name === undefined) {
|
|
29
28
|
return undefined;
|
|
30
29
|
}
|
|
31
|
-
const found = this.scope.findType(name);
|
|
30
|
+
const found = this.input.scope.findType(name);
|
|
32
31
|
if (found) {
|
|
33
32
|
return found;
|
|
34
33
|
}
|
|
@@ -36,7 +35,7 @@ class BasicTypes {
|
|
|
36
35
|
const split = name.split("=>");
|
|
37
36
|
const ooName = split[0];
|
|
38
37
|
const typeName = split[1];
|
|
39
|
-
const oo = this.scope.findObjectDefinition(ooName);
|
|
38
|
+
const oo = this.input.scope.findObjectDefinition(ooName);
|
|
40
39
|
if (oo) {
|
|
41
40
|
if (typeName.includes("-")) {
|
|
42
41
|
const split = typeName.split("-");
|
|
@@ -66,7 +65,7 @@ class BasicTypes {
|
|
|
66
65
|
const split = name.split("-");
|
|
67
66
|
const typeName = split[0];
|
|
68
67
|
const fieldName = split[1];
|
|
69
|
-
const type = this.scope.findType(typeName);
|
|
68
|
+
const type = this.input.scope.findType(typeName);
|
|
70
69
|
if (type) {
|
|
71
70
|
const stru = type.getType();
|
|
72
71
|
if (stru instanceof basic_1.StructureType) {
|
|
@@ -80,16 +79,16 @@ class BasicTypes {
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
const lookup = this.scope.getDDIC().lookupNoVoid(name);
|
|
82
|
+
const lookup = this.input.scope.getDDIC().lookupNoVoid(name);
|
|
84
83
|
const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();
|
|
85
84
|
if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {
|
|
86
85
|
return new _typed_identifier_1.TypedIdentifier(id.getToken(), id.getFilename(), lookup.type);
|
|
87
86
|
}
|
|
88
|
-
const builtin = this.scope.getDDIC().lookupBuiltinType(name);
|
|
87
|
+
const builtin = this.input.scope.getDDIC().lookupBuiltinType(name);
|
|
89
88
|
if (builtin) {
|
|
90
89
|
return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);
|
|
91
90
|
}
|
|
92
|
-
const type = this.scope.findTypePoolType(name);
|
|
91
|
+
const type = this.input.scope.findTypePoolType(name);
|
|
93
92
|
if (type) {
|
|
94
93
|
return type;
|
|
95
94
|
}
|
|
@@ -120,29 +119,29 @@ class BasicTypes {
|
|
|
120
119
|
}
|
|
121
120
|
let type = undefined;
|
|
122
121
|
if (children[1] && (children[1].getFirstToken().getStr() === "=>" || children[1].getFirstToken().getStr() === "->")) {
|
|
123
|
-
type = new field_chain_1.FieldChain().runSyntax(chain, this.
|
|
122
|
+
type = new field_chain_1.FieldChain().runSyntax(chain, this.input, _reference_1.ReferenceType.TypeReference);
|
|
124
123
|
}
|
|
125
124
|
else {
|
|
126
125
|
const name = children.shift().getFirstToken().getStr();
|
|
127
|
-
let found = this.scope.findVariable(name);
|
|
128
|
-
const full = this.scope.findVariable(fullName); // workaround for eg "sy-repid"
|
|
126
|
+
let found = this.input.scope.findVariable(name);
|
|
127
|
+
const full = this.input.scope.findVariable(fullName); // workaround for eg "sy-repid"
|
|
129
128
|
if (full) {
|
|
130
129
|
children = [];
|
|
131
130
|
found = full;
|
|
132
131
|
}
|
|
133
132
|
type = found === null || found === void 0 ? void 0 : found.getType();
|
|
134
133
|
if (found === undefined) {
|
|
135
|
-
found = this.scope.findExtraLikeType(name);
|
|
134
|
+
found = this.input.scope.findExtraLikeType(name);
|
|
136
135
|
type = found === null || found === void 0 ? void 0 : found.getType();
|
|
137
136
|
}
|
|
138
137
|
if (found) {
|
|
139
|
-
this.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
138
|
+
this.input.scope.addReference(chain === null || chain === void 0 ? void 0 : chain.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
140
139
|
}
|
|
141
140
|
if (type === undefined) {
|
|
142
|
-
type = (_a = this.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;
|
|
141
|
+
type = (_a = this.input.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;
|
|
143
142
|
}
|
|
144
|
-
if (type === undefined && this.scope.isOO() === false && this.scope.getDDIC().inErrorNamespace(name) === false) {
|
|
145
|
-
this.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);
|
|
143
|
+
if (type === undefined && this.input.scope.isOO() === false && this.input.scope.getDDIC().inErrorNamespace(name) === false) {
|
|
144
|
+
this.input.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.input.filename);
|
|
146
145
|
return new Types.VoidType(name);
|
|
147
146
|
}
|
|
148
147
|
while (children.length > 0) {
|
|
@@ -211,36 +210,36 @@ class BasicTypes {
|
|
|
211
210
|
return this.cloneType(chain, qualifiedName);
|
|
212
211
|
}
|
|
213
212
|
const chainText = typeName.concatTokens().toUpperCase();
|
|
214
|
-
const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);
|
|
213
|
+
const f = this.input.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);
|
|
215
214
|
if (f !== undefined) {
|
|
216
215
|
return f;
|
|
217
216
|
}
|
|
218
|
-
const typ = this.scope.findType(chainText);
|
|
217
|
+
const typ = this.input.scope.findType(chainText);
|
|
219
218
|
if (typ) {
|
|
220
219
|
const token = typeName.getFirstToken();
|
|
221
220
|
if (chainText.includes("~")) {
|
|
222
221
|
const name = chainText.split("~")[0];
|
|
223
|
-
const idef = this.scope.findInterfaceDefinition(name);
|
|
222
|
+
const idef = this.input.scope.findInterfaceDefinition(name);
|
|
224
223
|
if (idef) {
|
|
225
|
-
this.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: "INTF", ooName: name });
|
|
224
|
+
this.input.scope.addReference(token, idef, _reference_1.ReferenceType.ObjectOrientedReference, this.input.filename, { ooType: "INTF", ooName: name });
|
|
226
225
|
}
|
|
227
226
|
}
|
|
228
|
-
this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
227
|
+
this.input.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
229
228
|
return typ.getType();
|
|
230
229
|
}
|
|
231
|
-
const type = (_a = this.scope.findTypePoolType(chainText)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
230
|
+
const type = (_a = this.input.scope.findTypePoolType(chainText)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
232
231
|
if (type) {
|
|
233
232
|
// this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);
|
|
234
233
|
return type;
|
|
235
234
|
}
|
|
236
|
-
const ddic = this.scope.getDDIC().lookup(chainText);
|
|
235
|
+
const ddic = this.input.scope.getDDIC().lookup(chainText);
|
|
237
236
|
if (ddic) {
|
|
238
|
-
this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });
|
|
237
|
+
this.input.scope.getDDICReferences().addUsing(this.input.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.input.filename });
|
|
239
238
|
if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {
|
|
240
|
-
this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
239
|
+
this.input.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
241
240
|
}
|
|
242
241
|
else if (ddic.type instanceof basic_1.VoidType) {
|
|
243
|
-
this.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);
|
|
242
|
+
this.input.scope.addReference(typeName.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.input.filename);
|
|
244
243
|
}
|
|
245
244
|
return this.cloneType(ddic.type, qualifiedName);
|
|
246
245
|
}
|
|
@@ -260,14 +259,14 @@ class BasicTypes {
|
|
|
260
259
|
}
|
|
261
260
|
let qualifiedName = undefined;
|
|
262
261
|
if (node.get() instanceof Statements.Type) {
|
|
263
|
-
if (this.scope.isTypePool() === true) {
|
|
262
|
+
if (this.input.scope.isTypePool() === true) {
|
|
264
263
|
qualifiedName = name.getStr();
|
|
265
264
|
}
|
|
266
265
|
else {
|
|
267
266
|
qualifiedName = (qualifiedNamePrefix || "") + name.getStr();
|
|
268
|
-
if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition
|
|
269
|
-
|| this.scope.getType() === _scope_type_1.ScopeType.Interface) {
|
|
270
|
-
qualifiedName = this.scope.getName() + "=>" + qualifiedName;
|
|
267
|
+
if (this.input.scope.getType() === _scope_type_1.ScopeType.ClassDefinition
|
|
268
|
+
|| this.input.scope.getType() === _scope_type_1.ScopeType.Interface) {
|
|
269
|
+
qualifiedName = this.input.scope.getName() + "=>" + qualifiedName;
|
|
271
270
|
}
|
|
272
271
|
}
|
|
273
272
|
}
|
|
@@ -276,7 +275,7 @@ class BasicTypes {
|
|
|
276
275
|
}
|
|
277
276
|
const found = this.parseType(node, qualifiedName);
|
|
278
277
|
if (found) {
|
|
279
|
-
return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);
|
|
278
|
+
return new _typed_identifier_1.TypedIdentifier(name, this.input.filename, found);
|
|
280
279
|
}
|
|
281
280
|
return undefined;
|
|
282
281
|
}
|
|
@@ -420,11 +419,11 @@ class BasicTypes {
|
|
|
420
419
|
else if (typename && (text.startsWith("TYPE TABLE FOR CREATE ")
|
|
421
420
|
|| text.startsWith("TYPE TABLE FOR UPDATE "))) {
|
|
422
421
|
const name = typename.concatTokens();
|
|
423
|
-
const type = (_d = this.scope.getDDIC().lookupDDLS(name)) === null || _d === void 0 ? void 0 : _d.type;
|
|
422
|
+
const type = (_d = this.input.scope.getDDIC().lookupDDLS(name)) === null || _d === void 0 ? void 0 : _d.type;
|
|
424
423
|
if (type) {
|
|
425
424
|
return new Types.TableType(new basic_1.VoidType("RapTodo"), options);
|
|
426
425
|
}
|
|
427
|
-
else if (this.scope.getDDIC().inErrorNamespace(name)) {
|
|
426
|
+
else if (this.input.scope.getDDIC().inErrorNamespace(name)) {
|
|
428
427
|
return new Types.UnknownType(`DDLS ${name} not found`);
|
|
429
428
|
}
|
|
430
429
|
else {
|
|
@@ -589,9 +588,9 @@ class BasicTypes {
|
|
|
589
588
|
const chainText = expr.concatTokens().toUpperCase();
|
|
590
589
|
if (chainText.includes("-")) {
|
|
591
590
|
// workaround for stuff like "sy-repid"
|
|
592
|
-
const built = this.scope.findType(chainText);
|
|
591
|
+
const built = this.input.scope.findType(chainText);
|
|
593
592
|
if (built) {
|
|
594
|
-
this.scope.addReference(expr.getFirstToken(), built, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
593
|
+
this.input.scope.addReference(expr.getFirstToken(), built, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
595
594
|
return built.getType();
|
|
596
595
|
}
|
|
597
596
|
}
|
|
@@ -616,50 +615,50 @@ class BasicTypes {
|
|
|
616
615
|
const split = chainText.split("=>");
|
|
617
616
|
const className = split[0];
|
|
618
617
|
// the prefix might be itself
|
|
619
|
-
if ((this.scope.getType() === _scope_type_1.ScopeType.Interface
|
|
620
|
-
|| this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)
|
|
621
|
-
&& this.scope.getName().toUpperCase() === className.toUpperCase()) {
|
|
622
|
-
const foundId = this.scope.findType(subs[0]);
|
|
618
|
+
if ((this.input.scope.getType() === _scope_type_1.ScopeType.Interface
|
|
619
|
+
|| this.input.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)
|
|
620
|
+
&& this.input.scope.getName().toUpperCase() === className.toUpperCase()) {
|
|
621
|
+
const foundId = this.input.scope.findType(subs[0]);
|
|
623
622
|
foundType = foundId === null || foundId === void 0 ? void 0 : foundId.getType();
|
|
624
623
|
if (foundType === undefined) {
|
|
625
624
|
return new Types.UnknownType("Could not resolve type " + chainText);
|
|
626
625
|
}
|
|
627
626
|
const token = (_a = expr.getChildren()[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
628
627
|
if (token) {
|
|
629
|
-
this.scope.addReference(token, foundId, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
628
|
+
this.input.scope.addReference(token, foundId, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
630
629
|
}
|
|
631
630
|
}
|
|
632
631
|
else {
|
|
633
632
|
// lookup in local and global scope
|
|
634
|
-
const obj = this.scope.findObjectDefinition(className);
|
|
635
|
-
if (obj === undefined && this.scope.getDDIC().inErrorNamespace(className) === false) {
|
|
636
|
-
this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: className.toUpperCase() });
|
|
633
|
+
const obj = this.input.scope.findObjectDefinition(className);
|
|
634
|
+
if (obj === undefined && this.input.scope.getDDIC().inErrorNamespace(className) === false) {
|
|
635
|
+
this.input.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.input.filename, { ooName: className.toUpperCase() });
|
|
637
636
|
return new Types.VoidType(className);
|
|
638
637
|
}
|
|
639
638
|
else if (obj === undefined) {
|
|
640
639
|
return new Types.UnknownType("Could not resolve top " + className + ", resolveTypeChain");
|
|
641
640
|
}
|
|
642
641
|
const type = obj instanceof types_1.ClassDefinition ? "CLAS" : "INTF";
|
|
643
|
-
this.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: className });
|
|
644
|
-
const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(obj, subs[0]);
|
|
642
|
+
this.input.scope.addReference(expr.getFirstToken(), obj, _reference_1.ReferenceType.ObjectOrientedReference, this.input.filename, { ooType: type, ooName: className });
|
|
643
|
+
const byName = new _object_oriented_1.ObjectOriented(this.input.scope).searchTypeName(obj, subs[0]);
|
|
645
644
|
foundType = byName === null || byName === void 0 ? void 0 : byName.getType();
|
|
646
645
|
if (byName === undefined || foundType === undefined) {
|
|
647
646
|
return new Types.UnknownType(subs[0] + " not found in class or interface");
|
|
648
647
|
}
|
|
649
648
|
const token = (_b = expr.getChildren()[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
650
649
|
if (token) {
|
|
651
|
-
this.scope.addReference(token, byName, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
650
|
+
this.input.scope.addReference(token, byName, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
652
651
|
}
|
|
653
652
|
}
|
|
654
653
|
}
|
|
655
654
|
else if (className && chainText.includes("->")) {
|
|
656
|
-
const varVar = this.scope.findVariable(className);
|
|
655
|
+
const varVar = this.input.scope.findVariable(className);
|
|
657
656
|
const foo = varVar === null || varVar === void 0 ? void 0 : varVar.getType();
|
|
658
657
|
if (foo instanceof basic_1.ObjectReferenceType) {
|
|
659
658
|
const typeName = subs[0];
|
|
660
659
|
let id = foo.getIdentifier();
|
|
661
660
|
if (!(id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition)) {
|
|
662
|
-
const found = this.scope.findObjectDefinition(foo.getIdentifierName());
|
|
661
|
+
const found = this.input.scope.findObjectDefinition(foo.getIdentifierName());
|
|
663
662
|
if (found) {
|
|
664
663
|
id = found;
|
|
665
664
|
}
|
|
@@ -669,15 +668,15 @@ class BasicTypes {
|
|
|
669
668
|
}
|
|
670
669
|
if (id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition) {
|
|
671
670
|
const type = id instanceof types_1.ClassDefinition ? "CLAS" : "INTF";
|
|
672
|
-
this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });
|
|
673
|
-
const byName = new _object_oriented_1.ObjectOriented(this.scope).searchTypeName(id, typeName);
|
|
671
|
+
this.input.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.input.filename, { ooType: type, ooName: id.getName() });
|
|
672
|
+
const byName = new _object_oriented_1.ObjectOriented(this.input.scope).searchTypeName(id, typeName);
|
|
674
673
|
foundType = byName === null || byName === void 0 ? void 0 : byName.getType();
|
|
675
674
|
if (byName === undefined || foundType === undefined) {
|
|
676
675
|
return new Types.UnknownType(typeName + " not found in class or interface");
|
|
677
676
|
}
|
|
678
677
|
const token = (_c = expr.getChildren()[2]) === null || _c === void 0 ? void 0 : _c.getFirstToken();
|
|
679
678
|
if (token) {
|
|
680
|
-
this.scope.addReference(token, byName, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
679
|
+
this.input.scope.addReference(token, byName, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
681
680
|
}
|
|
682
681
|
}
|
|
683
682
|
else {
|
|
@@ -692,17 +691,17 @@ class BasicTypes {
|
|
|
692
691
|
}
|
|
693
692
|
}
|
|
694
693
|
else {
|
|
695
|
-
const found = this.scope.findType(subs[0]);
|
|
694
|
+
const found = this.input.scope.findType(subs[0]);
|
|
696
695
|
foundType = found === null || found === void 0 ? void 0 : found.getType();
|
|
697
696
|
if (foundType === undefined) {
|
|
698
|
-
const typePoolType = (_d = this.scope.findTypePoolType(subs[0])) === null || _d === void 0 ? void 0 : _d.getType();
|
|
697
|
+
const typePoolType = (_d = this.input.scope.findTypePoolType(subs[0])) === null || _d === void 0 ? void 0 : _d.getType();
|
|
699
698
|
if (typePoolType) {
|
|
700
699
|
// this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);
|
|
701
700
|
foundType = typePoolType;
|
|
702
701
|
}
|
|
703
702
|
if (foundType === undefined) {
|
|
704
|
-
const f = this.scope.getDDIC().lookupTableOrView(subs[0]);
|
|
705
|
-
this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object, filename: this.filename, token: expr.getFirstToken() });
|
|
703
|
+
const f = this.input.scope.getDDIC().lookupTableOrView(subs[0]);
|
|
704
|
+
this.input.scope.getDDICReferences().addUsing(this.input.scope.getParentObj(), { object: f.object, filename: this.input.filename, token: expr.getFirstToken() });
|
|
706
705
|
if (f.type instanceof _typed_identifier_1.TypedIdentifier) {
|
|
707
706
|
foundType = f.type.getType();
|
|
708
707
|
}
|
|
@@ -712,14 +711,14 @@ class BasicTypes {
|
|
|
712
711
|
}
|
|
713
712
|
}
|
|
714
713
|
else {
|
|
715
|
-
this.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
714
|
+
this.input.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
716
715
|
}
|
|
717
|
-
if (foundType === undefined && this.scope.getDDIC().inErrorNamespace(subs[0]) === false) {
|
|
718
|
-
this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);
|
|
716
|
+
if (foundType === undefined && this.input.scope.getDDIC().inErrorNamespace(subs[0]) === false) {
|
|
717
|
+
this.input.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.input.filename);
|
|
719
718
|
return new Types.VoidType(subs[0]);
|
|
720
719
|
}
|
|
721
720
|
else if (foundType instanceof Types.VoidType) {
|
|
722
|
-
this.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.filename);
|
|
721
|
+
this.input.scope.addReference(expr.getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.input.filename);
|
|
723
722
|
return foundType;
|
|
724
723
|
}
|
|
725
724
|
else if (foundType === undefined) {
|
|
@@ -753,52 +752,52 @@ class BasicTypes {
|
|
|
753
752
|
const firstToken = firstNode.getFirstToken();
|
|
754
753
|
const firstName = firstToken.getStr();
|
|
755
754
|
if (firstNode.get() instanceof Expressions.Field) {
|
|
756
|
-
const found = this.scope.findVariable(firstName);
|
|
755
|
+
const found = this.input.scope.findVariable(firstName);
|
|
757
756
|
const val = found === null || found === void 0 ? void 0 : found.getValue();
|
|
758
757
|
if (typeof val === "string") {
|
|
759
|
-
this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);
|
|
758
|
+
this.input.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
760
759
|
return val;
|
|
761
760
|
}
|
|
762
761
|
else if ((found === null || found === void 0 ? void 0 : found.getType()) instanceof basic_1.StructureType) {
|
|
763
|
-
this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);
|
|
762
|
+
this.input.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
764
763
|
}
|
|
765
764
|
return undefined;
|
|
766
765
|
}
|
|
767
766
|
else if (firstNode.get() instanceof Expressions.ClassName
|
|
768
|
-
&& firstName.toLowerCase() === this.scope.getName().toLowerCase()
|
|
769
|
-
&& (this.scope.getType() === _scope_type_1.ScopeType.Interface
|
|
770
|
-
|| this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {
|
|
767
|
+
&& firstName.toLowerCase() === this.input.scope.getName().toLowerCase()
|
|
768
|
+
&& (this.input.scope.getType() === _scope_type_1.ScopeType.Interface
|
|
769
|
+
|| this.input.scope.getType() === _scope_type_1.ScopeType.ClassDefinition)) {
|
|
771
770
|
const children = expr.getChildren();
|
|
772
771
|
const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
773
|
-
const found = this.scope.findVariable(token.getStr());
|
|
772
|
+
const found = this.input.scope.findVariable(token.getStr());
|
|
774
773
|
const val = found === null || found === void 0 ? void 0 : found.getValue();
|
|
775
774
|
if (typeof val === "string") {
|
|
776
|
-
this.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.filename);
|
|
775
|
+
this.input.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
777
776
|
return val;
|
|
778
777
|
}
|
|
779
778
|
return undefined;
|
|
780
779
|
}
|
|
781
780
|
else if (firstNode.get() instanceof Expressions.ClassName) {
|
|
782
|
-
const obj = this.scope.findObjectDefinition(firstName);
|
|
781
|
+
const obj = this.input.scope.findObjectDefinition(firstName);
|
|
783
782
|
if (obj === undefined) {
|
|
784
|
-
if (this.scope.existsObject(firstName) !== undefined) {
|
|
783
|
+
if (this.input.scope.existsObject(firstName) !== undefined) {
|
|
785
784
|
return undefined;
|
|
786
785
|
}
|
|
787
|
-
else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {
|
|
786
|
+
else if (this.input.scope.getDDIC().inErrorNamespace(firstName) === true) {
|
|
788
787
|
throw new Error("resolveConstantValue, not found: " + firstName);
|
|
789
788
|
}
|
|
790
789
|
else {
|
|
791
|
-
this.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.filename, { ooName: firstName.toUpperCase() });
|
|
790
|
+
this.input.scope.addReference(firstNode.getFirstToken(), undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, this.input.filename, { ooName: firstName.toUpperCase() });
|
|
792
791
|
return undefined;
|
|
793
792
|
}
|
|
794
793
|
}
|
|
795
794
|
const children = expr.getChildren();
|
|
796
795
|
const token = (_b = children[2]) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
797
796
|
const attr = token.getStr();
|
|
798
|
-
const c = new _object_oriented_1.ObjectOriented(this.scope).searchConstantName(obj, attr);
|
|
797
|
+
const c = new _object_oriented_1.ObjectOriented(this.input.scope).searchConstantName(obj, attr);
|
|
799
798
|
if (c instanceof class_constant_1.ClassConstant) {
|
|
800
|
-
this.scope.addReference(firstToken, obj, _reference_1.ReferenceType.ObjectOrientedReference, this.filename);
|
|
801
|
-
this.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.filename);
|
|
799
|
+
this.input.scope.addReference(firstToken, obj, _reference_1.ReferenceType.ObjectOrientedReference, this.input.filename);
|
|
800
|
+
this.input.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
802
801
|
const val = c.getValue();
|
|
803
802
|
if (typeof val === "string") {
|
|
804
803
|
return val;
|
|
@@ -827,9 +826,9 @@ class BasicTypes {
|
|
|
827
826
|
if (name.toUpperCase() === "OBJECT") {
|
|
828
827
|
return new Types.GenericObjectReferenceType();
|
|
829
828
|
}
|
|
830
|
-
const search = this.scope.existsObject(name);
|
|
829
|
+
const search = this.input.scope.existsObject(name);
|
|
831
830
|
if (search === null || search === void 0 ? void 0 : search.id) {
|
|
832
|
-
this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });
|
|
831
|
+
this.input.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.input.filename, { ooType: search.ooType, ooName: name });
|
|
833
832
|
return new Types.ObjectReferenceType(search.id, { qualifiedName: name, RTTIName: search.RTTIName });
|
|
834
833
|
}
|
|
835
834
|
}
|
|
@@ -840,10 +839,10 @@ class BasicTypes {
|
|
|
840
839
|
else if (chain.concatTokens().toUpperCase() === "DATA") {
|
|
841
840
|
return new Types.DataReference(new Types.DataType());
|
|
842
841
|
}
|
|
843
|
-
if (this.scope.isBadiDef(name) === true) {
|
|
842
|
+
if (this.input.scope.isBadiDef(name) === true) {
|
|
844
843
|
return new Types.VoidType(name);
|
|
845
844
|
}
|
|
846
|
-
if (((_a = this.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {
|
|
845
|
+
if (((_a = this.input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.inErrorNamespace(name)) === false) {
|
|
847
846
|
// this.scope.addReference(chain.getFirstToken(), undefined, ReferenceType.VoidType, this.filename);
|
|
848
847
|
return new Types.VoidType(name);
|
|
849
848
|
}
|
|
@@ -5,35 +5,42 @@ const void_type_1 = require("../../types/basic/void_type");
|
|
|
5
5
|
const object_reference_type_1 = require("../../types/basic/object_reference_type");
|
|
6
6
|
const _object_oriented_1 = require("../_object_oriented");
|
|
7
7
|
const expressions_1 = require("../../2_statements/expressions");
|
|
8
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
8
9
|
class AttributeChain {
|
|
9
|
-
runSyntax(inputContext, node,
|
|
10
|
+
runSyntax(inputContext, node, input, type) {
|
|
10
11
|
if (inputContext instanceof void_type_1.VoidType) {
|
|
11
12
|
return inputContext;
|
|
12
13
|
}
|
|
13
14
|
else if (!(inputContext instanceof object_reference_type_1.ObjectReferenceType)) {
|
|
14
|
-
|
|
15
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), "Not an object reference(AttributeChain)"));
|
|
16
|
+
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
15
17
|
}
|
|
16
18
|
const children = node.getChildren().slice();
|
|
17
19
|
const first = children[0];
|
|
18
20
|
if (!(first.get() instanceof expressions_1.AttributeName)) {
|
|
19
|
-
|
|
21
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), "AttributeChain, unexpected first child"));
|
|
22
|
+
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
20
23
|
}
|
|
21
|
-
const def = scope.findObjectDefinition(inputContext.getIdentifierName());
|
|
24
|
+
const def = input.scope.findObjectDefinition(inputContext.getIdentifierName());
|
|
22
25
|
if (def === undefined) {
|
|
23
|
-
|
|
26
|
+
const message = "Definition for \"" + inputContext.getIdentifierName() + "\" not found in scope(AttributeChain)";
|
|
27
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
28
|
+
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
24
29
|
}
|
|
25
30
|
const nameToken = first.getFirstToken();
|
|
26
31
|
const name = nameToken.getStr();
|
|
27
|
-
const helper = new _object_oriented_1.ObjectOriented(scope);
|
|
32
|
+
const helper = new _object_oriented_1.ObjectOriented(input.scope);
|
|
28
33
|
let context = helper.searchAttributeName(def, name);
|
|
29
34
|
if (context === undefined) {
|
|
30
35
|
context = helper.searchConstantName(def, name);
|
|
31
36
|
}
|
|
32
37
|
if (context === undefined) {
|
|
33
|
-
|
|
38
|
+
const message = "Attribute or constant \"" + name + "\" not found in \"" + def.getName() + "\"";
|
|
39
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, message));
|
|
40
|
+
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
34
41
|
}
|
|
35
42
|
for (const t of type) {
|
|
36
|
-
scope.addReference(nameToken, context, t, filename);
|
|
43
|
+
input.scope.addReference(nameToken, context, t, input.filename);
|
|
37
44
|
}
|
|
38
45
|
// todo, loop, handle ArrowOrDash, ComponentName, TableExpression
|
|
39
46
|
return context.getType();
|