mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:29:14 +02:00
pastojs: fixed taliasofexternalclass.classmethod
git-svn-id: trunk@37844 -
This commit is contained in:
parent
5e9ae7f062
commit
c9dce6aeb0
@ -276,11 +276,9 @@ ToDos:
|
|||||||
- type alias type
|
- type alias type
|
||||||
- documentation
|
- documentation
|
||||||
- move local types to unit scope
|
- move local types to unit scope
|
||||||
- var absolute
|
|
||||||
- check memleaks
|
|
||||||
- make records more lightweight
|
- make records more lightweight
|
||||||
- pointer of record
|
- pointer of record
|
||||||
- nested types in class
|
- nested classes
|
||||||
- asm: pas() - useful for overloads and protect an identifier from optimization
|
- asm: pas() - useful for overloads and protect an identifier from optimization
|
||||||
- ifthen
|
- ifthen
|
||||||
- stdcall of methods: pass original 'this' as first parameter
|
- stdcall of methods: pass original 'this' as first parameter
|
||||||
@ -296,7 +294,7 @@ Not in Version 1.0:
|
|||||||
- enums with custom values
|
- enums with custom values
|
||||||
- library
|
- library
|
||||||
- constref
|
- constref
|
||||||
- option typecast checking
|
- option typecast checking -Ct
|
||||||
- option verify method calls -CR
|
- option verify method calls -CR
|
||||||
- option range checking -Cr
|
- option range checking -Cr
|
||||||
- option overflow checking -Co
|
- option overflow checking -Co
|
||||||
@ -12285,9 +12283,11 @@ var
|
|||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
{$IFDEF VerbosePas2JS}
|
{$IFDEF VerbosePas2JS}
|
||||||
//writeln('TPasToJSConverter.CreateReferencePath START El=',GetObjName(El),' Parent=',GetObjName(El.Parent),' Context=',GetObjName(AContext),' SelfContext=',GetObjName(AContext.GetSelfContext));
|
writeln('TPasToJSConverter.CreateReferencePath START El=',GetObjName(El),' Parent=',GetObjName(El.Parent),' Context=',GetObjName(AContext),' SelfContext=',GetObjName(AContext.GetSelfContext));
|
||||||
//AContext.WriteStack;
|
AContext.WriteStack;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
if (El is TPasType) and (AContext<>nil) then
|
||||||
|
El:=AContext.Resolver.ResolveAliasType(TPasType(El));
|
||||||
|
|
||||||
ElClass:=El.ClassType;
|
ElClass:=El.ClassType;
|
||||||
if ElClass.InheritsFrom(TPasVariable) and (TPasVariable(El).AbsoluteExpr<>nil)
|
if ElClass.InheritsFrom(TPasVariable) and (TPasVariable(El).AbsoluteExpr<>nil)
|
||||||
|
@ -390,9 +390,9 @@ type
|
|||||||
Procedure TestClass_Const;
|
Procedure TestClass_Const;
|
||||||
Procedure TestClass_LocalVarSelfFail;
|
Procedure TestClass_LocalVarSelfFail;
|
||||||
Procedure TestClass_ArgSelfFail;
|
Procedure TestClass_ArgSelfFail;
|
||||||
Procedure TestClass_NestedSelf;
|
Procedure TestClass_NestedProcSelf;
|
||||||
Procedure TestClass_NestedClassSelf;
|
Procedure TestClass_NestedProcClassSelf;
|
||||||
Procedure TestClass_NestedCallInherited;
|
Procedure TestClass_NestedProcCallInherited;
|
||||||
Procedure TestClass_TObjectFree;
|
Procedure TestClass_TObjectFree;
|
||||||
Procedure TestClass_TObjectFreeNewInstance;
|
Procedure TestClass_TObjectFreeNewInstance;
|
||||||
Procedure TestClass_TObjectFreeLowerCase;
|
Procedure TestClass_TObjectFreeLowerCase;
|
||||||
@ -423,6 +423,7 @@ type
|
|||||||
Procedure TestExternalClass_Dollar;
|
Procedure TestExternalClass_Dollar;
|
||||||
Procedure TestExternalClass_DuplicateVarFail;
|
Procedure TestExternalClass_DuplicateVarFail;
|
||||||
Procedure TestExternalClass_Method;
|
Procedure TestExternalClass_Method;
|
||||||
|
Procedure TestExternalClass_ClassMethod;
|
||||||
Procedure TestExternalClass_NonExternalOverride;
|
Procedure TestExternalClass_NonExternalOverride;
|
||||||
Procedure TestExternalClass_Property;
|
Procedure TestExternalClass_Property;
|
||||||
Procedure TestExternalClass_ClassProperty;
|
Procedure TestExternalClass_ClassProperty;
|
||||||
@ -9180,7 +9181,7 @@ begin
|
|||||||
ConvertProgram;
|
ConvertProgram;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestModule.TestClass_NestedSelf;
|
procedure TTestModule.TestClass_NestedProcSelf;
|
||||||
begin
|
begin
|
||||||
StartProgram(false);
|
StartProgram(false);
|
||||||
Add([
|
Add([
|
||||||
@ -9217,7 +9218,7 @@ begin
|
|||||||
'begin',
|
'begin',
|
||||||
'']);
|
'']);
|
||||||
ConvertProgram;
|
ConvertProgram;
|
||||||
CheckSource('TestClass_NestedSelf',
|
CheckSource('TestClass_NestedProcSelf',
|
||||||
LinesToStr([ // statements
|
LinesToStr([ // statements
|
||||||
'rtl.createClass($mod, "TObject", null, function () {',
|
'rtl.createClass($mod, "TObject", null, function () {',
|
||||||
' this.State = 0;',
|
' this.State = 0;',
|
||||||
@ -9252,7 +9253,7 @@ begin
|
|||||||
'']));
|
'']));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestModule.TestClass_NestedClassSelf;
|
procedure TTestModule.TestClass_NestedProcClassSelf;
|
||||||
begin
|
begin
|
||||||
StartProgram(false);
|
StartProgram(false);
|
||||||
Add([
|
Add([
|
||||||
@ -9286,7 +9287,7 @@ begin
|
|||||||
'begin',
|
'begin',
|
||||||
'']);
|
'']);
|
||||||
ConvertProgram;
|
ConvertProgram;
|
||||||
CheckSource('TestClass_NestedClassSelf',
|
CheckSource('TestClass_NestedProcClassSelf',
|
||||||
LinesToStr([ // statements
|
LinesToStr([ // statements
|
||||||
'rtl.createClass($mod, "TObject", null, function () {',
|
'rtl.createClass($mod, "TObject", null, function () {',
|
||||||
' this.State = 0;',
|
' this.State = 0;',
|
||||||
@ -9318,7 +9319,7 @@ begin
|
|||||||
'']));
|
'']));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestModule.TestClass_NestedCallInherited;
|
procedure TTestModule.TestClass_NestedProcCallInherited;
|
||||||
begin
|
begin
|
||||||
StartProgram(false);
|
StartProgram(false);
|
||||||
Add([
|
Add([
|
||||||
@ -9347,7 +9348,7 @@ begin
|
|||||||
'begin',
|
'begin',
|
||||||
'']);
|
'']);
|
||||||
ConvertProgram;
|
ConvertProgram;
|
||||||
CheckSource('TestClass_NestedCallInherited',
|
CheckSource('TestClass_NestedProcCallInherited',
|
||||||
LinesToStr([ // statements
|
LinesToStr([ // statements
|
||||||
'rtl.createClass($mod, "TObject", null, function () {',
|
'rtl.createClass($mod, "TObject", null, function () {',
|
||||||
' this.$init = function () {',
|
' this.$init = function () {',
|
||||||
@ -10303,6 +10304,54 @@ begin
|
|||||||
'']));
|
'']));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestModule.TestExternalClass_ClassMethod;
|
||||||
|
begin
|
||||||
|
StartProgram(false);
|
||||||
|
Add([
|
||||||
|
'{$modeswitch externalclass}',
|
||||||
|
'type',
|
||||||
|
' TExtA = class external name ''ExtObj''',
|
||||||
|
' class procedure DoIt(Id: longint = 1); external name ''$Execute'';',
|
||||||
|
' end;',
|
||||||
|
' TExtB = TExtA;',
|
||||||
|
'begin',
|
||||||
|
' texta.doit;',
|
||||||
|
' texta.doit();',
|
||||||
|
' texta.doit(2);',
|
||||||
|
' with texta do begin',
|
||||||
|
' doit;',
|
||||||
|
' doit();',
|
||||||
|
' doit(3);',
|
||||||
|
' end;',
|
||||||
|
' textb.doit;',
|
||||||
|
' textb.doit();',
|
||||||
|
' textb.doit(4);',
|
||||||
|
' with textb do begin',
|
||||||
|
' doit;',
|
||||||
|
' doit();',
|
||||||
|
' doit(5);',
|
||||||
|
' end;',
|
||||||
|
'']);
|
||||||
|
ConvertProgram;
|
||||||
|
CheckSource('TestExternalClass_ClassMethod',
|
||||||
|
LinesToStr([ // statements
|
||||||
|
'']),
|
||||||
|
LinesToStr([ // $mod.$main
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(2);',
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(3);',
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(4);',
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(1);',
|
||||||
|
'ExtObj.$Execute(5);',
|
||||||
|
'']));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestModule.TestExternalClass_NonExternalOverride;
|
procedure TTestModule.TestExternalClass_NonExternalOverride;
|
||||||
begin
|
begin
|
||||||
StartProgram(false);
|
StartProgram(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user