Skip to content

Commit

Permalink
fixes #197, don't generate casts that always pass
Browse files Browse the repository at this point in the history
  • Loading branch information
John Messerly committed Aug 4, 2015
1 parent 8422d7a commit b393e12
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 254 deletions.
3 changes: 3 additions & 0 deletions pkg/dev_compiler/lib/src/codegen/js_codegen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
var from = getStaticType(node.expression);
var to = node.type.type;

// Skip the cast if it's not needed.
if (rules.isSubTypeOf(from, to)) return _visit(node.expression);

// All Dart number types map to a JS double.
if (rules.isNumType(from) &&
(rules.isIntType(to) || rules.isDoubleType(to))) {
Expand Down
Loading

0 comments on commit b393e12

Please sign in to comment.