mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-09-20 04:24:45 +00:00
Fixed support for subs and functions with "." in name (#83)
This commit is contained in:
parent
1aa1ee17a6
commit
1275713122
2 changed files with 11 additions and 6 deletions
4
qb2js.js
4
qb2js.js
|
@ -2879,7 +2879,9 @@ var MethodJS = null;
|
|||
var ___v5833590 = 0; for ( i= 1; i <= (QB.func_Len( m.name)); i= i + 1) { if (QB.halted()) { return; } ___v5833590++; if (___v5833590 % 100 == 0) { await QB.autoLimit(); }
|
||||
c = (QB.func_Mid( m.name, i, 1));
|
||||
a = (QB.func_Asc( c));
|
||||
if (( a >= 65 && a <= 90) || ( a >= 97 && a <= 122) || ( a >= 48 && a <= 57) || a == 95 || a == 46) {
|
||||
if ( a == 46) {
|
||||
jsname = jsname + "_";
|
||||
} else if (( a >= 65 && a <= 90) || ( a >= 97 && a <= 122) || ( a >= 48 && a <= 57) || a == 95) {
|
||||
jsname = jsname + c;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1386,7 +1386,6 @@ Function ConvertInput$ (m As Method, args As String, lineNumber As Integer)
|
|||
js = "var " + vname + " = new Array(" + Str$(UBound(vars)) + "); "
|
||||
js = js + CallMethod(m) + "(" + vname + ", " + preventNewline + ", " + addQuestionPrompt + ", " + prompt + "); "
|
||||
For i = 1 To UBound(vars)
|
||||
'If Not StartsWith(_Trim$(vars(i)), "#") Then ' special case to prevent file references from being output during self-compilation
|
||||
' Convert to appropriate variable type on assignment
|
||||
Dim vartype As String
|
||||
vartype = GetVarType(vars(i))
|
||||
|
@ -3080,10 +3079,14 @@ Function MethodJS$ (m As Method, prefix As String)
|
|||
For i = 1 To Len(m.name)
|
||||
c = Mid$(m.name, i, 1)
|
||||
a = Asc(c)
|
||||
' uppercase, lowercase, numbers, - and .
|
||||
If (a >= 65 And a <= 90) Or (a >= 97 And a <= 122) Or _
|
||||
(a >= 48 And a <= 57) Or _
|
||||
a = 95 Or a = 46 Then
|
||||
|
||||
If a = 46 Then
|
||||
' replace period with underscore
|
||||
jsname = jsname + "_"
|
||||
|
||||
ElseIf (a >= 65 And a <= 90) Or (a >= 97 And a <= 122) Or _
|
||||
(a >= 48 And a <= 57) Or a = 95 Then
|
||||
' uppercase, lowercase, numbers, and -
|
||||
jsname = jsname + c
|
||||
End If
|
||||
Next i
|
||||
|
|
Loading…
Reference in a new issue