diff --git a/utils/pas2js/docs/translation.html b/utils/pas2js/docs/translation.html
index 31b331be5c..953e0351d5 100644
--- a/utils/pas2js/docs/translation.html
+++ b/utils/pas2js/docs/translation.html
@@ -2518,10 +2518,15 @@ End.
{$modeswitch externalclass}: allow declaring external classes
{$macro on|off} enables macro replacements. Only macros with a custom value are replaced. Macros are never replaced inside directives.
{$I filename} or {$include filename} - insert include file
- {$ERROR text}
- {$WARNING text}
- {$NOTE text}
- {$HINT text}
+ {$Warnings on|off}
+ {$Notes on|off}
+ {$Hints on|off}
+ {$Error text}
+ {$Warning text}
+ {$Note text}
+ {$Hint text}
+ {$Message hint-text}
+ {$Message hint|note|warn|error|fatal text}
{$M+}, {$TypeInfo on}: switches default visibility for class members from public to published
{$ScopedEnums on|off} disabled/default: propagate enums to global scope, enable: needs fqn e.g. TEnumType.EnumValue.
diff --git a/utils/pas2js/pas2jscompiler.pp b/utils/pas2js/pas2jscompiler.pp
index ccc58002c5..7b3cc9173b 100644
--- a/utils/pas2js/pas2jscompiler.pp
+++ b/utils/pas2js/pas2jscompiler.pp
@@ -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