|
@@ -427,14 +427,22 @@ var RecordDecl = Context.RecordDecl.extend({
|
|
|
_makeField: function(field, type){
|
|
|
return EberonRecord.makeRecordField(field, type, this.__type);
|
|
|
},
|
|
|
+ _generateBaseConstructorCallCode: function(){
|
|
|
+ var actualConstructor = EberonRecord.actualConstructor(this.type());
|
|
|
+ if (!actualConstructor || !actualConstructor.args().length)
|
|
|
+ return Context.RecordDecl.prototype._generateBaseConstructorCallCode.call(this);
|
|
|
+
|
|
|
+ var result = this._qualifiedBaseConstructor();
|
|
|
+ return result ? result + ".apply(this, arguments);\n" : "";
|
|
|
+ },
|
|
|
endParse: function(){
|
|
|
var type = this.type();
|
|
|
if (!type.customConstructor)
|
|
|
return Context.RecordDecl.prototype.endParse.call(this);
|
|
|
- else
|
|
|
- type.setRecordInitializationCode(
|
|
|
- this._generateBaseConstructorCallCode(),
|
|
|
- this._generateInheritance());
|
|
|
+
|
|
|
+ type.setRecordInitializationCode(
|
|
|
+ this._generateBaseConstructorCallCode(),
|
|
|
+ this._generateInheritance());
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -619,9 +627,10 @@ var ProcOrMethodDecl = Context.ProcDecl.extend({
|
|
|
this.__boundType.defineConstructor(this.__methodType.procType());
|
|
|
|
|
|
var base = Type.recordBase(this.__boundType);
|
|
|
- if (!this.__baseConstructorWasCalled && base && base.customConstructor && base.customConstructor.args().length)
|
|
|
+ var baseConstructor = base && EberonRecord.actualConstructor(base);
|
|
|
+ if (!this.__baseConstructorWasCalled && baseConstructor && baseConstructor.args().length)
|
|
|
throw new Errors.Error("base record constructor has parameters but was not called (use '| SUPER' to pass parameters to base constructor)");
|
|
|
- if (this.__baseConstructorWasCalled && (!base.customConstructor || !base.customConstructor.args().length))
|
|
|
+ if (this.__baseConstructorWasCalled && (!baseConstructor || !baseConstructor.args().length))
|
|
|
throw new Errors.Error("base record constructor has no parameters and will be called automatically (do not use '| SUPER' to call base constructor)");
|
|
|
|
|
|
var fieldsWereNotInited = [];
|