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

Side by Side Diff: tests/compiler/dart2js/closure/closure_test.dart

Issue 2982713003: Revert "Distinguish between actual closure scopes and non-closure scopes." (Closed)
Patch Set: Created 3 years, 5 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 | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 'dart:io'; 5 import 'dart:io';
6 import 'package:async_helper/async_helper.dart'; 6 import 'package:async_helper/async_helper.dart';
7 import 'package:compiler/src/closure.dart'; 7 import 'package:compiler/src/closure.dart';
8 import 'package:compiler/src/common.dart'; 8 import 'package:compiler/src/common.dart';
9 import 'package:compiler/src/compiler.dart'; 9 import 'package:compiler/src/compiler.dart';
10 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; 10 import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 String computeElementValue(AstElement element) { 88 String computeElementValue(AstElement element) {
89 // TODO(johnniwinther,efortuna): Collect data for the member 89 // TODO(johnniwinther,efortuna): Collect data for the member
90 // (has thisLocal, has box, etc.). 90 // (has thisLocal, has box, etc.).
91 return null; 91 return null;
92 } 92 }
93 } 93 }
94 94
95 /// Kernel IR visitor for computing closure data. 95 /// Kernel IR visitor for computing closure data.
96 class ClosureIrChecker extends AbstractIrComputer { 96 class ClosureIrChecker extends AbstractIrComputer {
97 final ClosureDataLookup<ir.Node> closureDataLookup; 97 final ClosureDataLookup<ir.Node> closureDataLookup;
98 final ScopeInfo info; 98 final ClosureRepresentationInfo info;
99 final KernelToLocalsMap _localsMap; 99 final KernelToLocalsMap _localsMap;
100 100
101 ClosureIrChecker( 101 ClosureIrChecker(
102 Map<Id, String> actualMap, 102 Map<Id, String> actualMap,
103 Map<Id, SourceSpan> sourceSpanMap, 103 Map<Id, SourceSpan> sourceSpanMap,
104 KernelToElementMapForBuilding elementMap, 104 KernelToElementMapForBuilding elementMap,
105 MemberEntity member, 105 MemberEntity member,
106 this._localsMap, 106 this._localsMap,
107 this.closureDataLookup) 107 this.closureDataLookup)
108 : this.info = closureDataLookup.getScopeInfo(member), 108 : this.info = closureDataLookup.getClosureRepresentationInfo(member),
109 super(actualMap, sourceSpanMap); 109 super(actualMap, sourceSpanMap);
110 110
111 @override 111 @override
112 String computeNodeValue(ir.Node node) { 112 String computeNodeValue(ir.Node node) {
113 if (node is ir.VariableDeclaration) { 113 if (node is ir.VariableDeclaration) {
114 Local local = _localsMap.getLocal(node); 114 Local local = _localsMap.getLocal(node);
115 return computeLocalValue(info, local); 115 return computeLocalValue(info, local);
116 } 116 }
117 // TODO(johnniwinther,efortuna): Collect data for other nodes? 117 // TODO(johnniwinther,efortuna): Collect data for other nodes?
118 return null; 118 return null;
119 } 119 }
120 120
121 @override 121 @override
122 String computeMemberValue(ir.Member member) { 122 String computeMemberValue(ir.Member member) {
123 // TODO(johnniwinther,efortuna): Collect data for the member 123 // TODO(johnniwinther,efortuna): Collect data for the member
124 // (has thisLocal, has box, etc.). 124 // (has thisLocal, has box, etc.).
125 return null; 125 return null;
126 } 126 }
127 } 127 }
128 128
129 /// Compute a string representation of the data stored for [local] in [info]. 129 /// Compute a string representation of the data stored for [local] in [info].
130 String computeLocalValue(ScopeInfo info, Local local) { 130 String computeLocalValue(ClosureRepresentationInfo info, Local local) {
131 StringBuffer sb = new StringBuffer(); 131 StringBuffer sb = new StringBuffer();
132 if (info.localIsUsedInTryOrSync(local)) { 132 if (info.localIsUsedInTryOrSync(local)) {
133 sb.write('inTry'); 133 sb.write('inTry');
134 } 134 }
135 // TODO(johnniwinther,efortuna): Add more info (captured, boxed etc.). 135 // TODO(johnniwinther,efortuna): Add more info (captured, boxed etc.).
136 return sb.toString(); 136 return sb.toString();
137 } 137 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698