pas2js: bool switches $hints, $notes, $warnings

git-svn-id: trunk@37823 -
This commit is contained in:
Mattias Gaertner 2017-12-26 22:24:05 +00:00
parent 5a5eb66545
commit df5a9333a7
2 changed files with 19 additions and 5 deletions

View File

@ -2518,10 +2518,15 @@ End.
<li>{$modeswitch externalclass}: allow declaring external classes</li>
<li>{$macro on|off} enables macro replacements. Only macros with a custom value are replaced. Macros are never replaced inside directives.</li>
<li>{$I filename} or {$include filename} - insert include file</li>
<li>{$ERROR text}</li>
<li>{$WARNING text}</li>
<li>{$NOTE text}</li>
<li>{$HINT text}</li>
<li>{$Warnings on|off}</li>
<li>{$Notes on|off}</li>
<li>{$Hints on|off}</li>
<li>{$Error text}</li>
<li>{$Warning text}</li>
<li>{$Note text}</li>
<li>{$Hint text}</li>
<li>{$Message hint-text}</li>
<li>{$Message hint|note|warn|error|fatal text}</li>
<li>{$M+}, {$TypeInfo on}: switches default visibility for class members from public to published</li>
<li>{$ScopedEnums on|off} disabled/default: propagate enums to global scope, enable: needs fqn e.g. TEnumType.EnumValue.</li>
</ul>

View File

@ -684,6 +684,7 @@ var
aUnitName: String;
i: Integer;
M: TMacroDef;
bs: TBoolSwitches;
begin
FFileResolver:=aFileResolver;
// scanner
@ -696,10 +697,18 @@ begin
FParser := TPas2jsPasParser.Create(Scanner, FileResolver, PascalResolver);
// set options
Scanner.Options:=Scanner.Options+[po_StopOnErrorDirective];
Scanner.AllowedModeSwitches:=msAllPas2jsModeSwitches;
Scanner.ReadOnlyModeSwitches:=msAllPas2jsModeSwitchesReadOnly;
Scanner.CurrentModeSwitches:=p2jsMode_SwitchSets[Compiler.Mode];
Scanner.AllowedBoolSwitches:=msAllPas2jsBoolSwitches;
bs:=msAllPas2jsBoolSwitches;
if not (coShowHints in Compiler.Options) then
Exclude(bs,bsHints);
if not (coShowNotes in Compiler.Options) then
Exclude(bs,bsNotes);
if not (coShowWarnings in Compiler.Options) then
Exclude(bs,bsWarnings);
Scanner.AllowedBoolSwitches:=bs;
// Note: some Scanner.Options are set by TPasResolver
for i:=0 to Compiler.Defines.Count-1 do
begin