From 6e0a8415df97892ee6460555e30429767a95f0d7 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 17 May 2020 07:54:41 +0000 Subject: [PATCH] * Add switch to ignore unknown resources git-svn-id: trunk@45395 - --- packages/fcl-passrc/src/pscanner.pp | 9 +++++++-- packages/pastojs/src/pas2jsfiler.pp | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/fcl-passrc/src/pscanner.pp b/packages/fcl-passrc/src/pscanner.pp index 8663be7c09..9db8958565 100644 --- a/packages/fcl-passrc/src/pscanner.pp +++ b/packages/fcl-passrc/src/pscanner.pp @@ -665,7 +665,8 @@ type po_CheckCondFunction, // error on unknown function in conditional expression, default: return '0' po_StopOnErrorDirective, // error on user $Error, $message error|fatal po_ExtConstWithoutExpr, // allow typed const without expression in external class and with external modifier - po_StopOnUnitInterface // parse only a unit name and stop at interface keyword + po_StopOnUnitInterface, // parse only a unit name and stop at interface keyword + po_IgnoreUnknownResource // Ignore resources for which no handler is registered. ); TPOptions = set of TPOption; @@ -3372,7 +3373,11 @@ begin if (H=Nil) then H:=FindResourceHandler('*'); if (H=Nil) then - Error(nNoResourceSupport,SNoResourceSupport,[Ext]); + begin + if not (po_IgnoreUnknownResource in Options) then + Error(nNoResourceSupport,SNoResourceSupport,[Ext]); + exit; + end; // Let the handler take care of the rest. OptList:=TStringList.Create; try diff --git a/packages/pastojs/src/pas2jsfiler.pp b/packages/pastojs/src/pas2jsfiler.pp index a25be18d43..60b9f5b018 100644 --- a/packages/pastojs/src/pas2jsfiler.pp +++ b/packages/pastojs/src/pas2jsfiler.pp @@ -131,7 +131,8 @@ const 'CheckCondFunction', 'StopOnErrorDirective', 'ExtClassConstWithoutExpr', - 'StopOnUnitInterface'); + 'StopOnUnitInterface', + 'IgnoreUnknownResource'); PCUDefaultModeSwitches: TModeSwitches = [ msObjfpc,