Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the way we optimize and remove on compile #49

Closed
zazoomauro opened this issue Apr 13, 2017 · 0 comments
Closed

Refactor the way we optimize and remove on compile #49

zazoomauro opened this issue Apr 13, 2017 · 0 comments
Milestone

Comments

@zazoomauro
Copy link
Owner

Instead of:

// optimize
if (this._compilerPass[PassConfig.TYPE_OPTIMIZE].length > 0) {
  this._processCompilerPass(PassConfig.TYPE_OPTIMIZE)
} else {
  for (let [id, definition] of this._definitions) {
    if (!this._container.get(id) && !definition.lazy) {
      let instance = this._getInstanceFromDefinition(definition)
      this._container.set(id, instance)
    }
  }
  this._frozen = true
}

// remove
if (this._compilerPass[PassConfig.TYPE_REMOVE].length > 0) {
  this._processCompilerPass(PassConfig.TYPE_REMOVE)
} else {
  for (let [id, definition] of this._definitions) {
    if (definition.public === false) {
      this._container.delete(id)
    }
  }
}

add this code to default proper compiler pass class and add it by default in to the compiler.
So create

  • CompilerPass/OptimizePass
  • CompilerPass/RemovePass
@zazoomauro zazoomauro added this to the 1.9 milestone Apr 13, 2017
zazoomauro pushed a commit that referenced this issue Apr 13, 2017
* refactoring compile optimization
* refactoring compile removal
* getInstanceFromDefinition is now public
* adding container builder remove method
* adding container builder isSet method
zazoomauro added a commit that referenced this issue May 22, 2017
* resolves #49

* refactoring compile optimization
* refactoring compile removal
* getInstanceFromDefinition is now public
* adding container builder remove method
* adding container builder isSet method

* resolves #33 - Order when controlling the Pass Ordering

* adding priority compiler pass argument

* resolves #46

* new decorator compiler pass to handle all the definition decorator logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant