|
@@ -92,6 +92,15 @@ BEGIN
|
|
|
RETURN result;
|
|
|
END;
|
|
|
|
|
|
+PROCEDURE doesBaseHasNotExportedMethod(r: Record; id :STRING): BOOLEAN;
|
|
|
+BEGIN
|
|
|
+ type <- r.base(PRecord);
|
|
|
+ WHILE (type # NIL) & (type.nonExportedMethods.indexOf(id) = -1) DO
|
|
|
+ type := type.base(PRecord);
|
|
|
+ END;
|
|
|
+ RETURN type # NIL;
|
|
|
+END;
|
|
|
+
|
|
|
PROCEDURE ensureMethodDefinitionsForEach(key: STRING; ids: ARRAY OF STRING; r: PRecord; VAR result: ARRAY * OF STRING);
|
|
|
VAR
|
|
|
report: ARRAY * OF STRING;
|
|
@@ -278,6 +287,9 @@ BEGIN
|
|
|
IF findMethodDeclaration(SELF(POINTER), id) # NIL THEN
|
|
|
Errors.raise(
|
|
|
"cannot declare field, record already has method '" + id +"'");
|
|
|
+ ELSIF doesBaseHasNotExportedMethod(SELF, id) THEN
|
|
|
+ Errors.raise(
|
|
|
+ "cannot declare field, record already has method '" + id +"' in the base record (was not exported)");
|
|
|
END;
|
|
|
|
|
|
type <- f.type();
|
|
@@ -306,6 +318,9 @@ BEGIN
|
|
|
msg := "cannot declare method, record already has field '" + id + "'";
|
|
|
END;
|
|
|
Errors.raise(msg);
|
|
|
+ ELSIF doesBaseHasNotExportedMethod(SELF, id) THEN
|
|
|
+ Errors.raise("cannot declare a new method '" + id + "': "
|
|
|
+ + "method already was declared in the base record (but was not exported)");
|
|
|
END;
|
|
|
|
|
|
SELF.declaredMethods[id] := NEW RecordFieldAsMethod(methodId, type);
|
|
@@ -471,7 +486,6 @@ BEGIN
|
|
|
FOR i <- 0 TO LEN(SELF.nonExportedMethods) - 1 DO
|
|
|
SELF.declaredMethods.remove(SELF.nonExportedMethods[i]);
|
|
|
END;
|
|
|
- SELF.nonExportedMethods.clear();
|
|
|
|
|
|
checkIfFieldsInited(SELF);
|
|
|
|