ソースを参照

Merge pull request #3998 from ghalliday/issue8819

HPCC-8819 Allow LOCAL to prefix a definition (like SHARED/EXPORT)

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 年 前
コミット
6b4e25fab2
2 ファイル変更25 行追加0 行削除
  1. 1 0
      ecl/hql/hqlgram.y
  2. 24 0
      ecl/regress/issue8819.ecl

+ 1 - 0
ecl/hql/hqlgram.y

@@ -1238,6 +1238,7 @@ knownFunction1
 scopeFlag
     : EXPORT            {   $$.setInt(EXPORT_FLAG); $$.setPosition($1); }
     | SHARED            {   $$.setInt(SHARED_FLAG); $$.setPosition($1); }
+    | LOCAL             {   $$.setInt(0); $$.setPosition($1); }
     ;
 
 // scopeflags needs to be explicitly included, rather than using an optScopeFlags production, otherwise you get shift reduce errors - since it is the first item on a line.

+ 24 - 0
ecl/regress/issue8819.ecl

@@ -0,0 +1,24 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+
+    This program is free software: you can redistribute it and/or modify
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+myfunc(num) := functionmacro
+    local numPlus := num + 1;
+    return numPlus;
+endmacro;
+
+numPlus := 'this will cause syntax error';
+myfunc(5);