Codetools: Support ArrayToDynArray and other missing modeswitches. Issue #36796.

git-svn-id: trunk@62768 -
This commit is contained in:
juha 2020-03-15 17:55:43 +00:00
parent 51f2804834
commit de408de69e
2 changed files with 13 additions and 9 deletions

View File

@ -1777,7 +1777,7 @@ procedure TFDHelpersList.AddFromList(const Tool: TFindDeclarationTool;
FromNode: TFDHelpersListItem;
begin
FromNode := TFDHelpersListItem(ANode.Data);
if (Kind=fdhlkDelphiHelper) and not (msMultiHelpers in Tool.Scanner.CompilerModeSwitches) then
if (Kind=fdhlkDelphiHelper) and not (cmsMultiHelpers in Tool.Scanner.CompilerModeSwitches) then
if FTree.FindKey(FromNode, @CompareHelpersList) <> nil then
Exit(nil); //FPC & Delphi don't support duplicate class helpers!
Result := TFDHelpersListItem.Create;
@ -1841,7 +1841,7 @@ begin
if ExprType.Desc in xtAllIdentTypes then
begin
if (Kind=fdhlkDelphiHelper) and not (msMultiHelpers in Tool.Scanner.CompilerModeSwitches) then begin
if (Kind=fdhlkDelphiHelper) and not (cmsMultiHelpers in Tool.Scanner.CompilerModeSwitches) then begin
// class/type/record helpers only allow one helper per class
OldKey := FTree.FindKey(@ExprType, @CompareHelpersListExprType);
if OldKey <> nil then
@ -4520,7 +4520,7 @@ var
finally
Params.Flags := OldFlags;
end;
until ((HelperKind=fdhlkDelphiHelper) and not (msMultiHelpers in Params.StartTool.Scanner.CompilerModeSwitches))
until ((HelperKind=fdhlkDelphiHelper) and not (cmsMultiHelpers in Params.StartTool.Scanner.CompilerModeSwitches))
or (not Helpers.GetNext(HelperContext,HelperIterator));
//debugln(['SearchInHelpers END']);
end;

View File

@ -213,19 +213,21 @@ type
ansistring; similarly, char becomes unicodechar rather than ansichar }
cmsTypeHelpers, { allows the declaration of "type helper" (non-Delphi) or "record helper"
(Delphi) for primitive types }
cmsClosures, { Anonymous methods }
cmsClosures, { Anonymous methods } // not in tmodeswitch / globtype.pas !!!
cmsCBlocks, { support for http://en.wikipedia.org/wiki/Blocks_(C_language_extension) }
cmsISOlike_IO, { I/O as it required by an ISO compatible compiler }
cmsISOLike_Program_Para, { program parameters as it required by an ISO compatible compiler }
cmsISOLike_Mod, { mod operation as it is required by an iso compatible compiler }
cmsArrayOperators, { use Delphi compatible array operators instead of custom ones ("+") }
cmsMultiHelpers, { helpers can appear in multiple scopes simultaneously }
cmsArray2dynarray, { regular arrays can be implicitly converted to dynamic arrays }
cmsPrefixedAttributes, { enable attributes that are defined before the type they belong to }
// not yet in FPC, supported by pas2js:
cmsPrefixedAttributes, { allow Delphi attributes, disable FPC [] proc modifier }
cmsExternalClass, { pas2js: allow class external [pkgname] name [symbol] }
cmsIgnoreAttributes, { pas2js: ignore attributes }
cmsOmitRTTI, { pas2js: treat class section 'published' as 'public' and typeinfo does not work on symbols declared with this switch }
msMultiHelpers, { off=only one helper per type, on=all }
msImplicitFunctionSpecialization { infer types on calls of generic functions }
cmsImplicitFunctionSpecialization { infer types on calls of generic functions }
);
TCompilerModeSwitches = set of TCompilerModeSwitch;
const
@ -303,17 +305,19 @@ const
'FINALFIELDS',
'UNICODESTRINGS',
'TYPEHELPERS',
'CLOSURES',
'CLOSURES', // not in tmodeswitch / globtype.pas
'CBLOCKS',
'ISOIO',
'ISOPROGRAMPARAS',
'ISOMOD',
'ARRAYOPERATORS',
'MULTIHELPERS',
'ARRAYTODYNARRAY',
'PREFIXEDATTRIBUTES',
// not yet in FPC, supported by pas2js:
'EXTERNALCLASS',
'IGNOREATTRIBUTES',
'OMITRTTI',
'MULTIHELPERS',
'IMPLICITFUNCTIONSPECIALIZATION'
);