Closed geniepro closed 11 years ago
I just updated http://oberspace.dyndns.org/oberonjs.html to the current compiler version, please try to reproduce this bug now.
I just tryed to reproduce this on lasest version:
MODULE Lists;
TYPE
IntegerList = POINTER TO
RECORD
Elem : INTEGER;
Next : IntegerList
END;
VAR
head : IntegerList;
BEGIN
NEW(head)
END Lists.
Compiles to:
var RTL$ = {
extend: function extend(methods){
function Type(){
for(var m in methods)
this[m] = methods[m];
}
Type.prototype = this.prototype;
var result = methods.init;
result.prototype = new Type(); // inherit this.prototype
result.prototype.constructor = result; // to see constructor name in diagnostic
result.extend = extend;
return result;
}
};
var Lists = function (){
var IntegerList = RTL$.extend({
init: function IntegerList(){
this.Elem = 0;
this.Next = null;
}
});
var head = null;
head = new IntegerList();
}();
It seems like everything is ok.
ок, другая проблема вылезла:
MODULE Lists;
IMPORT JS;
TYPE
IntegerList = POINTER TO
RECORD
Elem : INTEGER;
Next : IntegerList
END;
VAR
head : IntegerList;
BEGIN
NEW(head);
head.Elem = 123; (* <- вот тут ашыпка! *)
JS.alert(head.Elem)
END Lists.
выдаётся ошибка:
line 16: PROCEDURE expected, got 'INTEGER'
а как этот топик вдруг стал Closed? о_О
Please try to replace
head.Elem = 123;
to
head.Elem := 123;
geniepro,
So can you close it now?
head.Elem := 123;
ok, mea culpa ))
При компиляции следующего кода
MODULE Lists;
TYPE IntegerList = POINTER TO RECORD Elem : INTEGER; Next : IntegerList END;
END Lists.
выдаётся ошибка:
TypeError: Cannot convert 'ownFields[f]' to object
Хотя согласно репорту на Оберон-07 этот код вполне валиден:
TypeDeclaration = identdef "=" StrucType. StrucType = ArrayType | RecordType | PointerType | ProcedureType. PointerType = POINTER TO type. type = qualident | StrucType.