Skip to content

Commit 804b2f4

Browse files
committed
90c87fa fix(codegen): stringify using an opaque ID when toString contains parens.
1 parent dfc7d53 commit 804b2f4

15 files changed

Lines changed: 221 additions & 39 deletions

BUILD_INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Wed Mar 30 23:41:07 UTC 2016
2-
291928feb1b1eebe6d3f9fcdb4ae64c3824f68f7
1+
Thu Mar 31 00:14:32 UTC 2016
2+
90c87fa6ad4da8ae32b66c42349e54981ec57429

bundles/angular2-all-testing.umd.dev.js

Lines changed: 20 additions & 3 deletions
Large diffs are not rendered by default.

bundles/angular2-all.umd.dev.js

Lines changed: 20 additions & 3 deletions
Large diffs are not rendered by default.

bundles/angular2-all.umd.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28536,7 +28536,24 @@ return /******/ (function(modules) { // webpackBootstrap
2853628536
this._platformPipes = _platformPipes;
2853728537
this._directiveCache = new Map();
2853828538
this._pipeCache = new Map();
28539+
this._anonymousTypes = new Map();
28540+
this._anonymousTypeIndex = 0;
2853928541
}
28542+
/**
28543+
* Wrap the stringify method to avoid naming things `function (arg1...) {`
28544+
*/
28545+
RuntimeMetadataResolver.prototype.sanitizeName = function (obj) {
28546+
var result = lang_1.stringify(obj);
28547+
if (result.indexOf('(') < 0) {
28548+
return result;
28549+
}
28550+
var found = this._anonymousTypes.get(obj);
28551+
if (!found) {
28552+
this._anonymousTypes.set(obj, this._anonymousTypeIndex++);
28553+
found = this._anonymousTypes.get(obj);
28554+
}
28555+
return "anonymous_type_" + found + "_";
28556+
};
2854028557
RuntimeMetadataResolver.prototype.getDirectiveMetadata = function (directiveType) {
2854128558
var meta = this._directiveCache.get(directiveType);
2854228559
if (lang_1.isBlank(meta)) {
@@ -28564,7 +28581,7 @@ return /******/ (function(modules) { // webpackBootstrap
2856428581
exportAs: dirMeta.exportAs,
2856528582
isComponent: lang_1.isPresent(templateMeta),
2856628583
dynamicLoadable: true,
28567-
type: new cpl.CompileTypeMetadata({ name: lang_1.stringify(directiveType), moduleUrl: moduleUrl, runtime: directiveType }),
28584+
type: new cpl.CompileTypeMetadata({ name: this.sanitizeName(directiveType), moduleUrl: moduleUrl, runtime: directiveType }),
2856828585
template: templateMeta,
2856928586
changeDetection: changeDetectionStrategy,
2857028587
inputs: dirMeta.inputs,
@@ -28582,7 +28599,7 @@ return /******/ (function(modules) { // webpackBootstrap
2858228599
var pipeMeta = this._pipeResolver.resolve(pipeType);
2858328600
var moduleUrl = reflection_1.reflector.importUri(pipeType);
2858428601
meta = new cpl.CompilePipeMetadata({
28585-
type: new cpl.CompileTypeMetadata({ name: lang_1.stringify(pipeType), moduleUrl: moduleUrl, runtime: pipeType }),
28602+
type: new cpl.CompileTypeMetadata({ name: this.sanitizeName(pipeType), moduleUrl: moduleUrl, runtime: pipeType }),
2858628603
name: pipeMeta.name,
2858728604
pure: pipeMeta.pure
2858828605
});

bundles/angular2-all.umd.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundles/angular2.dev.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23072,7 +23072,21 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2307223072
this._platformPipes = _platformPipes;
2307323073
this._directiveCache = new Map();
2307423074
this._pipeCache = new Map();
23075+
this._anonymousTypes = new Map();
23076+
this._anonymousTypeIndex = 0;
2307523077
}
23078+
RuntimeMetadataResolver.prototype.sanitizeName = function(obj) {
23079+
var result = lang_1.stringify(obj);
23080+
if (result.indexOf('(') < 0) {
23081+
return result;
23082+
}
23083+
var found = this._anonymousTypes.get(obj);
23084+
if (!found) {
23085+
this._anonymousTypes.set(obj, this._anonymousTypeIndex++);
23086+
found = this._anonymousTypes.get(obj);
23087+
}
23088+
return "anonymous_type_" + found + "_";
23089+
};
2307623090
RuntimeMetadataResolver.prototype.getDirectiveMetadata = function(directiveType) {
2307723091
var meta = this._directiveCache.get(directiveType);
2307823092
if (lang_1.isBlank(meta)) {
@@ -23101,7 +23115,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2310123115
isComponent: lang_1.isPresent(templateMeta),
2310223116
dynamicLoadable: true,
2310323117
type: new cpl.CompileTypeMetadata({
23104-
name: lang_1.stringify(directiveType),
23118+
name: this.sanitizeName(directiveType),
2310523119
moduleUrl: moduleUrl,
2310623120
runtime: directiveType
2310723121
}),
@@ -23125,7 +23139,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2312523139
var moduleUrl = reflection_1.reflector.importUri(pipeType);
2312623140
meta = new cpl.CompilePipeMetadata({
2312723141
type: new cpl.CompileTypeMetadata({
23128-
name: lang_1.stringify(pipeType),
23142+
name: this.sanitizeName(pipeType),
2312923143
moduleUrl: moduleUrl,
2313023144
runtime: pipeType
2313123145
}),

bundles/angular2.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23072,7 +23072,21 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2307223072
this._platformPipes = _platformPipes;
2307323073
this._directiveCache = new Map();
2307423074
this._pipeCache = new Map();
23075+
this._anonymousTypes = new Map();
23076+
this._anonymousTypeIndex = 0;
2307523077
}
23078+
RuntimeMetadataResolver.prototype.sanitizeName = function(obj) {
23079+
var result = lang_1.stringify(obj);
23080+
if (result.indexOf('(') < 0) {
23081+
return result;
23082+
}
23083+
var found = this._anonymousTypes.get(obj);
23084+
if (!found) {
23085+
this._anonymousTypes.set(obj, this._anonymousTypeIndex++);
23086+
found = this._anonymousTypes.get(obj);
23087+
}
23088+
return "anonymous_type_" + found + "_";
23089+
};
2307623090
RuntimeMetadataResolver.prototype.getDirectiveMetadata = function(directiveType) {
2307723091
var meta = this._directiveCache.get(directiveType);
2307823092
if (lang_1.isBlank(meta)) {
@@ -23101,7 +23115,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2310123115
isComponent: lang_1.isPresent(templateMeta),
2310223116
dynamicLoadable: true,
2310323117
type: new cpl.CompileTypeMetadata({
23104-
name: lang_1.stringify(directiveType),
23118+
name: this.sanitizeName(directiveType),
2310523119
moduleUrl: moduleUrl,
2310623120
runtime: directiveType
2310723121
}),
@@ -23125,7 +23139,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2312523139
var moduleUrl = reflection_1.reflector.importUri(pipeType);
2312623140
meta = new cpl.CompilePipeMetadata({
2312723141
type: new cpl.CompileTypeMetadata({
23128-
name: lang_1.stringify(pipeType),
23142+
name: this.sanitizeName(pipeType),
2312923143
moduleUrl: moduleUrl,
2313023144
runtime: pipeType
2313123145
}),

bundles/angular2.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundles/web_worker/ui.dev.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15458,7 +15458,21 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
1545815458
this._platformPipes = _platformPipes;
1545915459
this._directiveCache = new Map();
1546015460
this._pipeCache = new Map();
15461+
this._anonymousTypes = new Map();
15462+
this._anonymousTypeIndex = 0;
1546115463
}
15464+
RuntimeMetadataResolver.prototype.sanitizeName = function(obj) {
15465+
var result = lang_1.stringify(obj);
15466+
if (result.indexOf('(') < 0) {
15467+
return result;
15468+
}
15469+
var found = this._anonymousTypes.get(obj);
15470+
if (!found) {
15471+
this._anonymousTypes.set(obj, this._anonymousTypeIndex++);
15472+
found = this._anonymousTypes.get(obj);
15473+
}
15474+
return "anonymous_type_" + found + "_";
15475+
};
1546215476
RuntimeMetadataResolver.prototype.getDirectiveMetadata = function(directiveType) {
1546315477
var meta = this._directiveCache.get(directiveType);
1546415478
if (lang_1.isBlank(meta)) {
@@ -15487,7 +15501,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
1548715501
isComponent: lang_1.isPresent(templateMeta),
1548815502
dynamicLoadable: true,
1548915503
type: new cpl.CompileTypeMetadata({
15490-
name: lang_1.stringify(directiveType),
15504+
name: this.sanitizeName(directiveType),
1549115505
moduleUrl: moduleUrl,
1549215506
runtime: directiveType
1549315507
}),
@@ -15511,7 +15525,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
1551115525
var moduleUrl = reflection_1.reflector.importUri(pipeType);
1551215526
meta = new cpl.CompilePipeMetadata({
1551315527
type: new cpl.CompileTypeMetadata({
15514-
name: lang_1.stringify(pipeType),
15528+
name: this.sanitizeName(pipeType),
1551515529
moduleUrl: moduleUrl,
1551615530
runtime: pipeType
1551715531
}),

bundles/web_worker/worker.dev.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26505,7 +26505,21 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2650526505
this._platformPipes = _platformPipes;
2650626506
this._directiveCache = new Map();
2650726507
this._pipeCache = new Map();
26508+
this._anonymousTypes = new Map();
26509+
this._anonymousTypeIndex = 0;
2650826510
}
26511+
RuntimeMetadataResolver.prototype.sanitizeName = function(obj) {
26512+
var result = lang_1.stringify(obj);
26513+
if (result.indexOf('(') < 0) {
26514+
return result;
26515+
}
26516+
var found = this._anonymousTypes.get(obj);
26517+
if (!found) {
26518+
this._anonymousTypes.set(obj, this._anonymousTypeIndex++);
26519+
found = this._anonymousTypes.get(obj);
26520+
}
26521+
return "anonymous_type_" + found + "_";
26522+
};
2650926523
RuntimeMetadataResolver.prototype.getDirectiveMetadata = function(directiveType) {
2651026524
var meta = this._directiveCache.get(directiveType);
2651126525
if (lang_1.isBlank(meta)) {
@@ -26534,7 +26548,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2653426548
isComponent: lang_1.isPresent(templateMeta),
2653526549
dynamicLoadable: true,
2653626550
type: new cpl.CompileTypeMetadata({
26537-
name: lang_1.stringify(directiveType),
26551+
name: this.sanitizeName(directiveType),
2653826552
moduleUrl: moduleUrl,
2653926553
runtime: directiveType
2654026554
}),
@@ -26558,7 +26572,7 @@ System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di
2655826572
var moduleUrl = reflection_1.reflector.importUri(pipeType);
2655926573
meta = new cpl.CompilePipeMetadata({
2656026574
type: new cpl.CompileTypeMetadata({
26561-
name: lang_1.stringify(pipeType),
26575+
name: this.sanitizeName(pipeType),
2656226576
moduleUrl: moduleUrl,
2656326577
runtime: pipeType
2656426578
}),

0 commit comments

Comments
 (0)