Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 06f1905

Browse files
author
John Messerly
committed
fix readability regressions from previous block-scope CL
also reverts the simple incremental compile code, it wasn't aware of our own compiler's version. also fixes a warning from analyzer R=leafp@google.com Review URL: https://codereview.chromium.org/1305413006 .
1 parent 6af5d39 commit 06f1905

File tree

4 files changed

+7
-20
lines changed

4 files changed

+7
-20
lines changed

lib/src/codegen/js_codegen.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,9 +1767,9 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
17671767
@override
17681768
JS.Block visitBlockFunctionBody(BlockFunctionBody node) {
17691769
var initArgs = _emitArgumentInitializers(node.parent);
1770-
var block = visitBlock(node.block);
1771-
if (initArgs != null) return new JS.Block([initArgs, block]);
1772-
return block;
1770+
var stmts = _visitList(node.block.statements) as List<JS.Statement>;
1771+
if (initArgs != null) stmts.insert(0, initArgs);
1772+
return new JS.Block(stmts);
17731773
}
17741774

17751775
@override
@@ -2932,7 +2932,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
29322932
}
29332933
}
29342934

2935-
body.add(_visit(node.body));
2935+
body.add(
2936+
new JS.Block(_visitList(node.body.statements) as List<JS.Statement>));
29362937
_catchParameter = savedCatch;
29372938
return _statement(body);
29382939
}

lib/src/compiler.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,6 @@ class BatchCompiler extends AbstractCompiler {
173173
}
174174

175175
if (_jsGen != null) {
176-
// TODO(jmesserly): full incremental support would avoid checking as well,
177-
// however, we'd lose compiler messages in that case.
178-
179-
// Note: analyzer's modification stamp is millisecondsSinceEpoch
180-
int lastModifyTime = unitElements
181-
.map((e) => context.getModificationStamp(e.source))
182-
.reduce(math.max);
183-
var outFile = new File(getOutputPath(library.source.uri));
184-
if (outFile.existsSync() &&
185-
outFile.lastModifiedSync().millisecondsSinceEpoch >= lastModifyTime) {
186-
// Output already up to date.
187-
return;
188-
}
189-
190176
var unit = units.first;
191177
var parts = units.skip(1).toList();
192178
_jsGen.generateLibrary(new LibraryUnit(unit, parts));

lib/src/js/nodes.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class Block extends Statement {
285285
Block(this.statements, {this.isScope: false}) {
286286
assert(!statements.any((s) => s is! Statement));
287287
}
288-
Block.empty() : this.statements = <Statement>[];
288+
Block.empty() : statements = <Statement>[], isScope = false;
289289

290290
accept(NodeVisitor visitor) => visitor.visitBlock(this);
291291
void visitChildren(NodeVisitor visitor) {

test/codegen/expect/sunflower/sunflower.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ <h1>drfibonacci's Sunflower Spectacular</h1>
5151
<script src="../dev_compiler/runtime/dart/mirrors.js"></script>
5252
<script src="../dev_compiler/runtime/dart/_js_mirrors.js"></script>
5353
<script src="../dev_compiler/runtime/dart/js.js"></script>
54-
<script src="dom.js"></script>
5554
<script src="circle.js"></script>
55+
<script src="dom.js"></script>
5656
<script src="painter.js"></script>
5757
<script src="sunflower.js"></script>
5858
<script>dart_library.start('sunflower/sunflower');</script>

0 commit comments

Comments
 (0)