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

Various compiler refactorings #16832

Merged
merged 5 commits into from May 23, 2017
Merged

Various compiler refactorings #16832

merged 5 commits into from May 23, 2017

Conversation

tbosch
Copy link
Contributor

@tbosch tbosch commented May 16, 2017

…filePath.

The goal of this change is to simplify the emitters,
as we will soon create a new one to emit TypeScript nodes directly.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

What is the new behavior?

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[ ] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@@ -175,6 +176,25 @@ export class StaticSymbolResolver {
this.importAs.set(sourceSymbol, targetSymbol);
}

importExpr(containingFilePath: string, symbol: StaticSymbol, typeParams: o.Type[]|null = null): o.Expression {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove from here again!

@mary-poppins
Copy link

The angular.io preview for 3ff9442 is available here.

@tbosch tbosch force-pushed the output_ast branch 2 times, most recently from a7345ec to cc3dbfa Compare May 17, 2017 16:27
@mary-poppins
Copy link

The angular.io preview for cc3dbfa is available here.

stylesCompileResults.externalStylesheets.forEach((compiledStyleSheet) => {
generatedFiles.push(this._codgenStyles(srcFileUrl, compiledStyleSheet, fileSuffix));
const componentStylesheet = this._styleCompiler.compileComponent(outputCtx, compMeta);
compMeta.template !.externalStylesheets.forEach((stylesheetMeta) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider a comment for the non-null assert.

@mary-poppins
Copy link

The angular.io preview for e72c26b is available here.

export class GeneratedFile {
constructor(public srcFileUrl: string, public genFileUrl: string, public source: string) {}
constructor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't capture the constraint that either that one of source or stmts must be supplied but not both. Maybe this might be better:

  source: string | null;
  stmts: Statement[] | null;
  constructor(public srcFileUrl: string, public genFileUrl: string: src: string | Statement[]) {
    if (typeof src === 'string) {
      this.source = src;
      this.stmts = null;
    } else {
      this.source = null;
      this.stmts = src;
    }
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good point.

@mary-poppins
Copy link

The angular.io preview for 9ff389c is available here.

@tbosch tbosch added the action: merge The PR is ready for merge by the caretaker label May 17, 2017
@tbosch tbosch changed the title refactor(compiler): make OutputAst contain the moduleName, not the … Various compiler refactorings May 19, 2017
@tbosch tbosch removed the action: merge The PR is ready for merge by the caretaker label May 19, 2017
@mary-poppins
Copy link

The angular.io preview for 4bcf634 is available here.

@@ -436,11 +439,16 @@ class ViewBuilder implements TemplateAstVisitor, LocalResolver {
let queryMatchExprs: o.Expression[] = [];
ast.queryMatches.forEach((match) => {
let valueType: QueryValueType = undefined !;
if (tokenReference(match.value) === resolveIdentifier(Identifiers.ElementRef)) {
if (tokenReference(match.value) ===
this.reflector.resolveExternalReference(Identifiers.ElementRef)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we cache the values or relying on the reflector cache is good enough ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather rely on the cache for now to not change too many things.

import {LifecycleHooks as Hooks} from '@angular/core/src/metadata/lifecycle_hooks';

function hasLifecycleHook(hook: Hooks, directive: any): boolean {
return hasLifecycleHookImnpl(new JitReflector(), hook, directive);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo ? "Impl"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3rd commit LGTM- minor nits

@mary-poppins
Copy link

The angular.io preview for 982e995 is available here.

@mary-poppins
Copy link

The angular.io preview for 20cde8a is available here.

@tbosch
Copy link
Contributor Author

tbosch commented May 22, 2017

For the last 2 commits: see #16871

@tbosch tbosch changed the base branch from master to ngc May 22, 2017 23:09
@chuckjaz
Copy link
Contributor

This was closed due to deleting the ngc branch. Retarget to master to reopen.

@tbosch tbosch changed the base branch from ngc to master May 23, 2017 14:33
@tbosch tbosch reopened this May 23, 2017
@mary-poppins
Copy link

The angular.io preview for 20cde8a is available here.

…filePath (angular#16832).

The goal of this change is to simplify the emitters,
as we will soon create a new one to emit TypeScript nodes directly.
This is in preparation for creating typescript nodes
directly from `OutputAst` nodes.
Using the global reflector made it impossible
to compile multiple programs at the same time.
AOT compilation can be executed synchronously now,
if the `ReosurceLoader` returns a string directly
(and no `Promise`).
@chuckjaz chuckjaz merged commit 5af143e into angular:master May 23, 2017
chuckjaz pushed a commit that referenced this pull request May 23, 2017
…filePath (#16832).

The goal of this change is to simplify the emitters,
as we will soon create a new one to emit TypeScript nodes directly.
chuckjaz pushed a commit that referenced this pull request May 23, 2017
This is in preparation for creating typescript nodes
directly from `OutputAst` nodes.
chuckjaz pushed a commit that referenced this pull request May 23, 2017
Using the global reflector made it impossible
to compile multiple programs at the same time.
@mary-poppins
Copy link

The angular.io preview for c0b5a5a is available here.

asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
…filePath (angular#16832).

The goal of this change is to simplify the emitters,
as we will soon create a new one to emit TypeScript nodes directly.
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
This is in preparation for creating typescript nodes
directly from `OutputAst` nodes.
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
Using the global reflector made it impossible
to compile multiple programs at the same time.
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
AOT compilation can be executed synchronously now,
if the `ReosurceLoader` returns a string directly
(and no `Promise`).
@tbosch tbosch deleted the output_ast branch August 14, 2017 16:50
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
…filePath (angular#16832).

The goal of this change is to simplify the emitters,
as we will soon create a new one to emit TypeScript nodes directly.
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
This is in preparation for creating typescript nodes
directly from `OutputAst` nodes.
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
Using the global reflector made it impossible
to compile multiple programs at the same time.
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
AOT compilation can be executed synchronously now,
if the `ReosurceLoader` returns a string directly
(and no `Promise`).
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants