MCPcopy Create free account
hub / github.com/beanshell/beanshell / unset

Method unset

src/bsh/Interpreter.java:928–950  ·  view source on GitHub ↗

Unassign the variable name. Name should evaluate to a variable.

( String name )

Source from the content-addressed store, hash-verified

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

Callers 1

undeclareBeanMethod · 0.80

Calls 4

getNameResolverMethod · 0.80
toLHSMethod · 0.45
unsetVariableMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected