* do not crash but give a fatal error when using Objective-Pascal code

without {$modeswitch objectivec1}

git-svn-id: trunk@15163 -
This commit is contained in:
Jonas Maebe 2010-04-24 12:49:16 +00:00
parent 2eddd5e704
commit 0dcedf3799
6 changed files with 376 additions and 355 deletions

1
.gitattributes vendored
View File

@ -8830,6 +8830,7 @@ tests/test/opt/twpo7.pp svneol=native#text/plain
tests/test/opt/uwpo2.pp svneol=native#text/plain
tests/test/packages/cocoaint/tobjcnh1.pp svneol=native#text/plain
tests/test/packages/cocoaint/tvarpara.pp svneol=native#text/plain
tests/test/packages/cocoaint/tw16329.pp svneol=native#text/plain
tests/test/packages/fcl-base/tascii85.pp svneol=native#text/plain
tests/test/packages/fcl-base/tgettext1.pp svneol=native#text/plain
tests/test/packages/fcl-db/assertions.pas svneol=native#text/plain

View File

@ -1307,6 +1307,9 @@ parser_e_no_paras_for_class_destructor=03291_E_Class destructors can't have para
% You are declaring a class destructor with a parameter list. Class destructor methods
% cannot have parameters.
% \end{description}
parser_f_modeswitch_objc_required=03292_F_This construct requires the \{\$modeswitch objectivec1\} mode switch to be active
% Objective-Pascal constructs are not supported when \{\$modeswitch ObjectiveC1\}
% is not active.
#
# Type Checking
#

View File

@ -380,6 +380,7 @@ const
parser_e_only_one_class_destructor_allowed=03289;
parser_e_no_paras_for_class_constructor=03290;
parser_e_no_paras_for_class_destructor=03291;
parser_f_modeswitch_objc_required=03292;
type_e_mismatch=04000;
type_e_incompatible_types=04001;
type_e_not_equal_types=04002;
@ -858,9 +859,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 56309;
MsgTxtSize = 56399;
MsgIdxMax : array[1..20] of longint=(
24,88,292,96,80,51,110,22,202,63,
24,88,293,96,80,51,110,22,202,63,
49,20,1,1,1,1,1,1,1,1
);

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,7 @@ implementation
uses
sysutils,
globtype,cclasses,systems,
globtype,globals,cclasses,systems,
verbose,pass_1,
defutil,
symtype,symtable,symdef,symconst,symsym,
@ -84,6 +84,8 @@ function tobjcselectornode.pass_typecheck: tnode;
len: longint;
s: shortstring;
begin
if not(m_objectivec1 in current_settings.modeswitches) then
Message(parser_f_modeswitch_objc_required);
result:=nil;
typecheckpass(left);
{ argument can be
@ -141,6 +143,8 @@ constructor tobjcprotocolnode.create(forprotocol: tnode);
function tobjcprotocolnode.pass_typecheck: tnode;
begin
if not(m_objectivec1 in current_settings.modeswitches) then
Message(parser_f_modeswitch_objc_required);
result:=nil;
typecheckpass(left);
if (left.nodetype<>typen) then

View File

@ -0,0 +1,8 @@
{ %fail }
{ %target=darwin }
uses objc,CocoaAll;
var workspace:NSWorkspace;
begin
workspace:=NSWorkspace.sharedWorkspace;
end.