mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 19:29:26 +02:00
pastojs: error on record variant
git-svn-id: trunk@37910 -
This commit is contained in:
parent
8401bd1286
commit
4a490323e1
@ -260,11 +260,11 @@ Works:
|
||||
- set of int/enum/char range, in
|
||||
- array[rg], low(array), high(array), length(array)
|
||||
- enumeration for..in..do
|
||||
- enum, enum range, set of enum, set of enum range
|
||||
- int, int range, set of int, set of int range
|
||||
- char, char range, set of char, set of char range
|
||||
- array
|
||||
- class
|
||||
- enum, enum range, set of enum, set of enum range
|
||||
- int, int range, set of int, set of int range
|
||||
- char, char range, set of char, set of char range
|
||||
- array
|
||||
- class
|
||||
|
||||
ToDos:
|
||||
- remove hasOwnProperty from rtl set functions
|
||||
@ -921,6 +921,7 @@ type
|
||||
Access: TResolvedRefAccess); override;
|
||||
procedure FinishModule(CurModule: TPasModule); override;
|
||||
procedure FinishSetType(El: TPasSetType); override;
|
||||
procedure FinishRecordType(El: TPasRecordType); override;
|
||||
procedure FinishClassType(El: TPasClassType); override;
|
||||
procedure FinishVariable(El: TPasVariable); override;
|
||||
procedure FinishProcedureType(El: TPasProcedureType); override;
|
||||
@ -2128,6 +2129,13 @@ begin
|
||||
RaiseMsg(20170415182320,nNotSupportedX,sNotSupportedX,['set of '+TypeEl.Name],El);
|
||||
end;
|
||||
|
||||
procedure TPas2JSResolver.FinishRecordType(El: TPasRecordType);
|
||||
begin
|
||||
if (El.Variants<>nil) and (El.Variants.Count>0) then
|
||||
RaiseMsg(20180104205309,nXIsNotSupported,sXIsNotSupported,['variant record'],TPasElement(El.Variants[0]));
|
||||
inherited FinishRecordType(El);
|
||||
end;
|
||||
|
||||
procedure TPas2JSResolver.FinishClassType(El: TPasClassType);
|
||||
begin
|
||||
inherited FinishClassType(El);
|
||||
|
@ -347,6 +347,7 @@ type
|
||||
Procedure TestRecordElementFromWith_AsParams;
|
||||
Procedure TestRecord_Equal;
|
||||
Procedure TestRecord_TypeCastJSValueToRecord;
|
||||
Procedure TestRecord_VariantFail;
|
||||
// ToDo: const record
|
||||
|
||||
// classes
|
||||
@ -6944,6 +6945,22 @@ begin
|
||||
'']));
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestRecord_VariantFail;
|
||||
begin
|
||||
StartProgram(false);
|
||||
Add([
|
||||
'type',
|
||||
' TRec = record',
|
||||
' case word of',
|
||||
' 0: (b0, b1: Byte);',
|
||||
' 1: (i: word);',
|
||||
' end;',
|
||||
'begin']);
|
||||
SetExpectedPasResolverError('variant record is not supported',
|
||||
nXIsNotSupported);
|
||||
ConvertProgram;
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestClass_TObjectDefaultConstructor;
|
||||
begin
|
||||
StartProgram(false);
|
||||
|
Loading…
Reference in New Issue
Block a user