diff --git a/compiler/parser/ceda/ast2a.py b/compiler/parser/ceda/ast2a.py index e9b65c691..239b70fea 100644 --- a/compiler/parser/ceda/ast2a.py +++ b/compiler/parser/ceda/ast2a.py @@ -163,25 +163,25 @@ def mk_file (ty, n): return ["File", [ty, n.nfile.fd, arg]]; -def mk_dup (ty, n): - ndup = n.ndup; - vname = ndup.vname; - - tgt = []; +def mk_dup(ty, n): + ndup = n.ndup + vname = ndup.vname + + tgt = [] if (not vname): - dupfd = ndup.dupfd; + dupfd = ndup.dupfd if (dupfd == -1): - tgt.append (["C", ORD_MINUS]); + tgt.append(["C", ORD_MINUS]) else: - dupfd_str = str (dupfd); + dupfd_str = str(dupfd) - for i in range (len (dupfd_str)): - tgt.append (["C", ord (dupfd_str [i])]); + for i in range(len(dupfd_str)): + tgt.append(["C", ord(dupfd_str[i])]) else: - tgt = to_arg (vname.narg); + tgt = to_arg(vname.contents.narg) - return (["Dup", [ty, ndup.fd, tgt]]); + return (["Dup", [ty, ndup.fd, tgt]]) def mk_here (ty, n): diff --git a/evaluation/tests/interface_tests/redir-var-test.sh b/evaluation/tests/interface_tests/redir-var-test.sh new file mode 100644 index 000000000..e82ffd7cb --- /dev/null +++ b/evaluation/tests/interface_tests/redir-var-test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +func_emit_tests_Makefile_am () +{ + ofd=3 + { + echo hi + } >&$ofd +} +fd=1 +echo hi >&$fd diff --git a/evaluation/tests/interface_tests/run.sh b/evaluation/tests/interface_tests/run.sh index c97b16b74..a7fba89ec 100755 --- a/evaluation/tests/interface_tests/run.sh +++ b/evaluation/tests/interface_tests/run.sh @@ -297,6 +297,12 @@ test_exclam() $shell test-exclam.sh } +test_redir_var_test() +{ + local shell=$1 + $shell redir-var-test.sh +} + ## We run all tests composed with && to exit on the first that fails if [ "$#" -eq 0 ]; then run_test test1 @@ -337,6 +343,7 @@ if [ "$#" -eq 0 ]; then run_test test_quoting run_test test_var_assgn_default run_test test_exclam + run_test test_redir_var_test else for testname in $@ do