diff --git a/.gitattributes b/.gitattributes index 6c91a2fc3e..305d98e6a2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6587,6 +6587,7 @@ tests/webtbs/tw4100.pp svneol=native#text/plain tests/webtbs/tw4104.pp svneol=native#text/plain tests/webtbs/tw4115.pp svneol=native#text/plain tests/webtbs/tw4119.pp svneol=native#text/plain +tests/webtbs/tw4136.pp svneol=native#text/plain tests/webtbs/tw4140.pp svneol=native#text/plain tests/webtbs/tw4150.pp svneol=native#text/plain tests/webtbs/tw4151.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 5976de998e..e3bbb7ff1b 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -2016,6 +2016,11 @@ implementation end else case token of + _RETURN : + begin + consume(_RETURN); + p1 := cexitnode.create(comp_expr(true)); + end; _INHERITED : begin again:=true; diff --git a/compiler/tokens.pas b/compiler/tokens.pas index 1ad2b02453..3d87724c2c 100644 --- a/compiler/tokens.pas +++ b/compiler/tokens.pas @@ -167,6 +167,7 @@ type _RECORD, _REPEAT, _RESULT, + _RETURN, _STATIC, _STORED, _STRICT, @@ -411,6 +412,7 @@ const (str:'RECORD' ;special:false;keyword:m_all;op:NOTOKEN), (str:'REPEAT' ;special:false;keyword:m_all;op:NOTOKEN), (str:'RESULT' ;special:false;keyword:m_none;op:NOTOKEN), + (str:'RETURN' ;special:false;keyword:m_mac;op:NOTOKEN), (str:'STATIC' ;special:false;keyword:m_none;op:NOTOKEN), (str:'STORED' ;special:false;keyword:m_none;op:NOTOKEN), (str:'STRICT' ;special:false;keyword:m_none;op:NOTOKEN), diff --git a/tests/webtbs/tw4136.pp b/tests/webtbs/tw4136.pp new file mode 100644 index 0000000000..1280161f37 --- /dev/null +++ b/tests/webtbs/tw4136.pp @@ -0,0 +1,11 @@ +{$mode macpas} +function f: longint; +begin + return 3; +end; + +begin + if f() <> 3 then + halt(1); +end. +