codetools: implemented modeswitch externalclass

git-svn-id: trunk@54470 -
This commit is contained in:
mattias 2017-03-23 10:51:07 +00:00
parent 6dd5585619
commit d5881ef02e
4 changed files with 27 additions and 2 deletions

View File

@ -8935,6 +8935,13 @@ begin
{$ENDIF}
exit(true);
end;
if FindClassExternalNode(CodeCompleteClassNode)<>nil then begin
// external class has no implementations
{$IF defined(CTDEBUG) or defined(VerboseCreateMissingClassProcBodies)}
debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies external ',CodeCompleteClassNode.DescAsString]);
{$ENDIF}
exit(true);
end;
Result:=false;
Beauty:=FSourceChangeCache.BeautifyCodeOptions;

View File

@ -195,7 +195,8 @@ type
cmsDefault_unicodestring, { makes the default string type in $h+ mode unicodestring rather than
ansistring; similarly, char becomes unicodechar rather than ansichar }
cmsTypeHelpers,
cmsBlocks
cmsBlocks,
cmsExternalClass { allow class external [pkgname] name [symbol] }
);
TCompilerModeSwitches = set of TCompilerModeSwitch;
const
@ -797,7 +798,8 @@ const
'FINALFIELDS',
'UNICODESTRINGS',
'TYPEHELPERS',
'BLOCKS'
'BLOCKS',
'EXTERNALCLASS'
);
// upper case

View File

@ -4359,9 +4359,11 @@ begin
end;
if UpAtomIs('EXTERNAL') then begin
if (ClassDesc in [ctnObjCClass,ctnObjCCategory])
or (cmsExternalClass in Scanner.CompilerModeSwitches)
or Scanner.Values.IsDefined('CPUJVM') then begin
// objcclass external [name '']
// cpujvm: class external '' [name '']
// externalclass: class external [''] name ''
CreateChildNode;
CurNode.Desc:=ctnClassExternal;
ReadNextAtom;

View File

@ -225,6 +225,7 @@ type
function IsClassNode(Node: TCodeTreeNode): boolean; // class, not object
function FindInheritanceNode(ClassNode: TCodeTreeNode): TCodeTreeNode;
function FindHelperForNode(HelperNode: TCodeTreeNode): TCodeTreeNode;
function FindClassExternalNode(ClassNode: TCodeTreeNode): TCodeTreeNode;
function IdentNodeIsInVisibleClassSection(Node: TCodeTreeNode; Visibility: TClassSectionVisibility): Boolean;
// records
@ -3066,6 +3067,19 @@ begin
Result:=nil;
end;
function TPascalReaderTool.FindClassExternalNode(ClassNode: TCodeTreeNode
): TCodeTreeNode;
begin
if ClassNode=nil then exit;
Result:=ClassNode.FirstChild;
while (Result<>nil) do
begin
if Result.Desc=ctnClassExternal then exit;
if Result.Desc in AllClassBaseSections then exit(nil);
Result:=Result.NextBrother;
end;
end;
function TPascalReaderTool.FindTypeOfForwardNode(TypeNode: TCodeTreeNode
): TCodeTreeNode;