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

Issue 9549002: For reasons beyond logic, null matches any exception type. (Closed)

Created:
8 years, 9 months ago by ahe
Modified:
8 years, 9 months ago
CC:
reviews_dartlang.org, kasperl, karlklose, Lasse Reichstein Nielsen
Visibility:
Public.

Description

For reasons beyond logic, null matches any exception type. Committed: https://code.google.com/p/dart/source/detail?r=5017

Patch Set 1 #

Total comments: 5

Patch Set 2 : Fix precedence #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -2 lines) Patch
M dart/frog/leg/ssa/builder.dart View 1 chunk +1 line, -1 line 0 comments Download
M dart/frog/leg/ssa/codegen.dart View 1 2 chunks +8 lines, -0 lines 2 comments Download
M dart/tests/language/language-leg.status View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 7 (0 generated)
ahe
https://chromiumcodereview.appspot.com/9549002/diff/1/dart/frog/leg/ssa/codegen.dart File dart/frog/leg/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/9549002/diff/1/dart/frog/leg/ssa/codegen.dart#newcode934 dart/frog/leg/ssa/codegen.dart:934: buffer.add(' === (void 0) ||'); I think this will ...
8 years, 9 months ago (2012-02-29 20:44:20 UTC) #1
ngeoffray
LGTM
8 years, 9 months ago (2012-03-01 08:31:16 UTC) #2
Lasse Reichstein Nielsen
DBC https://chromiumcodereview.appspot.com/9549002/diff/1/dart/frog/leg/ssa/codegen.dart File dart/frog/leg/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/9549002/diff/1/dart/frog/leg/ssa/codegen.dart#newcode933 dart/frog/leg/ssa/codegen.dart:933: use(input, JSPrecedence.LOGICAL_OR_PRECEDENCE); That should be EQUALITY_PRECEDENCE. It's the ...
8 years, 9 months ago (2012-03-01 08:38:17 UTC) #3
Lasse Reichstein Nielsen
https://chromiumcodereview.appspot.com/9549002/diff/1/dart/frog/leg/ssa/codegen.dart File dart/frog/leg/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/9549002/diff/1/dart/frog/leg/ssa/codegen.dart#newcode935 dart/frog/leg/ssa/codegen.dart:935: } This also changes the expected precedence for the ...
8 years, 9 months ago (2012-03-02 09:44:09 UTC) #4
ahe
Hi Lasse and Nicolas, Thank you for taking a look. Cheers, Peter https://chromiumcodereview.appspot.com/9549002/diff/1/dart/frog/leg/ssa/codegen.dart File dart/frog/leg/ssa/codegen.dart ...
8 years, 9 months ago (2012-03-06 10:16:01 UTC) #5
Lasse Reichstein Nielsen
https://chromiumcodereview.appspot.com/9549002/diff/7001/dart/frog/leg/ssa/codegen.dart File dart/frog/leg/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/9549002/diff/7001/dart/frog/leg/ssa/codegen.dart#newcode935 dart/frog/leg/ssa/codegen.dart:935: beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); Sadly, that won't do what you want. It ...
8 years, 9 months ago (2012-03-06 10:31:08 UTC) #6
ahe
8 years, 9 months ago (2012-03-06 10:57:38 UTC) #7
https://chromiumcodereview.appspot.com/9549002/diff/7001/dart/frog/leg/ssa/co...
File dart/frog/leg/ssa/codegen.dart (right):

https://chromiumcodereview.appspot.com/9549002/diff/7001/dart/frog/leg/ssa/co...
dart/frog/leg/ssa/codegen.dart:935:
beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
On 2012/03/06 10:31:08, Lasse Reichstein Nielsen wrote:
> Sadly, that won't do what you want. It doesn't change the expectations of the
> following code, but merely puts a start parenthesis if the current expectation
> is harder binding than a ||.
> 
> We can either create a function withPrecedence(precedence, thunk) that sets
the
> expected precedence during execution of  the thunk, or we can manually update
> expectedPrecedence here (if it's the only place we need it, the extra
> abstraction might be overdoing it).
> 
> I.e.:
> 
> int oldPrecedence = currentPrecedence;
> if (node.nullOK) {
>   ...
>   currentPrecedence = LOGICAL_OR_PRECEDENCE;
> }
> ... expression or RHS of || ...
> if (node.nullOk) {
>   currentPrecedence = oldPrecedence;
> }
> 
> It breaks the abstraction a little, since we don't manipulate
currentPrecedence
> anywhere else outside of use/visit, but if it's only one place it should be
> fine.

I think this is way too complicated, and I have no idea how to apply your
suggestion. The mental model behind this is apparently not based on building up
expressions from subexpressions. As long as that is not the case, this will be
an endless source of problems.

I think it was a mistake to add the precedence in this form. We would be better
off wrapping everything in parentheses.

I'll add a pair of parentheses.

Powered by Google App Engine
This is Rietveld 408576698