mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 10:03:56 +01:00
fix: a {.command.} resulting in an empty string could actually produce a false error
This commit is contained in:
parent
ad439fa65f
commit
62c30c8de1
@ -161,16 +161,18 @@ var
|
|||||||
procedure deprecatedMacro(what:string=''; instead:string='');
|
procedure deprecatedMacro(what:string=''; instead:string='');
|
||||||
begin mainfrm.add2log('WARNING, deprecated macro: '+first(what, name)+nonEmptyConcat(' - Use instead: ',instead), NIL, clRed) end;
|
begin mainfrm.add2log('WARNING, deprecated macro: '+first(what, name)+nonEmptyConcat(' - Use instead: ',instead), NIL, clRed) end;
|
||||||
|
|
||||||
|
procedure unsatisfied(b:boolean=TRUE);
|
||||||
|
begin
|
||||||
|
if b then
|
||||||
|
macroError('cannot be used here')
|
||||||
|
end;
|
||||||
|
|
||||||
function satisfied(p:pointer):boolean;
|
function satisfied(p:pointer):boolean;
|
||||||
begin
|
begin
|
||||||
result:=assigned(p);
|
result:=assigned(p);
|
||||||
if not result then
|
unsatisfied(not result);
|
||||||
macroError('cannot be used here');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure unsatisfied(b:boolean=TRUE);
|
|
||||||
begin if b then macroError('cannot be used here') end;
|
|
||||||
|
|
||||||
function parEx(idx:integer; name:string=''; doTrim:boolean=TRUE):string; overload;
|
function parEx(idx:integer; name:string=''; doTrim:boolean=TRUE):string; overload;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
@ -262,9 +264,9 @@ var
|
|||||||
result:=staticVars;
|
result:=staticVars;
|
||||||
delete(varname,1,length(G_VAR_PREFIX));
|
delete(varname,1,length(G_VAR_PREFIX));
|
||||||
end
|
end
|
||||||
else if satisfied(md.cd) then
|
else if assigned(md.cd) then
|
||||||
result:=md.cd.vars
|
result:=md.cd.vars
|
||||||
else if satisfied(md.tempVars) then
|
else if assigned(md.tempVars) then
|
||||||
result:=md.tempVars
|
result:=md.tempVars
|
||||||
else
|
else
|
||||||
raise Exception.create('no namespace available');
|
raise Exception.create('no namespace available');
|
||||||
@ -293,7 +295,7 @@ var
|
|||||||
if not satisfied(space) then exit;
|
if not satisfied(space) then exit;
|
||||||
i:=space.indexOfName(varname);
|
i:=space.indexOfName(varname);
|
||||||
if i < 0 then
|
if i < 0 then
|
||||||
if value = '' then exit // all is good the way it is
|
if value = '' then exit(TRUE) // all is good the way it is
|
||||||
else i:=space.add(varname+'='+value)
|
else i:=space.add(varname+'='+value)
|
||||||
else
|
else
|
||||||
if value > '' then // in case of empty value, there's no need to assign, because we are going to delete it (after we cleared the bound object)
|
if value > '' then // in case of empty value, there's no need to assign, because we are going to delete it (after we cleared the bound object)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user