Преглед изворни кода

Remove COPY/LONG/SHORT (as in a new report 07/13)

Vladislav Folts пре 11 година
родитељ
комит
17393de984
4 измењених фајлова са 0 додато и 90 уклоњено
  1. 0 43
      src/procedure.js
  2. 0 13
      test/input/copy.ob
  3. 0 10
      test/input/long_short.ob
  4. 0 24
      test/test_unit.js

+ 0 - 43
src/procedure.js

@@ -278,25 +278,6 @@ function bitShiftImpl(name, op){
     return symbol;
 }
 
-function longShort(name){
-    var CallGenerator = ExpCallGenerator.extend({
-        init: function LongShortCallGenerator(context, id, type){
-            ExpCallGenerator.prototype.init.call(this, context, id, type);
-        },
-        callExpression: function(){return this.args()[0];}
-    });
-    var args = [new Arg(Type.basic.real, false)];
-    var proc = new Std(
-        name,
-        args,
-        Type.basic.real,
-        function(context, id, type){
-            return new CallGenerator(context, id, type);
-        });
-    var symbol = new Symbol.Symbol(name, proc);
-    return symbol;
-}
-
 function checkVariableArgumentsCount(min, max, actual){
     if (actual < min)
         throw new Errors.Error("at least " + min + " argument expected, got " + actual);
@@ -489,8 +470,6 @@ exports.predefined = [
         var symbol = new Symbol.Symbol("FLT", proc);
         return symbol;
     }(),
-    longShort("LONG"),
-    longShort("SHORT"),
     bitShiftImpl("LSL", op.lsl),
     bitShiftImpl("ASR", op.asr),
     bitShiftImpl("ROR", op.ror),
@@ -563,28 +542,6 @@ exports.predefined = [
         var symbol = new Symbol.Symbol(name, type);
         return symbol;
     }(),
-    function(){
-        var CallGenerator = ExpCallGenerator.extend({
-            init: function CopyProcCallGenerator(context, id, type){
-                ExpCallGenerator.prototype.init.call(this, context, id, type);
-            },
-            callExpression: function(){
-                var args = this.args();
-                return new Code.Expression(op.assign(args[1], args[0], this.context()));
-            }
-        });
-        var name = "COPY";
-        var type = new Std(
-            name,
-            [new Arg(undefined, false),
-             new Arg(new Type.Array("ARRAY OF CHAR", undefined, Type.basic.ch), true)],
-            undefined,
-            function(context, id, type){
-                return new CallGenerator(context, id, type);
-            });
-        var symbol = new Symbol.Symbol(name, type);
-        return symbol;
-    }(),
     function(){
         var args = [new Arg(Type.basic.real, true),
                     new Arg(Type.basic.integer, false)];

+ 0 - 13
test/input/copy.ob

@@ -1,13 +0,0 @@
-MODULE m;
-
-CONST
-	s1 = 22X;
-	s2 = "ABC";
-VAR
-	ac3: ARRAY 3 OF CHAR;
-
-BEGIN
-    COPY(s1, ac3);
-    COPY(s2, ac3);
-    COPY(ac3, ac3);
-END m.

+ 0 - 10
test/input/long_short.ob

@@ -1,10 +0,0 @@
-MODULE m;
-
-VAR r: REAL; lr: LONGREAL;
-
-BEGIN
-    r := SHORT(lr);
-    lr := LONG(r);
-    r := SHORT(1.23);
-    lr := LONG(1.23);
-END m.

+ 0 - 24
test/test_unit.js

@@ -540,20 +540,6 @@ var testSuite = {
          ["i := FLT(i, i)", "1 argument(s) expected, got 2"]
          )
     ),
-"LONG": testWithContext(
-    context(Grammar.statement, "VAR i: INTEGER; r: REAL; lr: LONGREAL;"),
-    pass("lr := LONG(r)"),
-    fail(["lr := LONG(i)", "type mismatch for argument 1: 'INTEGER' cannot be converted to 'REAL'"],
-         ["lr := LONG(r, r)", "1 argument(s) expected, got 2"]
-         )
-    ),
-"SHORT": testWithContext(
-    context(Grammar.statement, "VAR i: INTEGER; r: REAL; lr: LONGREAL;"),
-    pass("r := SHORT(lr)"),
-    fail(["r := SHORT(i)", "type mismatch for argument 1: 'INTEGER' cannot be converted to 'REAL'"],
-         ["r := SHORT(lr, lr)", "1 argument(s) expected, got 2"]
-         )
-    ),
 "LSL": testWithContext(
     context(Grammar.statement,
             "VAR i: INTEGER; r: REAL; c: CHAR;"),
@@ -629,16 +615,6 @@ var testSuite = {
          ["DEC(i, 1, 2)", "at most 2 arguments expected, got 3"]
          )
 ),
-"COPY": testWithContext(
-    context(Grammar.statement, "VAR ac3: ARRAY 3 OF CHAR; ac4: ARRAY 4 OF CHAR;"),
-    pass("COPY(\"abc\", ac3)",
-         "COPY(ac3, ac3)"
-        ),
-    fail(["COPY(ac3, \"abc\")", "expression cannot be used as VAR parameter"],
-         ["COPY(\"abcd\", ac3)", "3-character ARRAY is too small for 4-character string"],
-         ["COPY(ac3, ac4)", "type mismatch: 'ac4' is 'ARRAY 4 OF CHAR' and cannot be assigned to 'ARRAY 3 OF CHAR' expression"]
-         )
-),
 "PACK": testWithContext(
     context(Grammar.statement, "VAR r: REAL; i: INTEGER;"),
     pass("PACK(r, i)",