Another one that I've let sit too long. This patch doesn't make as big a ...
13 years, 2 months ago
(2013-03-23 21:37:18 UTC)
#1
Another one that I've let sit too long.
This patch doesn't make as big a difference now that we use 'return' to
handle generator close.
#--cut--
dl_check() {
local f=$(basename $1)
test -e $f || curl -sO $1
openssl sha1 < $f | grep -q "= $2" && return 0
echo sha1 mismatch!
return 1
}
git checkout -b issue7541050-statemachine-opt
cat > gen-empty-states.js <<"END"
function* G(n1, n2) {
for (var i = n1; i < n2; i++) {
yield i;
if (i % 42 === 0)
break;
}
}
END
## before
./traceur --out gen-empty-states.out1.js -- gen-empty-states.js
dl_check https://codereview.appspot.com/download/issue7541050_1.diff \
526ec7a4f0dcfd71 && git apply issue7541050_1.diff && make test
## after
./traceur --out gen-empty-states.out2.js -- gen-empty-states.js
## the empty state is gone.
diff -u gen-empty-states.out1.js gen-empty-states.out2.js
#--cut--
https://codereview.appspot.com/7541050/diff/1/src/codegeneration/generator/Ge...
File src/codegeneration/generator/GeneratorTransformer.js (right):
https://codereview.appspot.com/7541050/diff/1/src/codegeneration/generator/Ge...
src/codegeneration/generator/GeneratorTransformer.js:203:
this.removeEmptyStates(machine.states),
State machine manipulation functions like this should probably all be
moved to a utility library eventually.
LGTM I changed the continue to if/else before committing. Committed as aa3ae4930eeb9c46445924393d771c573ac79058 https://codereview.appspot.com/7541050/diff/1/src/codegeneration/generator/CPSTransformer.js File src/codegeneration/generator/CPSTransformer.js ...
13 years, 2 months ago
(2013-03-24 15:01:53 UTC)
#2
Issue 7541050: Optimization: Remove empty FallthroughState states.
(Closed)
Created 13 years, 2 months ago by usrbincc
Modified 13 years, 2 months ago
Reviewers: arv, slightlylate, peterhal
Base URL: https://code.google.com/p/traceur-compiler/@master
Comments: 3