const Context = require('../semantics/context');

module.exports = class Program {
  constructor(statements) {
    this.statements = statements;
  }

  analyze(context = Context.INITIAL) {
    this.statements.forEach(s => s.analyze(context));
  }

  optimize() {
    this.statements.forEach(s => s.optimize()).filter(s => s !== null);
    return this;
  }
};

const Context = require('../semantics/context');

module.exports = class Program {
  constructor(statements) {
    this.statements = statements;
  }

  analyze() {
    const context = new Context({ parent: Context.INITIAL });
    this.statements.forEach(s => s.analyze(context));
  }

  optimize() {
    this.statements.forEach(s => s.optimize()).filter(s => s !== null);
    return this;
  }
};

Stop initial context from being shared between test cases
Stop initial context from being shared between test cases
