|
@@ -52,7 +52,10 @@ var ProcCallGenerator = Class.extend({
|
|
if (designator){
|
|
if (designator){
|
|
var info = designator.info();
|
|
var info = designator.info();
|
|
if (info instanceof Type.Variable)
|
|
if (info instanceof Type.Variable)
|
|
- if (info.isVar() && !isVarArg)
|
|
|
|
|
|
+ if (info.isVar() && !isVarArg
|
|
|
|
+ && !(type instanceof Type.Array)
|
|
|
|
+ && !(type instanceof Type.Record)
|
|
|
|
+ )
|
|
code += ".get()";
|
|
code += ".get()";
|
|
else if (!info.isVar() && isVarArg)
|
|
else if (!info.isVar() && isVarArg)
|
|
code = designator.refCode();
|
|
code = designator.refCode();
|
|
@@ -201,6 +204,34 @@ exports.predefined = [
|
|
var symbol = new Type.Symbol(name, type);
|
|
var symbol = new Type.Symbol(name, type);
|
|
return symbol;
|
|
return symbol;
|
|
}(),
|
|
}(),
|
|
|
|
+ function(){
|
|
|
|
+ var LenProcCallGenerator = ProcCallGenerator.extend({
|
|
|
|
+ init: function LenProcCallGenerator(context, id, type){
|
|
|
|
+ ProcCallGenerator.prototype.init.call(this, context, id, type);
|
|
|
|
+ },
|
|
|
|
+ prolog: function(id){return "";},
|
|
|
|
+ checkArgument: function(pos, type, designator){
|
|
|
|
+ ProcCallGenerator.prototype.checkArgument.call(this, pos, type, designator);
|
|
|
|
+ if (!(type instanceof Type.Array))
|
|
|
|
+ throw new Errors.Error("ARRAY expected, got '"
|
|
|
|
+ + type.name() + "'");
|
|
|
|
+ return new CheckArgumentResult(type, false);
|
|
|
|
+ },
|
|
|
|
+ epilog: function(){return ".length";}
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var name = "LEN";
|
|
|
|
+ var args = [new Arg(undefined, false)];
|
|
|
|
+ var type = new Type.Procedure(new ProcType(
|
|
|
|
+ "predefined procedure LEN",
|
|
|
|
+ args,
|
|
|
|
+ Type.basic.int,
|
|
|
|
+ function(context, id, type){
|
|
|
|
+ return new LenProcCallGenerator(context, id, type);
|
|
|
|
+ }));
|
|
|
|
+ var symbol = new Type.Symbol(name, type);
|
|
|
|
+ return symbol;
|
|
|
|
+ }(),
|
|
function(){
|
|
function(){
|
|
var AssertProcCallGenerator = ProcCallGenerator.extend({
|
|
var AssertProcCallGenerator = ProcCallGenerator.extend({
|
|
init: function AssertProcCallGenerator(context, id, type){
|
|
init: function AssertProcCallGenerator(context, id, type){
|