Chromium Code Reviews| 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) { |