tdf#123263 Type checking SbiSymDef and Array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just for Information
I'm now tackling on

tdf#123263
https://gerrit.libreoffice.org/#/c/67585/

and I'm now stuck.

I want to sort out my idea, share my headaches :-) , and solicit advice.
=======================
1. In StarBasic, assignment is done in SbiRuntime::StepPUT, but StarBasic only type-checks with checkUnoStructCopy.(see the URL below)

2. Some functions like Split( defined in SbRtl_Split in C++), requires data that can be converted to string type. A call of GetString ,which internally calls SbxValue::Get(SbxValues rRes), does this.

3. Even when type of left variable and right expression in assignment are not of the same type, sometimes it's preferable to implicitly convert to the type of lvalue, and I believe SbxValue::Get(SbxValues rRes) would be help.

4. With these in mind, I wrote

https://gerrit.libreoffice.org/#/c/67585/14/basic/source/runtime/runtime.cxx

refVar is for the left variable and refVal is for right value.
IsFixed() is for Variable type.

5. This did not solve the issue. I printf-ed with SAL_INFO the types of refVar and refVal (SbxDataType) static_cast-ed to int, while running the code in the bug report. Result indicated SbxSTRING and SbxINTEGER with no SbxARRAY information.

6. I decided on finding where these type data is taken from.
And, I found out that on parsing, identifiers are managed with SbiSymDef, and parenthesis for arrays are handled separatly in SbiParser::VarDecl

https://gerrit.libreoffice.org/#/c/67585/14/basic/source/comp/dim.cxx

Variable declarations of array type in StarBasic is as follows:

Dim x() As Integer

'As Integer' part is handled in SbiParser::TypeDecl, which calls SbiSymDef::SetType, but parethesis is handled before that in VarDecl. To carry over this information, I added the third optional parameter to TypeDecl.

7. And by doing these, the code in the bug report seemed to work, and I submitted the patch to gerrit.Unfortunately that resulted in unit test failures.

8.
Unit test error: Symbol oControlGroup already defined differently.

I searched OpenGrok for the identifier oControlGroup and hit this.
https://opengrok.libreoffice.org/xref/core/wizards/source/tools/ModuleControls.xba?r=da543e4e#131

9. I tried this code on my own local machine with SAL_INFOs, and
understood StarBasic wants the left expression of dot character to be of SbxOBJECT.

https://opengrok.libreoffice.org/xref/core/basic/source/comp/exprtree.cxx?r=e48e0632#158

before my patch, objects can be stored only to variables of type SbxOBJECT or SbxVARIABLE. Sometimes StarBasic tries to SbiSymDef::SetTypes( SbxOBJECT ) thingy, often with interim variables, if the variable is defined as SbxVARIANT. The type of SbiSymDef is used for if statements later.

As suggested by the algorythm above type of SbiSymDef is essential, and I don't want change this.

Also, expressions like the following
Dim x() As Object

x(i).someproperty

x is an of (SbxOBJECT | SbxARRAY) and x(i) is SbxOBJECT but I'm not sure whether I should/can hold x(i) as SbiSymDef
--
himajin100000



_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux