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

bug repro: Association does not happen #109

Merged
merged 3 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
["@glimmer/babel-preset", { "isDebug": true }]
["@glimmerx/babel-preset", { "isDebug": true }]
]
}
9 changes: 4 additions & 5 deletions packages/@glimmerx/babel-preset/test/fixtures/debug/code.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DEBUG } from '@glimmer/env';
import { assert, deprecate } from '@glimmer/debug';
import { precompileTemplate } from '@glimmer/core';
import { tracked } from '@glimmer/tracking';
import { tracked } from '@glimmerx/tracking';
import Component, { hbs } from '@glimmerx/component';

if (DEBUG) {
console.log('DEBUG!');
Expand All @@ -11,12 +11,11 @@ assert(true, 'is true');
deprecate('this is deprecated', false, { id: 'foo' });


class Test {
export default class Test extends Component {
@tracked bar = 123;
static template = hbs`Hello World`;

#cantTouchThis = 'mc hammer';

#hammerTime() {}
}

precompileTemplate('Hello, world!', { strictMode: true, scope: { Test } });
38 changes: 21 additions & 17 deletions packages/@glimmerx/babel-preset/test/fixtures/debug/output.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var _class, _descriptor, _cantTouchThis, _hammerTime;

import { createTemplateFactory as _createTemplateFactory } from "@glimmer/core";

function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
Expand All @@ -10,8 +8,11 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con

function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }

import { setComponentTemplate as _setComponentTemplate } from "@glimmer/core";
import { createTemplateFactory as _createTemplateFactory } from "@glimmer/core";
import { assert, deprecate } from '@glimmer/debug';
import { tracked } from '@glimmer/tracking';
import { tracked } from '@glimmerx/tracking';
import Component from '@glimmerx/component';

if (true
/* DEBUG */
Expand All @@ -23,8 +24,21 @@ if (true
(true && !(false) && deprecate('this is deprecated', false, {
id: 'foo'
}));
let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test {
constructor() {

let Test = _setComponentTemplate(_createTemplateFactory(
/*
Hello World
*/
{
"id": null,
"block": "[[[1,\"Hello World\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
}), (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test extends Component {
constructor(...args) {
super(...args);

_hammerTime.add(this);

_initializerDefineProperty(this, "bar", _descriptor, this);
Expand All @@ -42,18 +56,8 @@ let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(
initializer: function () {
return 123;
}
})), _class);
})), _class));

function _hammerTime2() {}

_createTemplateFactory(
/*
Hello, world!
*/
{
"id": null,
"block": "[[[1,\"Hello, world!\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
});
export { Test as default };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
["@glimmer/babel-preset", { "isDebug": false }]
["@glimmerx/babel-preset", { "isDebug": false }]
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DEBUG } from '@glimmer/env';
import { assert, deprecate } from '@glimmer/debug';
import { precompileTemplate } from '@glimmer/core';
import { tracked } from '@glimmer/tracking';
import { tracked } from '@glimmerx/tracking';
import Component, { hbs } from '@glimmerx/component';

if (DEBUG) {
console.log('DEBUG!');
Expand All @@ -11,12 +11,11 @@ assert(true, 'is true');
deprecate('this is deprecated', false, { id: 'foo' });


class Test {
export default class Test extends Component {
@tracked bar = 123;
static template = hbs`Hello World`;

#cantTouchThis = 'mc hammer';

#hammerTime() {}
}

precompileTemplate('Hello, world!', { strictMode: true, scope: { Test } });
38 changes: 21 additions & 17 deletions packages/@glimmerx/babel-preset/test/fixtures/production/output.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var _class, _descriptor, _cantTouchThis, _hammerTime;

import { createTemplateFactory as _createTemplateFactory } from "@glimmer/core";

function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
Expand All @@ -10,8 +8,11 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con

function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }

import { setComponentTemplate as _setComponentTemplate } from "@glimmer/core";
import { createTemplateFactory as _createTemplateFactory } from "@glimmer/core";
import { assert, deprecate } from '@glimmer/debug';
import { tracked } from '@glimmer/tracking';
import { tracked } from '@glimmerx/tracking';
import Component from '@glimmerx/component';

if (false
/* DEBUG */
Expand All @@ -23,8 +24,21 @@ if (false
(false && !(false) && deprecate('this is deprecated', false, {
id: 'foo'
}));
let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test {
constructor() {

let Test = _setComponentTemplate(_createTemplateFactory(
/*
Hello World
*/
{
"id": null,
"block": "[[[1,\"Hello World\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
}), (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test extends Component {
constructor(...args) {
super(...args);

_hammerTime.add(this);

_initializerDefineProperty(this, "bar", _descriptor, this);
Expand All @@ -42,18 +56,8 @@ let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(
initializer: function () {
return 123;
}
})), _class);
})), _class));

function _hammerTime2() {}

_createTemplateFactory(
/*
Hello, world!
*/
{
"id": null,
"block": "[[[1,\"Hello, world!\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
});
export { Test as default };