From fc331708ddef3e3ddb79cdc58b948d00c316654e Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Mon, 28 Jan 2019 20:21:27 -0500 Subject: [PATCH] add kind: implicit --- src/compile/Component.ts | 2 +- src/interfaces.ts | 2 +- test/stats/samples/implicit/_config.js | 16 ++++++++++++++++ test/stats/samples/implicit/input.html | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/stats/samples/implicit/_config.js create mode 100644 test/stats/samples/implicit/input.html diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 49cb51d691..a5b2325a19 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -166,7 +166,7 @@ export default class Component { this.add_var({ name, export_name: name, - kind: 'injected', + kind: 'implicit', mutated: true, referenced: true, writable: true diff --git a/src/interfaces.ts b/src/interfaces.ts index 1ebc55b5ff..22ec26aa09 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -81,7 +81,7 @@ export interface AppendTarget { export interface Var { name: string; - kind: 'let' | 'var' | 'const' | 'class' | 'function' | 'import' | 'injected' | 'global'; + kind: 'let' | 'var' | 'const' | 'class' | 'function' | 'import' | 'injected' | 'global' | 'implicit'; import_name?: '*' | 'default' | string; // the `foo` in `import { foo as bar }` export_name?: string; // the `bar` in `export { foo as bar }` source?: string; diff --git a/test/stats/samples/implicit/_config.js b/test/stats/samples/implicit/_config.js new file mode 100644 index 0000000000..df9f74e47e --- /dev/null +++ b/test/stats/samples/implicit/_config.js @@ -0,0 +1,16 @@ +export default { + test(assert, stats) { + assert.deepEqual(stats.vars, [ + { + name: 'foo', + kind: 'implicit', + import_name: null, + export_name: 'foo', + source: null, + referenced: true, + module: false, + mutated: true + } + ]); + }, +}; diff --git a/test/stats/samples/implicit/input.html b/test/stats/samples/implicit/input.html new file mode 100644 index 0000000000..e076ac55f8 --- /dev/null +++ b/test/stats/samples/implicit/input.html @@ -0,0 +1 @@ +{foo} \ No newline at end of file