Skip to content

Commit a73a915

Browse files
committed
The GETS function now support list arguments.
1 parent bc6441e commit a73a915

File tree

3 files changed

+23
-27
lines changed

3 files changed

+23
-27
lines changed

src/LO Basic/VBAExpressionsLib/VBAexpressions.xba

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4954,13 +4954,21 @@ Private Function GETS(ByRef expression As String, ByRef fName As String) As Stri
49544954
UB = UBound(tmpData)
49554955
argsCount = UB - LB + 1
49564956
Select Case argsCount
4957-
Case 2
4958-
tmpEval = tmpData(UB)
4959-
P_SCOPE.LetVarValue(FormatLiteralString(tmpData(LB), True), tmpData(UB))
49604957
Case 1
49614958
Dim varName As String
49624959
varName = FormatLiteralString(tmpData(LB), True)
49634960
tmpEval = P_SCOPE.GetVarValue(varName)
4961+
Case 2
4962+
tmpEval = tmpData(UB)
4963+
P_SCOPE.LetVarValue(FormatLiteralString(tmpData(LB), True), tmpData(UB))
4964+
Case Is > 2 'List of elements
4965+
Dim i As Long
4966+
4967+
tmpEval = tmpData(LB + 1)
4968+
For i = LB + 2 To UB
4969+
tmpEval = tmpEval & P_SEPARATORCHAR & tmpData(i)
4970+
Next i
4971+
P_SCOPE.LetVarValue(FormatLiteralString(tmpData(LB), True), tmpEval)
49644972
Case Else
49654973
tmpEval = e_ValueError
49664974
BuildErrMessage errMissingArgsOrTooManyArgs, d_lCurly & fName & d_rCurly

src/LO Basic/VBAExpressionsLib/VBAexpressionsScope.xba

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,13 @@ Public Function CopyToScope() As Object
335335
Dim i As Long
336336
Dim tmpValue As String
337337
Dim tmpName As String
338-
Dim tmpScope As Object
339-
Dim ConstKey As String
338+
Dim tmpScope As VBAexpressionsScope
340339

341340
Set tmpScope = New VBAexpressionsScope
342341
For i = 0 To P_EXPR_VARIABLES.aindex
343342
tmpName = P_EXPR_VARIABLES.Storage(i).aName
344343
tmpValue = P_EXPR_VARIABLES.Storage(i).value
345344
If tmpValue <> vbNullString Then
346-
tmpScope.AddVariable(tmpName, ConstKey)
347345
tmpScope.LetVarValue(tmpName, tmpValue)
348346
End If
349347
Next
@@ -359,24 +357,6 @@ Private Sub ExpandCBbuffer(ByRef aBuffer As ClusterBuffer)
359357
aBuffer.Storage = tmpBuffer
360358
End Sub
361359

362-
Public Sub ExtendScope(ByRef sourceScope As Object)
363-
Dim i As Long
364-
Dim tmpVar() As String
365-
Dim varLB As Long
366-
Dim cKey As String
367-
Dim cValue As String
368-
369-
With sourceScope
370-
tmpVar() = Split(.CurrentVariables, "; ")
371-
varLB = LBound(tmpVar)
372-
For i=VarLB To UBound(tmpVar)
373-
AddVariable tmpVar(i), cKey
374-
cValue = .GetVarValue(tmpVar(i))
375-
LetVarValue tmpVar(i), cValue
376-
Next i
377-
End With
378-
End Sub
379-
380360
Public Sub FillPredefinedVars()
381361
Dim i As Long
382362
Dim tmpIdx As Long

src/VBAexpressions.cls

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4994,13 +4994,21 @@ Private Function GETS(ByRef expression As String, ByRef fName As String) As Stri
49944994
UB = UBound(tmpData)
49954995
argsCount = UB - LB + 1
49964996
Select Case argsCount
4997-
Case 2
4998-
tmpEval = tmpData(UB)
4999-
P_SCOPE.VarValue(FormatLiteralString(tmpData(LB), True)) = tmpData(UB)
50004997
Case 1
50014998
Dim varName As String
50024999
varName = FormatLiteralString(tmpData(LB), True)
50035000
tmpEval = P_SCOPE.VarValue(varName)
5001+
Case 2
5002+
tmpEval = tmpData(UB)
5003+
P_SCOPE.VarValue(FormatLiteralString(tmpData(LB), True)) = tmpData(UB)
5004+
Case Is > 2 'List of elements
5005+
Dim i As Long
5006+
5007+
tmpEval = tmpData(LB + 1)
5008+
For i = LB + 2 To UB
5009+
tmpEval = tmpEval & P_SEPARATORCHAR & tmpData(i)
5010+
Next i
5011+
P_SCOPE.VarValue(FormatLiteralString(tmpData(LB), True)) = tmpEval
50045012
Case Else
50055013
tmpEval = e_ValueError
50065014
BuildErrMessage errMissingArgsOrTooManyArgs, d_lCurly & fName & d_rCurly

0 commit comments

Comments
 (0)