/** */ public void setTypedVariable( String name, Class type, Object value, Modifiers modifiers ) throws UtilEvalError { super.setTypedVariable( name, type, value, modifiers ); putExternalMap( name, value ); }
/** @deprecated See #setTypedVariable( String, Class, Object, Modifiers ) */ public void setTypedVariable( String name, Class type, Object value, boolean isFinal ) throws UtilEvalError { Modifiers modifiers = new Modifiers(); if ( isFinal ) modifiers.addModifier( Modifiers.FIELD, "final" ); setTypedVariable( name, type, value, modifiers ); }
/** Sets the typed variable. * @param name the name * @param type the type * @param value the value * @param isFinal the is final * @throws UtilEvalError the util eval error * @deprecated See #setTypedVariable(String, Class, Object, Modifiers) */ @Deprecated public void setTypedVariable(final String name, final Class<?> type, final Object value, final boolean isFinal) throws UtilEvalError { final Modifiers modifiers = new Modifiers(Modifiers.FIELD); if (isFinal) modifiers.addModifier("final"); this.setTypedVariable(name, type, value, modifiers); }
@Override public Object visit(BSHTypedVariableDeclaration node) { try { NameSpace namespace = callstack.top(); BSHType typeNode = node.getTypeNode(); Class type = getType(typeNode); BSHVariableDeclarator [] bvda = node.getDeclarators(); for (int i = 0; i < bvda.length; i++) { BSHVariableDeclarator dec = bvda[i]; // Type node is passed down the chain for array initializers // which need it under some circumstances Object value = evalVariableDeclarator(dec, typeNode); try { namespace.setTypedVariable( dec.name, type, value, node.modifiers ); } catch ( UtilEvalError e ) { throw e.toEvalError( node, callstack ); } } } catch ( EvalError e ) { e.reThrow( "Typed variable declaration" ); } return Primitive.VOID; }
if ( nameSpace.isInterface ) mods.setConstant(); nameSpace.setTypedVariable(varName, Types.getType(val), val, mods); return val; } else if ( type == MAP_ENTRY ) {
Class<?>[] consArgTypes = constructor.getParameterTypes(); for (int i = 0; i < consArgs.length; i++) try { consArgsNameSpace.setTypedVariable(consArgNames[i], consArgTypes[i], consArgs[i], null/*modifiers*/); } catch (UtilEvalError e) { throw new InterpreterError("err setting local cons arg:" + e, e);
Array.set(varArgs, i-k, Primitive.unwrap(argValues[i])); else localNameSpace.setTypedVariable( paramNames[k], paramType, argValues[i], paramModifiers[k]); } catch ( UtilEvalError e2 ) { localNameSpace.setTypedVariable( paramNames[lastParamIndex], paramTypes[lastParamIndex],
for (int i = 0; i < consArgs.length; i++) { try { consArgsNameSpace.setTypedVariable(consArgNames[i], consArgTypes[i], consArgs[i], null/*modifiers*/); } catch (UtilEvalError e) { throw new InterpreterError("err setting local cons arg:" + e);
value = Primitive.castNumberStrictJava(type, ((Primitive) value).numberValue()); namespace.setTypedVariable( dec.name, type, value, modifiers );
localNameSpace.setTypedVariable( paramNames[i],