Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1145)

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1042003002: fix list literal initialization call fix typeof calls for primitive JS types add dart/collection.js… (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index b93b8cfc83122bab103466140185a7a1a723dc32..6e39a3e789e18732d39469527475c1bcdd492a5c 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -235,7 +235,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
var lhs = _visit(node.expression);
var typeofName = _jsTypeofName(type);
if (typeofName != null) {
- result = js.call('typeof # == #', [lhs, typeofName]);
+ result = js.call('typeof # == #', [lhs, js.string(typeofName, "'")]);
} else {
// Always go through a runtime helper, because implicit interfaces.
result = js.call('dart.is(#, #)', [lhs, _emitTypeName(type)]);
@@ -1913,8 +1913,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
@override
visitListLiteral(ListLiteral node) {
// TODO(jmesserly): make this faster. We're wasting an array.
- var list = js.call('new List.from(#)',
- [new JS.ArrayInitializer(_visitList(node.elements))]);
+ var list = js.call('new #.from(#)',
+ [_emitTypeName(node.staticType), new JS.ArrayInitializer(_visitList(node.elements))]);
if (node.constKeyword != null) {
list = js.commentExpression('Unimplemented const', list);
}
@@ -2025,11 +2025,6 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
return result;
}
- JS.Statement _visitOrEmpty(Statement node) {
- if (node == null) return new JS.EmptyStatement();
- return _visit(node);
- }
-
List _visitList(Iterable<AstNode> nodes) {
if (nodes == null) return null;
var result = [];

Powered by Google App Engine
This is Rietveld 408576698