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

Side by Side Diff: tests/compiler/dart2js/equivalence/id_equivalence_test.dart

Issue 3009903002: Pass in `this` as a free variable to the closure class (Closed)
Patch Set: merge with master Created 3 years, 3 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) 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/commandline_options.dart'; 7 import 'package:compiler/src/commandline_options.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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 /// for the data origin. 76 /// for the data origin.
77 void computeAstMemberData( 77 void computeAstMemberData(
78 Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap, 78 Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
79 {bool verbose: false}) { 79 {bool verbose: false}) {
80 MemberElement member = _member; 80 MemberElement member = _member;
81 ResolvedAst resolvedAst = member.resolvedAst; 81 ResolvedAst resolvedAst = member.resolvedAst;
82 if (resolvedAst.kind != ResolvedAstKind.PARSED) return; 82 if (resolvedAst.kind != ResolvedAstKind.PARSED) return;
83 new ResolvedAstComputer(compiler.reporter, actualMap, resolvedAst).run(); 83 new ResolvedAstComputer(compiler.reporter, actualMap, resolvedAst).run();
84 } 84 }
85 85
86 /// Mixin used for0computing a descriptive mapping of the [Id]s in a member. 86 /// Mixin used for computing a descriptive mapping of the [Id]s in a member.
87 class ComputerMixin { 87 class ComputerMixin {
88 String computeMemberName(String className, String memberName) { 88 String computeMemberName(String className, String memberName) {
89 if (className != null) { 89 if (className != null) {
90 return 'member:$className.$memberName'; 90 return 'member:$className.$memberName';
91 } 91 }
92 return 'member:$memberName'; 92 return 'member:$memberName';
93 } 93 }
94 94
95 String computeLocalName(String localName) { 95 String computeLocalName(String localName) {
96 return 'local:$localName'; 96 return 'local:$localName';
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 if (sendStructure == null) return null; 140 if (sendStructure == null) return null;
141 141
142 String getDynamicName() { 142 String getDynamicName() {
143 switch (sendStructure.semantics.kind) { 143 switch (sendStructure.semantics.kind) {
144 case AccessKind.PARAMETER: 144 case AccessKind.PARAMETER:
145 case AccessKind.FINAL_PARAMETER: 145 case AccessKind.FINAL_PARAMETER:
146 case AccessKind.LOCAL_VARIABLE: 146 case AccessKind.LOCAL_VARIABLE:
147 case AccessKind.FINAL_LOCAL_VARIABLE: 147 case AccessKind.FINAL_LOCAL_VARIABLE:
148 case AccessKind.LOCAL_FUNCTION: 148 case AccessKind.LOCAL_FUNCTION:
149 return sendStructure.semantics.element.name; 149 return sendStructure.semantics.element.name;
150 case AccessKind.THIS_PROPERTY:
150 case AccessKind.DYNAMIC_PROPERTY: 151 case AccessKind.DYNAMIC_PROPERTY:
151 DynamicAccess access = sendStructure.semantics; 152 DynamicAccess access = sendStructure.semantics;
152 return access.name.text; 153 return access.name.text;
153 default: 154 default:
154 return null; 155 return null;
155 } 156 }
156 } 157 }
157 158
158 switch (sendStructure.kind) { 159 switch (sendStructure.kind) {
159 case SendStructureKind.GET: 160 case SendStructureKind.GET:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return switchCaseName; 238 return switchCaseName;
238 } 239 }
239 return '<unknown:$node (${node.runtimeType})>'; 240 return '<unknown:$node (${node.runtimeType})>';
240 } 241 }
241 242
242 @override 243 @override
243 String computeMemberValue(ir.Member member) { 244 String computeMemberValue(ir.Member member) {
244 return computeMemberName(member.enclosingClass?.name, member.name.name); 245 return computeMemberName(member.enclosingClass?.name, member.name.name);
245 } 246 }
246 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698