Browse Source

fix optional method ending identifier

Vladislav Folts 10 years ago
parent
commit
7c63e8a2ba
4 changed files with 9 additions and 2 deletions
  1. BIN
      bin/compiled.zip
  2. 3 2
      src/context.js
  3. 2 0
      test/expected/eberon/method.js
  4. 4 0
      test/input/eberon/method.ob

BIN
bin/compiled.zip


+ 3 - 2
src/context.js

@@ -588,8 +588,6 @@ exports.ProcDecl = ChainedContext.extend({
         if (this.__id.id() != id)
             throw new Errors.Error("mismatched procedure names: '" + this.__id.id()
                                  + "' at the begining and '" + id + "' at the end");
-        this.codeGenerator().closeScope("");
-        this.parent().popScope();
     },
     _prolog: function(){return "\nfunction " + this.__id.id() + "(";},
     typeName: function(){return undefined;},
@@ -643,6 +641,9 @@ exports.ProcDecl = ChainedContext.extend({
         this.__returnParsed = true;
     },
     endParse: function(){
+        this.codeGenerator().closeScope("");
+        this.parent().popScope();
+
         var result = this.__type.result();
         if (result && !this.__returnParsed)
             throw new Errors.Error("RETURN expected at the end of PROCEDURE declared with '"

+ 2 - 0
test/expected/eberon/method.js

@@ -21,6 +21,8 @@ T.prototype.p = function(){
 T.prototype.p2 = function(i/*INTEGER*/){
 	return i;
 }
+T.prototype.methodDefinedWithoutEndingIdent = function(){
+}
 
 function acceptPointer(p/*PT*/){
 }

+ 4 - 0
test/input/eberon/method.ob

@@ -4,6 +4,7 @@ TYPE
         PROCEDURE p();
         PROCEDURE p2(i: INTEGER): INTEGER;
         PROCEDURE useSelfAsPointer();
+        PROCEDURE methodDefinedWithoutEndingIdent();
 		i: INTEGER
 	END;
     PT = POINTER TO T;
@@ -20,6 +21,9 @@ PROCEDURE T.p2(i: INTEGER): INTEGER;
     RETURN i
 END T.p2;
 
+PROCEDURE T.methodDefinedWithoutEndingIdent();
+END;
+
 PROCEDURE acceptPointer(p: PT);
 END acceptPointer;