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

Remove get ast node #88

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ Object Matching, Shorthand Notation

Intuitive and flexible destructuring of Objects into individual variables during assignment.

6| var |{ op, lhs, rhs }| = getASTNode();
6| var |{ op, lhs, rhs }| = { op: (left, right) => left + right, lhs: 1, rhs: 2 };

5| var |tmp| = getASTNode();
5| var |tmp| = { op: (left, right) => left + right, lhs: 1, rhs: 2 };
5| var |op = tmp.op|;
5| var |lhs = tmp.lhs|;
5| var |rhs = tmp.rhs|;
Expand All @@ -473,9 +473,10 @@ Object Matching, Deep Matching

Intuitive and flexible destructuring of Objects into individual variables during assignment.

6| var { op: a, |lhs: { op: b }|, rhs: c } = getASTNode();
6| var { op: a, |lhs: { op: b }|, rhs: c } = { op: (left, right) => left + right, |lhs: { op: (left, right) => left - right, lhs: 10, rhs: 10 }|, rhs: 2 };

5| var tmp = getASTNode();
5| var tmp = { op: (left, right) => left + right, lhs: { op: (left, right) => left - right, lhs: 10, rhs: 10 }, rhs: 2
};
5| var a = tmp.op;
5| var |b = tmp.lhs.op|;
5| var c = tmp.rhs;
Expand Down
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -830,14 +830,14 @@
<div class="desc">Intuitive and flexible destructuring of Objects into individual variables during assignment.</div>
<div class="js es6">
<div class="title"><b>ECMAScript 6</b> &mdash; syntactic sugar: <span class="style reduced">reduced</span> | <span class="style traditional">traditional</span></div>
<div class="code"><span class="keyword">var</span> <span class="mark"><span class="punctuation">{</span> op<span class="punctuation">,</span> lhs<span class="punctuation">,</span> rhs <span class="punctuation">}</span></span><span class="punctuation"> = </span>getASTNode<span class="punctuation">(</span><span class="punctuation">)</span><span class="semi">;</span>
<div class="code"><span class="keyword">var</span> <span class="mark"><span class="punctuation">{</span> op<span class="punctuation">,</span> lhs<span class="punctuation">,</span> rhs <span class="punctuation">}</span></span><span class="punctuation"> = </span><span class="punctuation">{</span> op: <span class="punctuation">(</span>left<span class="punctuation">,</span> right<span class="punctuation">)</span> <span class="punctuation">=&gt;</span> left <span class="punctuation">+</span> right<span class="punctuation">,</span> lhs: <span class="literal">1</span><span class="punctuation">,</span> rhs: <span class="literal">2</span> <span class="punctuation">}</span><span class="semi">;</span>
</div>
<i class="icon fa fa-circle"></i>
<i class="icon fa fa-check-circle"></i>
</div>
<div class="arrow"><i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></div><div class="js es5">
<div class="title"><b>ECMAScript 5</b> &mdash; syntactic sugar: <span class="style reduced">reduced</span> | <span class="style traditional">traditional</span></div>
<div class="code"><span class="keyword">var</span> <span class="mark">tmp</span><span class="punctuation"> = </span>getASTNode<span class="punctuation">(</span><span class="punctuation">)</span><span class="semi">;</span>
<div class="code"><span class="keyword">var</span> <span class="mark">tmp</span><span class="punctuation"> = </span><span class="punctuation">{</span> op: <span class="punctuation">(</span>left<span class="punctuation">,</span> right<span class="punctuation">)</span> <span class="punctuation">=&gt;</span> left <span class="punctuation">+</span> right<span class="punctuation">,</span> lhs: <span class="literal">1</span><span class="punctuation">,</span> rhs: <span class="literal">2</span> <span class="punctuation">}</span><span class="semi">;</span>
<span class="keyword">var</span> <span class="mark">op <span class="punctuation"> = </span>tmp<span class="punctuation">.</span>op</span><span class="semi">;</span>
<span class="keyword">var</span> <span class="mark">lhs<span class="punctuation"> = </span>tmp<span class="punctuation">.</span>lhs</span><span class="semi">;</span>
<span class="keyword">var</span> <span class="mark">rhs<span class="punctuation"> = </span>tmp<span class="punctuation">.</span>rhs</span><span class="semi">;</span></div>
Expand All @@ -850,14 +850,15 @@
<div class="desc">Intuitive and flexible destructuring of Objects into individual variables during assignment.</div>
<div class="js es6">
<div class="title"><b>ECMAScript 6</b> &mdash; syntactic sugar: <span class="style reduced">reduced</span> | <span class="style traditional">traditional</span></div>
<div class="code"><span class="keyword">var</span> <span class="punctuation">{</span> op: a<span class="punctuation">,</span> <span class="mark">lhs: <span class="punctuation">{</span> op: b <span class="punctuation">}</span></span><span class="punctuation">,</span> rhs: c <span class="punctuation">}</span><span class="punctuation"> = </span>getASTNode<span class="punctuation">(</span><span class="punctuation">)</span><span class="semi">;</span>
<div class="code"><span class="keyword">var</span> <span class="punctuation">{</span> op: a<span class="punctuation">,</span> <span class="mark">lhs: <span class="punctuation">{</span> op: b <span class="punctuation">}</span></span><span class="punctuation">,</span> rhs: c <span class="punctuation">}</span><span class="punctuation"> = </span><span class="punctuation">{</span> op: <span class="punctuation">(</span>left<span class="punctuation">,</span> right<span class="punctuation">)</span> <span class="punctuation">=&gt;</span> left <span class="punctuation">+</span> right<span class="punctuation">,</span> <span class="mark">lhs: <span class="punctuation">{</span> op: <span class="punctuation">(</span>left<span class="punctuation">,</span> right<span class="punctuation">)</span> <span class="punctuation">=&gt;</span> left <span class="punctuation">-</span> right<span class="punctuation">,</span> lhs: <span class="literal">10</span><span class="punctuation">,</span> rhs: <span class="literal">10</span> <span class="punctuation">}</span></span><span class="punctuation">,</span> rhs: <span class="literal">2</span> <span class="punctuation">}</span><span class="semi">;</span>
</div>
<i class="icon fa fa-circle"></i>
<i class="icon fa fa-check-circle"></i>
</div>
<div class="arrow"><i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></div><div class="js es5">
<div class="title"><b>ECMAScript 5</b> &mdash; syntactic sugar: <span class="style reduced">reduced</span> | <span class="style traditional">traditional</span></div>
<div class="code"><span class="keyword">var</span> tmp<span class="punctuation"> = </span>getASTNode<span class="punctuation">(</span><span class="punctuation">)</span><span class="semi">;</span>
<div class="code"><span class="keyword">var</span> tmp<span class="punctuation"> = </span> <span class="punctuation">{</span> op: <span class="punctuation">(</span>left<span class="punctuation">,</span> right<span class="punctuation">)</span> <span class="punctuation">=&gt;</span> left <span class="punctuation">+</span> right<span class="punctuation">,</span> lhs: <span class="punctuation">{</span> op: <span class="punctuation">(</span>left<span class="punctuation">,</span> right<span class="punctuation">)</span> <span class="punctuation">=&gt;</span> left <span class="punctuation">-</span> right<span class="punctuation">,</span> lhs: <span class="literal">10</span><span class="punctuation">,</span> rhs: <span class="literal">10</span> <span class="punctuation">}</span><span class="punctuation">,</span> rhs: <span class="literal">2</span>
<span class="punctuation">}</span><span class="semi">;</span>
<span class="keyword">var</span> a<span class="punctuation"> = </span>tmp<span class="punctuation">.</span>op<span class="semi">;</span>
<span class="keyword">var</span> <span class="mark">b<span class="punctuation"> = </span>tmp<span class="punctuation">.</span>lhs<span class="punctuation">.</span>op</span><span class="semi">;</span>
<span class="keyword">var</span> c<span class="punctuation"> = </span>tmp<span class="punctuation">.</span>rhs<span class="semi">;</span></div>
Expand Down