Example #1
0
void UmlClass::importFormals(File & f) {
  f.read("(");
  f.read("list");
  f.read("Parameters");
  
  Q3CString s;
  unsigned rank = 0;
  
  for (;;) {
    switch (f.read(s)) {
    case ')':
      return;
    case '(':
      {
	UmlFormalParameter p;
	
	p.import(f, scanning);
	if (scanning)
	  addFormal(rank++, p);
	else
	  replaceFormal(rank++, p);
      }
      break;
    default:
      f.syntaxError(s, "(");
    }
  }
}
Example #2
0
void UmlClass::readFormal(FileIn & in, Token & token)
{
    if (! token.closed()) {
        signatures[token.xmiId()] = this;

        WrapperStr k = token.what();
        const char * kstr = k;
        unsigned int rank = 0;

        while (in.read(), !token.close(kstr)) {
            WrapperStr s = token.what();

            if (s == "parameter") {
                // useless
                if (! token.closed())
                    in.finish(token.what());
            }
            else if ((s == "ownedparameter") &&
                     (token.xmiType() == "uml:ClassifierTemplateParameter")) {
                WrapperStr idparam = token.xmiId();
                WrapperStr pname = token.valueOf("name");	// at least for VP
                WrapperStr value;

                if (! token.closed()) {
                    while (in.read(), !token.close("ownedparameter")) {
                        s = token.what();

                        if ((s == "ownedparameteredelement") ||
                            (s == "ownedelement")) {
                            s = token.valueOf("name");

                            if (! s.isEmpty())
                                pname = s;
                        }
                        else if (s == "defaultvalue")
                            value = token.valueOf("value");

                        if (! token.closed())
                            in.finish(token.what());
                    }
                }

                if (! pname.isEmpty()) {
                    UmlFormalParameter f(pname, value);

                    addFormal(rank++, f);
                    formalsId.append(idparam);
                }
            }
            else if (! token.closed())
                in.finish(token.what());
        }
    }
}
Example #3
0
void ReturnByRef::transformFunction(FnSymbol* fn)
{
  ArgSymbol* formal = addFormal(fn);

  insertAssignmentToFormal(fn, formal);
  updateAssignmentsFromRefArgToValue(fn);
  updateAssignmentsFromRefTypeToValue(fn);
  updateAssignmentsFromModuleLevelValue(fn);
  updateReturnStatement(fn);
  updateReturnType(fn);
}