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

Unified Diff: dart/frog/leg/ssa/codegen.dart

Issue 9549002: For reasons beyond logic, null matches any exception type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix precedence Created 8 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
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/tests/language/language-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/ssa/codegen.dart
diff --git a/dart/frog/leg/ssa/codegen.dart b/dart/frog/leg/ssa/codegen.dart
index 7921553b4d9fb8a9449943a6aa370a594a6e9e35..0e7f012fcbcbcb2552bc3d955c89b52a11aadca5 100644
--- a/dart/frog/leg/ssa/codegen.dart
+++ b/dart/frog/leg/ssa/codegen.dart
@@ -929,6 +929,11 @@ class SsaCodeGenerator implements HVisitor {
LibraryElement coreLibrary = compiler.coreLibrary;
ClassElement objectClass = coreLibrary.find(const SourceString('Object'));
HInstruction input = node.expression;
+ if (node.nullOk) {
+ use(input, JSPrecedence.EQUALITY_PRECEDENCE);
+ buffer.add(' === (void 0) ||');
+ beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
Lasse Reichstein Nielsen 2012/03/06 10:31:08 Sadly, that won't do what you want. It doesn't cha
ahe 2012/03/06 10:57:38 I think this is way too complicated, and I have no
+ }
if (element == objectClass) {
// TODO(ahe): This probably belongs in the constant folder.
buffer.add('true');
@@ -994,6 +999,9 @@ class SsaCodeGenerator implements HVisitor {
if (endParen) buffer.add(')');
endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE);
}
+ if (node.nullOk) {
+ endExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
+ }
}
bool isStringSupertype(ClassElement cls) {
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698