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

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

Issue 2999003002: Add more tested features to closure_test (Closed)
Patch Set: Updated cf. comments. 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_model/closure.dart » ('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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 /// used inside the scope of [node]. 44 /// used inside the scope of [node].
45 // TODO(johnniwinther): Split this up into two functions, one for members and 45 // TODO(johnniwinther): Split this up into two functions, one for members and
46 // one for local functions. 46 // one for local functions.
47 ScopeInfo getScopeInfo(covariant Entity member); 47 ScopeInfo getScopeInfo(covariant Entity member);
48 48
49 /// This returns the same information as ScopeInfo, but can be called in 49 /// This returns the same information as ScopeInfo, but can be called in
50 /// situations when you are sure you are dealing with a closure specifically. 50 /// situations when you are sure you are dealing with a closure specifically.
51 ClosureRepresentationInfo getClosureRepresentationInfo( 51 ClosureRepresentationInfo getClosureRepresentationInfo(
52 covariant Entity member); 52 covariant Entity member);
53 53
54 ClosureRepresentationInfo getClosureRepresentationInfoForTesting(
55 covariant Entity member);
56
54 /// Look up information about a loop, in case any variables it declares need 57 /// Look up information about a loop, in case any variables it declares need
55 /// to be boxed/snapshotted. 58 /// to be boxed/snapshotted.
56 CapturedLoopScope getCapturedLoopScope(T loopNode); 59 CapturedLoopScope getCapturedLoopScope(T loopNode);
57 60
58 /// Accessor to the information about scopes that closures capture. Used by 61 /// Accessor to the information about scopes that closures capture. Used by
59 /// the SSA builder. 62 /// the SSA builder.
60 CapturedScope getCapturedScope(MemberEntity entity); 63 CapturedScope getCapturedScope(MemberEntity entity);
61 } 64 }
62 65
63 /// Class that represents one level of scoping information, whether this scope 66 /// Class that represents one level of scoping information, whether this scope
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 285 }
283 286
284 ScopeInfo getScopeInfo(Element member) { 287 ScopeInfo getScopeInfo(Element member) {
285 return getClosureToClassMapping(member); 288 return getClosureToClassMapping(member);
286 } 289 }
287 290
288 ClosureRepresentationInfo getClosureRepresentationInfo(Element member) { 291 ClosureRepresentationInfo getClosureRepresentationInfo(Element member) {
289 return getClosureToClassMapping(member); 292 return getClosureToClassMapping(member);
290 } 293 }
291 294
295 ClosureRepresentationInfo getClosureRepresentationInfoForTesting(
296 Element member) {
297 return getClosureRepresentationInfo(member);
298 }
299
292 CapturedLoopScope getCapturedLoopScope(Node loopNode) { 300 CapturedLoopScope getCapturedLoopScope(Node loopNode) {
293 var value = _closureInfoMap[loopNode]; 301 var value = _closureInfoMap[loopNode];
294 return value == null ? const CapturedLoopScope() : value; 302 return value == null ? const CapturedLoopScope() : value;
295 } 303 }
296 304
297 /// Returns the [ClosureClassMap] computed for [resolvedAst]. 305 /// Returns the [ClosureClassMap] computed for [resolvedAst].
298 ClosureClassMap getClosureToClassMapping(Element element) { 306 ClosureClassMap getClosureToClassMapping(Element element) {
299 return measure(() { 307 return measure(() {
300 if (element.isGenerativeConstructorBody) { 308 if (element.isGenerativeConstructorBody) {
301 ConstructorBodyElement constructorBody = element; 309 ConstructorBodyElement constructorBody = element;
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 /// 1547 ///
1540 /// Move the below classes to a JS model eventually. 1548 /// Move the below classes to a JS model eventually.
1541 /// 1549 ///
1542 abstract class JSEntity implements MemberEntity { 1550 abstract class JSEntity implements MemberEntity {
1543 Local get declaredEntity; 1551 Local get declaredEntity;
1544 } 1552 }
1545 1553
1546 abstract class PrivatelyNamedJSEntity implements JSEntity { 1554 abstract class PrivatelyNamedJSEntity implements JSEntity {
1547 Entity get rootOfScope; 1555 Entity get rootOfScope;
1548 } 1556 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_model/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698