Esempio n. 1
0
  int Def::drive(State& S, int t) {
    S.push(SELF);
    S.push(t);

    S.push(LOADS);
    S.push(t+1);
    S.push(S.string(name_));

    ast::State subS(S.MS, S.lm());

    int r = body_->drive(subS, args_.size() + body_->locals().size());
    subS.push(RET);
    subS.push(r);

    S.push(LOADC);
    S.push(t+2);
    S.push(S.code(subS.to_code(name_, args_, body_->cov())));

    S.push(CALL);
    S.push(t);
    S.push(S.string(String::internalize(S.MS, "add_method")));
    S.push(t);
    S.push(2);

    return t;
  }
Esempio n. 2
0
  int Lambda::drive(State& S, int t) {
    ast::State subS(S.MS, S.lm());

    int r = body_->drive(subS, body_->locals().size());

    subS.push(RET);
    subS.push(r);

    ArgMap args;

    S.push(LOADC);
    S.push(t);
    S.push(S.code(subS.to_code(String::internalize(S.MS, "__lambda__"),
                               args, body_->cov())));

    return t;
  }
Esempio n. 3
0
  int Class::drive(State& S, int t) {
    super_->drive(S, t);

    int si = S.string(name_);

    S.push(LOADS);
    S.push(t+1);
    S.push(si);

    S.push(CALL);
    S.push(t);
    S.push(S.string(String::internalize(S.MS, "new_subclass")));
    S.push(t);
    S.push(1);

    S.push(IVA);
    S.push(si);
    S.push(t);

    Local* l = S.lm().get(body_);
    assert(l);

    S.set_local(l, t);

    ast::State subS(S.MS, S.lm());
    int r = body_->drive(subS, body_->locals().size());
    subS.push(RET);
    subS.push(r);

    ArgMap args;

    S.push(LOADC);
    S.push(t+1);
    S.push(S.code(subS.to_code(String::internalize(S.MS, "__body__"),
                               args, body_->cov())));

    S.push(CALL);
    S.push(t);
    S.push(S.string(String::internalize(S.MS, "run_body")));
    S.push(t);
    S.push(1);

    return t;
  }
Esempio n. 4
0
void Tempo::sub(Tempo* tempo){
	subH(tempo->getHoras());
	subM(tempo->getMinutos());
	subS(tempo->getSegundos());
}