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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1435853002: Register closures using StaticUse. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment Created 5 years, 1 month 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
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 library dart2js.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show 8 import '../common/names.dart' show
9 Selectors; 9 Selectors;
10 import '../common/resolution.dart' show 10 import '../common/resolution.dart' show
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 enclosingElement = function; 629 enclosingElement = function;
630 // Run the body in a fresh statement scope. 630 // Run the body in a fresh statement scope.
631 StatementScope oldStatementScope = statementScope; 631 StatementScope oldStatementScope = statementScope;
632 statementScope = new StatementScope(); 632 statementScope = new StatementScope();
633 visit(node.body); 633 visit(node.body);
634 statementScope = oldStatementScope; 634 statementScope = oldStatementScope;
635 635
636 scope = oldScope; 636 scope = oldScope;
637 enclosingElement = previousEnclosingElement; 637 enclosingElement = previousEnclosingElement;
638 638
639 registry.registerClosure(function); 639 registry.registerStaticUse(new StaticUse.closure(function));
640 return const NoneResult(); 640 return const NoneResult();
641 } 641 }
642 642
643 ResolutionResult visitIf(If node) { 643 ResolutionResult visitIf(If node) {
644 doInPromotionScope(node.condition.expression, () => visit(node.condition)); 644 doInPromotionScope(node.condition.expression, () => visit(node.condition));
645 doInPromotionScope(node.thenPart, 645 doInPromotionScope(node.thenPart,
646 () => visitIn(node.thenPart, new BlockScope(scope))); 646 () => visitIn(node.thenPart, new BlockScope(scope)));
647 visitIn(node.elsePart, new BlockScope(scope)); 647 visitIn(node.elsePart, new BlockScope(scope));
648 return const NoneResult(); 648 return const NoneResult();
649 } 649 }
(...skipping 4110 matching lines...) Expand 10 before | Expand all | Expand 10 after
4760 } 4760 }
4761 return const NoneResult(); 4761 return const NoneResult();
4762 } 4762 }
4763 } 4763 }
4764 4764
4765 /// Looks up [name] in [scope] and unwraps the result. 4765 /// Looks up [name] in [scope] and unwraps the result.
4766 Element lookupInScope(DiagnosticReporter reporter, Node node, 4766 Element lookupInScope(DiagnosticReporter reporter, Node node,
4767 Scope scope, String name) { 4767 Scope scope, String name) {
4768 return Elements.unwrap(scope.lookup(name), reporter, node); 4768 return Elements.unwrap(scope.lookup(name), reporter, node);
4769 } 4769 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_backend.dart ('k') | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698