Menu

Commit [r4321]  Maximize  Restore  History

Added new CanCompile method to ISnippetBase and its implementation in TSnippetBase.

delphidabbler 2013-12-15

changed /branches/parsnip/Src/Main/CS.Database.Snippets.pas
changed /branches/parsnip/Src/Main/CS.Database.Types.pas
/branches/parsnip/Src/Main/CS.Database.Snippets.pas Diff Switch to side-by-side view
--- a/branches/parsnip/Src/Main/CS.Database.Snippets.pas
+++ b/branches/parsnip/Src/Main/CS.Database.Snippets.pas
@@ -54,6 +54,7 @@
     constructor Create(const ASourceSnippet: TSnippetBase); overload;
     destructor Destroy; override;
     procedure UpdateFrom(const ASourceSnippet: TSnippetBase);
+    function CanCompile: Boolean;
     function GetID: TSnippetID; virtual;
     function GetCreated: TUTCDateTime;
     procedure SetCreated(const Value: TUTCDateTime);
@@ -283,6 +284,12 @@
 
 { TSnippetBase }
 
+function TSnippetBase.CanCompile: Boolean;
+begin
+  Result := (fKind <> skFreeform)
+    and (fLanguageID = TSourceCodeLanguageID.Create('Pascal'));
+end;
+
 constructor TSnippetBase.Create(const ASourceSnippet: TSnippetBase);
 begin
   Create(ASourceSnippet.fID);
/branches/parsnip/Src/Main/CS.Database.Types.pas Diff Switch to side-by-side view
Loading...
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.