View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003667 | JEDI VCL | 00 JVCL Components | public | 2006-04-28 08:31 | 2006-05-03 05:30 |
| Reporter | ivan_ra | Assigned To | ivan_ra | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | Daily / GIT | ||||
| Target Version | Fixed in Version | 3.30 | |||
| Summary | 0003667: JvInterpreter: non-standard var params does not works | ||||
| Description | Var params with non-standard param name always returns unassigned. "Standard" param names are names listed in TypeName2VarTyp function. So, form close event not works, because TCloseAction is not listed in TypeName2VarTyp: procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; This procedure always returns Action = unassigned. So, MDIChild window cant close. Look at example. | ||||
| Additional Information | JvInterpreter looses such values in TJvInterpreterVarList.SetValue function, in this espression: JvInterpreterVarAssignment(V.Value, JvInterpreterVarAsType(Value, V.VTyp and not varByRef)); in case when ParamTypeName not listed in TypeName2VarTyp function, after compiling (Compile procedure), paramtype for "Action" is this: V.VTyp = varEmpty or varByRef and JvInterpreterVarAsType(Value, V.VTyp and not varByRef) returns unassigned when Value = caFree (2). I dont know, is this solutoin absolutely right, but this is fix: add in the end of function JvInterpreterVarAsType this strings: else // if (VarType = varEmpty) and not VarIsEmpty(V) then // Result := V // else Result := VarAsType(V, VarType); | ||||
| Tags | No tags attached. | ||||
|
2006-04-28 08:32
|
FormsExample.zip (2,766 bytes) |
|
2006-04-28 08:34
|
JvInterpreter.pas.svn.patch (2,206 bytes)
Index: JvInterpreter.pas
===================================================================
--- JvInterpreter.pas (revision 10546)
+++ JvInterpreter.pas (working copy)
@@ -384,7 +384,7 @@
FDuplicates: TDuplicates;
public
function IndexOf(const UnitName, Identifier: string): TJvInterpreterIdentifier;
- function Find(const Identifier: string; var Index: Integer; const ClassName: string = ''): Boolean;
+ function Find(const Identifier: string; var Index: Integer): Boolean;
procedure Sort(Compare: TListSortCompare = nil); virtual;
property Duplicates: TDuplicates read FDuplicates write FDuplicates;
end;
@@ -2469,6 +2469,9 @@
TVarData(Result).VType := VarType;
end
else
+ if (VarType = varEmpty) and not VarIsEmpty(V) then
+ Result := V
+ else
Result := VarAsType(V, VarType);
end;
end;
@@ -2892,7 +2895,7 @@
//=== { TJvInterpreterIdentifierList } =======================================
function TJvInterpreterIdentifierList.Find(const Identifier: string;
- var Index: Integer; const ClassName: string = ''): Boolean;
+ var Index: Integer): Boolean;
var
L, H, I, C: Integer;
begin
@@ -2917,13 +2920,6 @@
end;
end;
Index := L;
-
- // Mantis 2676: Looking for our specific class, if applicable
- if not Result or (ClassName = '') then
- exit;
- I := Index;
- while (I <= Count - 1) and (AnsiStrIComp(PChar(TJvInterpreterIdentifier(List[I]).Identifier), PChar(Identifier)) = 0) do
- if SameText(TJvInterpreterMethod(List[I]).FClassType.ClassName, ClassName) then begin Index := I; exit; end else inc(I);
end;
procedure TJvInterpreterIdentifierList.Sort(Compare: TListSortCompare = nil);
@@ -3794,13 +3790,7 @@
if Result then
Exit;
- // Mantis 2676: Looking for the actual class name if appropriate
- if Args.ObjTyp = varObject then
- IdentifierFound := FGetList.Find(Identifier, i, Args.Obj.ClassName)
- else
- IdentifierFound := FGetList.Find(Identifier, i);
-
- if IdentifierFound then
+ if FGetList.Find(Identifier, i) then
for I := I to FGetList.Count - 1 do
begin
JvInterpreterMethod := TJvInterpreterMethod(FGetList[I]);
|
|
|
1) FormsExample works correctly with patch from 0003666 2) JvInterpreter patch also includes patch for non-closed 0003650 - sorry, I dont know how to separate them |
|
|
I think more correct solution is to do what we always do with var parameters: not pass they value, but pass they address. In this case the code to change is: TJvInterpreterFunction.InFunction.EnterFunction and TJvInterpreterFunction.InFunction.LeaveFunction.UpdateVarParams (may be we do not need this procedure when pass addresses) |
|
|
I see formclose method even cant start under D6_UP: In procedure CheckNotSupportedFunctionParameters not works expression if TVarData(FCurrArgs.Values[I]).VType in [varArray, varRecord] then... this is working code: if (TVarData(FCurrArgs.Values[I]).VType = varArray) or (TVarData(FCurrArgs.Values[I]).VType = varRecord) then |
|
2006-05-02 02:25
|
JvInterpreter.pas.patch (2,551 bytes)
Index: JvInterpreter.pas
===================================================================
--- JvInterpreter.pas (revision 10546)
+++ JvInterpreter.pas (working copy)
@@ -384,7 +384,7 @@
FDuplicates: TDuplicates;
public
function IndexOf(const UnitName, Identifier: string): TJvInterpreterIdentifier;
- function Find(const Identifier: string; var Index: Integer; const ClassName: string = ''): Boolean;
+ function Find(const Identifier: string; var Index: Integer): Boolean;
procedure Sort(Compare: TListSortCompare = nil); virtual;
property Duplicates: TDuplicates read FDuplicates write FDuplicates;
end;
@@ -2469,6 +2469,9 @@
TVarData(Result).VType := VarType;
end
else
+ if (VarType = varEmpty) and not VarIsEmpty(V) then
+ Result := V
+ else
Result := VarAsType(V, VarType);
end;
end;
@@ -2892,7 +2895,7 @@
//=== { TJvInterpreterIdentifierList } =======================================
function TJvInterpreterIdentifierList.Find(const Identifier: string;
- var Index: Integer; const ClassName: string = ''): Boolean;
+ var Index: Integer): Boolean;
var
L, H, I, C: Integer;
begin
@@ -2917,13 +2920,6 @@
end;
end;
Index := L;
-
- // Mantis 2676: Looking for our specific class, if applicable
- if not Result or (ClassName = '') then
- exit;
- I := Index;
- while (I <= Count - 1) and (AnsiStrIComp(PChar(TJvInterpreterIdentifier(List[I]).Identifier), PChar(Identifier)) = 0) do
- if SameText(TJvInterpreterMethod(List[I]).FClassType.ClassName, ClassName) then begin Index := I; exit; end else inc(I);
end;
procedure TJvInterpreterIdentifierList.Sort(Compare: TListSortCompare = nil);
@@ -3794,13 +3790,7 @@
if Result then
Exit;
- // Mantis 2676: Looking for the actual class name if appropriate
- if Args.ObjTyp = varObject then
- IdentifierFound := FGetList.Find(Identifier, i, Args.Obj.ClassName)
- else
- IdentifierFound := FGetList.Find(Identifier, i);
-
- if IdentifierFound then
+ if FGetList.Find(Identifier, i) then
for I := I to FGetList.Count - 1 do
begin
JvInterpreterMethod := TJvInterpreterMethod(FGetList[I]);
@@ -6082,7 +6072,8 @@
I: Integer;
begin
for I := 0 to FCurrArgs.Count - 1 do
- if TVarData(FCurrArgs.Values[I]).VType in [varArray, varRecord] then
+ if (TVarData(FCurrArgs.Values[I]).VType = varArray)
+ or (TVarData(FCurrArgs.Values[I]).VType = varRecord) then
NotImplemented(RsEInterpreter402);
end;
|
|
|
this now in SVN |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2006-04-28 08:31 | ivan_ra | New Issue | |
| 2006-04-28 08:32 | ivan_ra | File Added: FormsExample.zip | |
| 2006-04-28 08:34 | ivan_ra | File Added: JvInterpreter.pas.svn.patch | |
| 2006-04-28 08:37 | ivan_ra | Note Added: 0009197 | |
| 2006-04-28 20:56 | ivan_ra | Note Added: 0009198 | |
| 2006-05-02 02:23 | ivan_ra | Note Added: 0009229 | |
| 2006-05-02 02:25 | ivan_ra | File Added: JvInterpreter.pas.patch | |
| 2006-05-03 05:30 | ivan_ra | Relationship added | related to 0003650 |
| 2006-05-03 05:30 | ivan_ra | Status | new => resolved |
| 2006-05-03 05:30 | ivan_ra | Resolution | open => fixed |
| 2006-05-03 05:30 | ivan_ra | Assigned To | => ivan_ra |
| 2006-05-03 05:30 | ivan_ra | Note Added: 0009247 |