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

Side by Side Diff: frog/leg/ssa/closure.dart

Issue 9740003: Disable closures in initializers and fail instead of crashing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | tests/language/language-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class ClosureFieldElement extends Element { 5 class ClosureFieldElement extends Element {
6 ClosureFieldElement(SourceString name, ClassElement enclosing) 6 ClosureFieldElement(SourceString name, ClassElement enclosing)
7 : super(name, ElementKind.FIELD, enclosing); 7 : super(name, ElementKind.FIELD, enclosing);
8 8
9 bool isInstanceMember() => true; 9 bool isInstanceMember() => true;
10 bool isAssignable() => false; 10 bool isAssignable() => false;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // If we are inside a named closure we have to declare ourselve. For 369 // If we are inside a named closure we have to declare ourselve. For
370 // simplicity we declare the local even if the closure does not have a name 370 // simplicity we declare the local even if the closure does not have a name
371 // It will simply not be used. 371 // It will simply not be used.
372 if (insideClosure) { 372 if (insideClosure) {
373 declareLocal(element); 373 declareLocal(element);
374 } 374 }
375 375
376 // TODO(ahe): This is problematic. The backend should not repeat 376 // TODO(ahe): This is problematic. The backend should not repeat
377 // the work of the resolver. It is the resolver's job to create 377 // the work of the resolver. It is the resolver's job to create
378 // parameters, etc. Other phases should only visit statements. 378 // parameters, etc. Other phases should only visit statements.
379 node.visitChildren(this); 379 // TODO(floitsch): we avoid visiting the initializers on purpose so that we
380 // get an error-message later in the builder.
381 if (node.parameters !== null) node.parameters.accept(this);
ahe 2012/03/20 21:12:30 Visiting the parameters is also problematic. Long
382 if (node.body !== null) node.body.accept(this);
380 383
381 attachCapturedScopeVariables(node); 384 attachCapturedScopeVariables(node);
382 385
383 closureDataCache[node] = closureData; 386 closureDataCache[node] = closureData;
384 387
385 ClosureData savedClosureData = closureData; 388 ClosureData savedClosureData = closureData;
386 bool savedInsideClosure = insideClosure; 389 bool savedInsideClosure = insideClosure;
387 390
388 // Restore old values. 391 // Restore old values.
389 scopeVariables = oldScopeVariables; 392 scopeVariables = oldScopeVariables;
(...skipping 20 matching lines...) Expand all
410 declareLocal(elements[node]); 413 declareLocal(elements[node]);
411 } 414 }
412 415
413 visitTryStatement(TryStatement node) { 416 visitTryStatement(TryStatement node) {
414 // TODO(ngeoffray): implement finer grain state. 417 // TODO(ngeoffray): implement finer grain state.
415 inTryCatchOrFinally = true; 418 inTryCatchOrFinally = true;
416 node.visitChildren(this); 419 node.visitChildren(this);
417 inTryCatchOrFinally = false; 420 inTryCatchOrFinally = false;
418 } 421 }
419 } 422 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698