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

[BUGFIX] Rename the set placeholder helper #6

Merged
merged 1 commit into from
Sep 5, 2019
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
Expand Up @@ -18,8 +18,8 @@ export class Placeholder {
}
}

function __placeholder__() {
function setPlaceholder() {
return new Placeholder(null);
}

export default helper(__placeholder__);
export default helper(setPlaceholder);
2 changes: 1 addition & 1 deletion addon/helpers/set.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { helper } from '@ember/component/helper';
import { assert } from '@ember/debug';
import { get, set as emberSet } from '@ember/object';
import { Placeholder } from './__placeholder__';
import { Placeholder } from './-set-placeholder';

function set(positional) {
let [target, key, valueOrPlaceholder] = positional;
Expand Down
1 change: 1 addition & 0 deletions app/helpers/-set-placeholder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-set-helper/helpers/-set-placeholder';
1 change: 0 additions & 1 deletion app/helpers/__placeholder__.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {

setupPreprocessorRegistry(type, registry) {
registry.add('htmlbars-ast-plugin', {
name: 'bind',
name: 'set-placeholder',
plugin: require('./lib/set-placeholder-transform'),
baseDir() {
return __dirname;
Expand Down
6 changes: 3 additions & 3 deletions lib/set-placeholder-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
becomes

```hbs
{{set this "bar" (__placeholder__)}}
{{set this.bar "baz" (get (__placeholder__) "qux")}}
{{set this "bar" (-set-placeholder)}}
{{set this.bar "baz" (get (-set-placeholder) "qux")}}
```
*/

Expand All @@ -22,7 +22,7 @@ module.exports = class SetPlaceholderTransform {
function recursivelyReplacePlaceholders(expr) {
expr.params = expr.params.map(node => {
if (node.type === 'PathExpression' && node.original === '_') {
return b.sexpr('__placeholder__');
return b.sexpr('-set-placeholder');
}

if (node.type === 'SubExpression') {
Expand Down