Example #1
0
static bool print_selector_with_arguments(prettyPrintStream*       output, 
                                          symbolOop                selector,
                                          GrowableArray<astNode*>* arguments,
                                          bool                     split) {
  if (selector->is_binary()) {
    // binary send
    output->print(selector->as_string());
    output->space();
    astNode* arg = arguments->at(0);
    bool wrap = should_wrap(1, arg);
    if (wrap) output->print("(");
    bool result = arg->print(output);
    if (wrap) output->print(")");
    return result;
  }

  int arg = arguments->length();

  if (arg == 0) {
    output->print(selector->as_string());
    return false;
  }

  for (int index = 1; index <= selector->length(); index++) {
    int c = selector->byte_at(index);
    output->print_char(c);
    if (c == ':') {
      output->space();
      astNode* a = arguments->at(--arg);
      bool wrap = should_wrap(2, a);
      if (wrap) output->print("(");
      a->print(output); 
      if (wrap) output->print(")");
         
      if (index < selector->length()) {
      	if (split) output->newline();
        else       output->space();
      }
    }
  }
  return split;
}
Example #2
0
 void checkMarkedSymbol(char* message, oop result, symbolOop expected) {
   ResourceMark rm;
   char text[200];
   ASSERT_TRUE_M(result->is_mark(), "Should be marked");
   sprintf(text,
           "%s. Should be: %s, was: %s",
           message,
           expected->as_string(),
           unmarkSymbol(result)->as_string());
   ASSERT_TRUE_M(unmarkSymbol(result) == expected, text);
 }