2
0
Эх сурвалжийг харах

prohibit '-' export for methods

Vladislav Folts 11 жил өмнө
parent
commit
f7cc83d0fc

+ 4 - 1
src/eberon/eberon_context.js

@@ -76,7 +76,10 @@ var MethodHeading = Context.Chained.extend({
         this.__id = undefined;
         this.__type = undefined;
     },
-    handleIdentdef: function(id){this.__id = id;},
+    handleIdentdef: function(id){
+        checkOrdinaryExport(id, "method");
+        this.__id = id;
+    },
     typeName: function(){return undefined;},
     setType: function(type){this.__type = type;},
     endParse: function(){

+ 4 - 1
test/test_unit_eberon.js

@@ -201,7 +201,10 @@ exports.suite = {
          ["CONST c- = 123;", 
           "constant cannot be exported as read-only using '-' mark (did you mean '*'?)"],
          ["VAR i-: INTEGER;", 
-          "variable cannot be exported as read-only using '-' mark (did you mean '*'?)"])
+          "variable cannot be exported as read-only using '-' mark (did you mean '*'?)"],
+         ["TYPE T* = RECORD PROCEDURE p-() END;", 
+          "method cannot be exported as read-only using '-' mark (did you mean '*'?)"]
+         )
     ),
 "field exported as read-only is writable in current module": testWithContext(
     context(grammar.statement,