5516802142
From G3 bug ID: 116443331 The View Engine compiler crashes when it tries to compile a test in JIT mode that includes the d3-scale-chromatic library [1]. The d3 package initializes some arrays using the following pattern: ```js export var scheme = new Array(3).concat( "d8b365f5f5f55ab4ac", // ... more entries ).map(colors); ``` The stack trace from the crash is as follows: ``` TypeError: Cannot read property 'visitExpression' of undefined at ../../../third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts:505:39 at JitEmitterVisitor.AbstractEmitterVisitor.visitAllObjects third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=526 at JitEmitterVisitor.AbstractEmitterVisitor.visitAllExpressions third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=505 at JitEmitterVisitor.AbstractEmitterVisitor.visitLiteralArrayExpr third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=484 at LiteralArrayExpr.visitExpression third_party/javascript/angular2/rc/packages/compiler/src/output/output_ast.ts?l=791 at ../../../third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts:492:19 at JitEmitterVisitor.AbstractEmitterVisitor.visitAllObjects third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=526 at JitEmitterVisitor.AbstractEmitterVisitor.visitLiteralMapExpr third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=490 at LiteralMapExpr.visitExpression third_party/javascript/angular2/rc/packages/compiler/src/output/output_ast.ts?l=819 at ../../../third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts:505:39 at JitEmitterVisitor.AbstractEmitterVisitor.visitAllObjects third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=526 at JitEmitterVisitor.AbstractEmitterVisitor.visitAllExpressions third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=505 at JitEmitterVisitor.AbstractEmitterVisitor.visitInvokeFunctionExpr third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_emitter.ts?l=318 at JitEmitterVisitor.AbstractJsEmitterVisitor.visitInvokeFunctionExpr third_party/javascript/angular2/rc/packages/compiler/src/output/abstract_js_emitter.ts?l=112 at InvokeFunctionExpr.visitExpression third_party/javascript/angular2/rc/packages/compiler/src/output/output_ast.ts?l=440 ``` This is because the corresponding output AST for the array is of the form ```ts [ undefined, undefined, undefined, o.LiteralExpr, // ... ] ``` The output AST is clearly malformed and breaks the type representation of `LiteralArrayExpr` in which every entry is expected to be of type `Expression`. This commit fixes the bug by using a plain `for` loop to iterate over the entire length of the holey array and convert undefined elements to `LiteralExpr`. [1]: https://github.com/d3/d3-scale-chromatic/blob/master/src/diverging/BrBG.js PR Close #36343 |
||
---|---|---|
.circleci | ||
.devcontainer | ||
.github | ||
.vscode | ||
.yarn | ||
aio | ||
dev-infra | ||
docs | ||
goldens | ||
integration | ||
modules | ||
packages | ||
scripts | ||
third_party | ||
tools | ||
.bazelignore | ||
.bazelrc | ||
.bazelversion | ||
.clang-format | ||
.dev-infra.json | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.nvmrc | ||
.pullapprove.yml | ||
.yarnrc | ||
BUILD.bazel | ||
CHANGELOG.md | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
WORKSPACE | ||
browser-providers.conf.js | ||
gulpfile.js | ||
karma-js.conf.js | ||
package.json | ||
protractor-perf.conf.js | ||
shims_for_IE.js | ||
test-events.js | ||
test-main.js | ||
tslint.json | ||
yarn.lock | ||
yarn.lock.readme.md |
README.md
Angular
Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages.
Quickstart
Changelog
Learn about the latest improvements.
Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.