Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTTI fixes #414

Merged
merged 3 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
},
"license": "MIT",
"dependencies": {
"@abaplint/cli": "^2.91.28",
"@abaplint/runtime": "^2.1.33",
"@abaplint/cli": "^2.91.29",
"@abaplint/runtime": "^2.1.34",
"@abaplint/database-sqlite": "^2.1.29",
"@abaplint/transpiler-cli": "^2.1.33"
"@abaplint/transpiler-cli": "^2.1.34"
}
}
18 changes: 18 additions & 0 deletions src/rtti/cl_abap_intfdescr.clas.testclasses.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CLASS ltcl_test DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.

PRIVATE SECTION.
METHODS test FOR TESTING RAISING cx_static_check.

ENDCLASS.

CLASS ltcl_test IMPLEMENTATION.

METHOD test.
DATA descr TYPE REF TO cl_abap_typedescr.
descr = cl_abap_typedescr=>describe_by_name( 'IF_MESSAGE' ).
cl_abap_unit_assert=>assert_equals(
act = descr->kind
exp = cl_abap_typedescr=>kind_intf ).
ENDMETHOD.

ENDCLASS.
20 changes: 18 additions & 2 deletions src/rtti/cl_abap_typedescr.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ CLASS cl_abap_typedescr DEFINITION PUBLIC.
CONSTANTS typekind_any TYPE abap_typekind VALUE '~'.
CONSTANTS typekind_char TYPE abap_typekind VALUE 'C'.
CONSTANTS typekind_class TYPE abap_typekind VALUE '*'.
CONSTANTS typekind_intf TYPE abap_typekind VALUE '+'.
CONSTANTS typekind_clike TYPE abap_typekind VALUE '&'.
CONSTANTS typekind_csequence TYPE abap_typekind VALUE '?'.
CONSTANTS typekind_date TYPE abap_typekind VALUE 'D'.
Expand Down Expand Up @@ -78,8 +79,23 @@ CLASS cl_abap_typedescr IMPLEMENTATION.

METHOD describe_by_name.
DATA ref TYPE REF TO data.
CREATE DATA ref TYPE (p_name).
type = describe_by_data_ref( ref ).
DATA oo_type TYPE string.

WRITE '@KERNEL oo_type.set(abap.Classes[p_name.get().toUpperCase()]?.INTERNAL_TYPE || "");'.

CASE oo_type.
WHEN 'INTF'.
CREATE OBJECT type TYPE cl_abap_intfdescr.
type->type_kind = typekind_intf.
type->kind = kind_intf.
WHEN 'CLAS'.
CREATE OBJECT type TYPE cl_abap_classdescr.
type->type_kind = typekind_class.
type->kind = kind_class.
WHEN OTHERS.
CREATE DATA ref TYPE (p_name).
type = describe_by_data_ref( ref ).
ENDCASE.
ENDMETHOD.

METHOD get_relative_name.
Expand Down