d3f96015f1
* Allow JSContainers to merge with namespaces Expando functions marked with JSContainer previously failed to merge with namespaces. This change adds JSContainer to ValueModuleExcludes, allowing this kind of merge. * Improve symbol flags to fix namespace/expando merging Calls to bindPropertyAssignment now provide which special assignment kind they originated from. This allows better symbol flags to be set: 1. Property assignments get the FunctionScopedVariable flag, since they are equivalent to a `namespace` exporting a `var`. 2. Prototype property assignments get the Method flag if the initialiser is functionlike, and Property otherwise. 3. Prototype assignments get the flag Property. (3) is still not entirely correct (it's missing the Prototype flag), but is what existed previously. I'll try adding the Prototype flag to see whether it changes any baselines. * Add cross-file merge test * Update missed baselines * Namespace declarations are primary for merging purposes Also, property-assignments go back to being property declarations, not function-scoped variable declarations * Revert unneeded changes * Revert unneeded changes (in a codefix this time) * Put JSContainer on all assignment declarations This allows most of the new special-case merge code to go away. It now uses the JSContainer special-case code, which already exists. * Missed comment * Fix extra newline lint
29 lines
811 B
TypeScript
29 lines
811 B
TypeScript
// @Filename: expando.ts
|
|
function ExpandoMerge(n: number) {
|
|
return n;
|
|
}
|
|
ExpandoMerge.p1 = 111
|
|
ExpandoMerge.m = function(n: number) {
|
|
return n + 1;
|
|
}
|
|
ExpandoMerge.p4 = 44444;
|
|
ExpandoMerge.p5 = 555555;
|
|
ExpandoMerge.p6 = 66666;
|
|
ExpandoMerge.p7 = 777777;
|
|
ExpandoMerge.p8 = false; // type error
|
|
ExpandoMerge.p9 = false; // type error
|
|
var n = ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001);
|
|
|
|
// @Filename: ns.ts
|
|
namespace ExpandoMerge {
|
|
export var p3 = 333;
|
|
export var p4 = 4;
|
|
export var p5 = 5;
|
|
export let p6 = 6;
|
|
export let p7 = 7;
|
|
export var p8 = 6;
|
|
export let p9 = 7;
|
|
}
|
|
namespace ExpandoMerge {
|
|
export var p2 = 222;
|
|
}
|