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

Side by Side Diff: pkg/compiler/lib/src/closure.dart

Issue 2998113002: Reduce use of getClosureInfoForMember and cleanup closure_test (Closed)
Patch Set: Created 3 years, 4 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
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 import 'common/names.dart' show Identifiers; 5 import 'common/names.dart' show Identifiers;
6 import 'common/resolution.dart' show ParsingContext, Resolution; 6 import 'common/resolution.dart' show ParsingContext, Resolution;
7 import 'common/tasks.dart' show CompilerTask, Measurer; 7 import 'common/tasks.dart' show CompilerTask, Measurer;
8 import 'common.dart'; 8 import 'common.dart';
9 import 'compiler.dart' show Compiler; 9 import 'compiler.dart' show Compiler;
10 import 'constants/expressions.dart'; 10 import 'constants/expressions.dart';
(...skipping 28 matching lines...) Expand all
39 /// to preserve Dart semantics when compiled to JavaScript. Given a particular 39 /// to preserve Dart semantics when compiled to JavaScript. Given a particular
40 /// node to look up, it returns a information about the internal representation 40 /// node to look up, it returns a information about the internal representation
41 /// of how closure conversion is implemented. T is an ir.Node or Node. 41 /// of how closure conversion is implemented. T is an ir.Node or Node.
42 abstract class ClosureDataLookup<T> { 42 abstract class ClosureDataLookup<T> {
43 /// Look up information about the variables that have been mutated and are 43 /// Look up information about the variables that have been mutated and are
44 /// used inside the scope of [node]. 44 /// used inside the scope of [node].
45 ScopeInfo getScopeInfo(MemberEntity member); 45 ScopeInfo getScopeInfo(MemberEntity member);
46 46
47 /// This returns the same information as ScopeInfo, but can be called in 47 /// This returns the same information as ScopeInfo, but can be called in
48 /// situations when you are sure you are dealing with a closure specifically. 48 /// situations when you are sure you are dealing with a closure specifically.
49 // TODO(johnniwinther,efortuna): Can we use [getScopeInfo] instead? 49 // TODO(johnniwinther,efortuna): Remove the need for this. It is now only
50 // used in inference.
50 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member); 51 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member);
51 52
52 ClosureRepresentationInfo getClosureInfo(T localFunction); 53 ClosureRepresentationInfo getClosureInfo(T localFunction);
53 54
54 ClosureRepresentationInfo getClosureInfoForMemberTesting(MemberEntity member);
55
56 ClosureRepresentationInfo getClosureInfoForTesting(T localFunction);
57
58 /// Look up information about a loop, in case any variables it declares need 55 /// Look up information about a loop, in case any variables it declares need
59 /// to be boxed/snapshotted. 56 /// to be boxed/snapshotted.
60 CapturedLoopScope getCapturedLoopScope(T loopNode); 57 CapturedLoopScope getCapturedLoopScope(T loopNode);
61 58
62 /// Accessor to the information about scopes that closures capture. Used by 59 /// Accessor to the information about scopes that closures capture. Used by
63 /// the SSA builder. 60 /// the SSA builder.
64 CapturedScope getCapturedScope(MemberEntity entity); 61 CapturedScope getCapturedScope(MemberEntity entity);
65 } 62 }
66 63
67 /// Class that represents one level of scoping information, whether this scope 64 /// Class that represents one level of scoping information, whether this scope
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 289 }
293 290
294 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member) { 291 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member) {
295 return _getMemberMapping(member); 292 return _getMemberMapping(member);
296 } 293 }
297 294
298 ClosureRepresentationInfo getClosureInfo(covariant FunctionExpression node) { 295 ClosureRepresentationInfo getClosureInfo(covariant FunctionExpression node) {
299 return _getClosureMapping(node); 296 return _getClosureMapping(node);
300 } 297 }
301 298
302 ClosureRepresentationInfo getClosureInfoForMemberTesting(
303 MemberEntity member) {
304 return getClosureInfoForMember(member);
305 }
306
307 ClosureRepresentationInfo getClosureInfoForTesting( 299 ClosureRepresentationInfo getClosureInfoForTesting(
308 covariant FunctionExpression node) { 300 covariant FunctionExpression node) {
309 return getClosureInfo(node); 301 return getClosureInfo(node);
310 } 302 }
311 303
312 CapturedLoopScope getCapturedLoopScope(Node loopNode) { 304 CapturedLoopScope getCapturedLoopScope(Node loopNode) {
313 var value = _closureInfoMap[loopNode]; 305 var value = _closureInfoMap[loopNode];
314 return value == null ? const CapturedLoopScope() : value; 306 return value == null ? const CapturedLoopScope() : value;
315 } 307 }
316 308
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 /// 1557 ///
1566 /// Move the below classes to a JS model eventually. 1558 /// Move the below classes to a JS model eventually.
1567 /// 1559 ///
1568 abstract class JSEntity implements MemberEntity { 1560 abstract class JSEntity implements MemberEntity {
1569 Local get declaredEntity; 1561 Local get declaredEntity;
1570 } 1562 }
1571 1563
1572 abstract class PrivatelyNamedJSEntity implements JSEntity { 1564 abstract class PrivatelyNamedJSEntity implements JSEntity {
1573 Entity get rootOfScope; 1565 Entity get rootOfScope;
1574 } 1566 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698