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

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

Issue 9695059: Fix leg assert and NPE to make BB green. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 scopeVariables = oldScopeVariables; 389 scopeVariables = oldScopeVariables;
390 insideClosure = oldInsideClosure; 390 insideClosure = oldInsideClosure;
391 closureData = oldClosureData; 391 closureData = oldClosureData;
392 currentFunctionElement = oldFunctionElement; 392 currentFunctionElement = oldFunctionElement;
393 393
394 // Mark all free variables as captured and use them in the outer function. 394 // Mark all free variables as captured and use them in the outer function.
395 List<Element> freeVariables = 395 List<Element> freeVariables =
396 savedClosureData.freeVariableMapping.getKeys(); 396 savedClosureData.freeVariableMapping.getKeys();
397 assert(freeVariables.isEmpty() || savedInsideClosure); 397 assert(freeVariables.isEmpty() || savedInsideClosure);
398 for (Element freeElement in freeVariables) { 398 for (Element freeElement in freeVariables) {
399 assert(capturedVariableMapping[freeElement] == null || 399 if (capturedVariableMapping[freeElement] != null &&
400 capturedVariableMapping[freeElement] == freeElement); 400 capturedVariableMapping[freeElement] != freeElement) {
401 compiler.internalError('In closure analyzer', node: node);
402 }
401 capturedVariableMapping[freeElement] = freeElement; 403 capturedVariableMapping[freeElement] = freeElement;
402 useLocal(freeElement); 404 useLocal(freeElement);
403 } 405 }
404 } 406 }
405 407
406 visitFunctionDeclaration(FunctionDeclaration node) { 408 visitFunctionDeclaration(FunctionDeclaration node) {
407 node.visitChildren(this); 409 node.visitChildren(this);
408 declareLocal(elements[node]); 410 declareLocal(elements[node]);
409 } 411 }
410 412
411 visitTryStatement(TryStatement node) { 413 visitTryStatement(TryStatement node) {
412 // TODO(ngeoffray): implement finer grain state. 414 // TODO(ngeoffray): implement finer grain state.
413 inTryCatchOrFinally = true; 415 inTryCatchOrFinally = true;
414 node.visitChildren(this); 416 node.visitChildren(this);
415 inTryCatchOrFinally = false; 417 inTryCatchOrFinally = false;
416 } 418 }
417 } 419 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698