Unassign the variable name. Name should evaluate to a variable.
( String name )
| 926 | Name should evaluate to a variable. |
| 927 | */ |
| 928 | public void unset( String name ) |
| 929 | throws EvalError |
| 930 | { |
| 931 | /* |
| 932 | We jump through some hoops here to handle arbitrary cases like |
| 933 | unset("bsh.foo"); |
| 934 | */ |
| 935 | CallStack callstack = new CallStack(); |
| 936 | try { |
| 937 | LHS lhs = globalNameSpace.getNameResolver( name ).toLHS( |
| 938 | callstack, this ); |
| 939 | |
| 940 | if ( lhs.type != LHS.VARIABLE ) |
| 941 | throw new EvalError("Can't unset, not a variable: "+name, |
| 942 | SimpleNode.JAVACODE, new CallStack() ); |
| 943 | |
| 944 | //lhs.assign( null, false ); |
| 945 | lhs.nameSpace.unsetVariable( name ); |
| 946 | } catch ( UtilEvalError e ) { |
| 947 | throw new EvalError( e.getMessage(), |
| 948 | SimpleNode.JAVACODE, new CallStack() ); |
| 949 | } |
| 950 | } |
| 951 | |
| 952 | // end primary set and get methods |
| 953 |
no test coverage detected