Ejemplo n.º 1
0
 @Override
 public void setValue(String name, IRubyObject value) {
   if (scope.getValue(name) != null) {
     scope.setValue(name, value);
   } else {
     super.setValue(name, value);
   }
 }
 /**
  * Get the completions based on the arguments received
  *
  * @param state this is the state used for the completion
  * @param localScope this is the scope we're currently on (may be null)
  */
 public static Collection<AbstractToken> getCompletionsForTokenWithUndefinedType(
     CompletionState state, LocalScope localScope) {
   AbstractToken[] localTokens = localScope.getLocalTokens(-1, -1, false); // only to get the
   // args
   String activationToken = state.getActivationToken();
   String firstPart = FullRepIterable.getFirstPart(activationToken);
   for (AbstractToken token : localTokens) {
     if (token.getRepresentation().equals(firstPart)) {
       Collection<AbstractToken> interfaceForLocal =
           localScope.getInterfaceForLocal(state.getActivationToken());
       Collection<AbstractToken> argsCompletionFromParticipants =
           getCompletionsForTokenWithUndefinedTypeFromParticipants(
               state, localScope, interfaceForLocal);
       return argsCompletionFromParticipants;
     }
   }
   return getCompletionsForTokenWithUndefinedTypeFromParticipants(state, localScope, null);
 }
 /**
  * Get the completions based on the arguments received
  *
  * @param state this is the state used for the completion
  * @param localScope this is the scope we're currently on (may be null)
  */
 public static Collection<AbstractToken> getCompletionsForMethodParameter(
     CompletionState state, LocalScope localScope) {
   AbstractToken[] args = localScope.getLocalTokens(-1, -1, true); // only to get the args
   String activationToken = state.getActivationToken();
   String firstPart = FullRepIterable.getFirstPart(activationToken);
   for (AbstractToken token : args) {
     if (token.getRepresentation().equals(firstPart)) {
       Collection<AbstractToken> interfaceForLocal =
           localScope.getInterfaceForLocal(state.getActivationToken());
       Collection<AbstractToken> argsCompletionFromParticipants =
           getCompletionsForMethodParameterFromParticipants(state, localScope, interfaceForLocal);
       for (AbstractToken t : interfaceForLocal) {
         if (!t.getRepresentation().equals(state.getQualifier())) {
           argsCompletionFromParticipants.add(t);
         }
       }
       return argsCompletionFromParticipants;
     }
   }
   return new ArrayList<AbstractToken>();
 }