Skip to content

Commit a86ff93

Browse files
authored
feature: absorb the LABEL command (#1965)
1 parent 5de6e37 commit a86ff93

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/Common/FoxProCmd.xh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@
627627
#translate CAST ( <expression> AS <type:W,C,Y,D,T,B,F,G,I,L,M,N,Q,V>(<width> ) ) => __FoxCast(<expression>,<(type)>, <width>,-1)
628628
#translate CAST ( <expression> AS <type:W,C,Y,D,T,B,F,G,I,L,M,N,Q,V>(<width> ,<dec>) ) => __FoxCast(<expression>,<(type)>, <width>,<dec>)
629629

630+
#command LABEL <*any*> => __VfpUnsupported("LABEL")
630631

631-
// unsupported commands
632632
#command CREATE <cmd:CLASS, CLASSLIB, COLOR, CONNECTION, FORM, LABEL, MENU, PROJECT, QUERY, REPORT, SCREEN, STRUCTURE, TRIGGER> <*any*> ;
633633
=> #error This command is not supported: <(udc)>
634634

src/Runtime/XSharp.VFP.Tests/CommandTests.prg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,18 @@ BEGIN NAMESPACE XSharp.VFP.Tests
348348
TRY ; System.IO.Directory.Delete(cTempPath, TRUE) ; CATCH ; END TRY
349349
END TRY
350350
END METHOD
351+
352+
[Fact];
353+
METHOD LabelCommandAbsorbed() AS VOID
354+
// LABEL FORM should compile and run without error (silent no-op)
355+
LABEL FORM "nonexistent.lbx"
356+
LABEL FORM "nonexistent.lbx" FOR .T.
357+
LABEL FORM "nonexistent.lbx" TO FILE "output.txt"
358+
LABEL FORM "nonexistent.lbx" TO PRINTER
359+
LABEL FORM "nonexistent.lbx" PREVIEW NOWAIT
360+
// If we get here without exception, the command is properly absorbed
361+
Assert.True(.T.)
362+
END METHOD
351363
END CLASS
352364

353365
END NAMESPACE

src/Runtime/XSharp.VFP/MiscFunctions.prg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,8 @@ ENDFUNC
237237
FUNCTION IsPen() AS LOGIC
238238
RETURN FALSE
239239
ENDFUNC
240+
241+
/// <exclude/>
242+
FUNCTION __VfpUnsupported(cCommand AS STRING) AS VOID
243+
// Silently absorb all unsupported VFP commands
244+
RETURN

0 commit comments

Comments
 (0)