private Variable createVariableInferred ( TokenList . Token t0 , Variable variableRight ) { Variable result ; if ( t0 . getType ( ) == Type . WORD ) { switch ( variableRight . getType ( ) ) { case MATRIX : alias ( new DMatrixRMaj ( 1 , 1 ) , t0 . getWord ( ) ) ; break ; case SCALAR : if ( variableRight instanceof VariableInteger ) { alias ( 0 , t0 . getWord ( ) ) ; } else { alias ( 1.0 , t0 . getWord ( ) ) ; } break ; case INTEGER_SEQUENCE : alias ( ( IntegerSequence ) null , t0 . getWord ( ) ) ; break ; default : throw new RuntimeException ( "Type not supported for assignment: " + variableRight . getType ( ) ) ; } result = variables . get ( t0 . getWord ( ) ) ; } else { result = t0 . getVariable ( ) ; } return result ; }
Infer the type of and create a new output variable using the results from the right side of the equation . If the type is already known just return that .