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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map.dart

Issue 2994353002: Fix the locals lookup of variables and partial implementation of boxing of variables.
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) 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 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../common_elements.dart'; 10 import '../common_elements.dart';
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ir.Node get node; 237 ir.Node get node;
238 238
239 /// The canonical location of [member]. This is used for sorting the members 239 /// The canonical location of [member]. This is used for sorting the members
240 /// in the emitted code. 240 /// in the emitted code.
241 SourceSpan get location; 241 SourceSpan get location;
242 } 242 }
243 243
244 enum ClassKind { 244 enum ClassKind {
245 regular, 245 regular,
246 closure, 246 closure,
247 // TODO(efortuna, johnniwinther): Container is not a class, but is
248 // masquerading as one currently for consistency with the old element model.
249 container,
247 } 250 }
248 251
249 /// A member directly defined by its [ir.Member] node. 252 /// A member directly defined by its [ir.Member] node.
250 class RegularMemberDefinition implements MemberDefinition { 253 class RegularMemberDefinition implements MemberDefinition {
251 final MemberEntity member; 254 final MemberEntity member;
252 final ir.Member node; 255 final ir.Member node;
253 256
254 RegularMemberDefinition(this.member, this.node); 257 RegularMemberDefinition(this.member, this.node);
255 258
256 SourceSpan get location => computeSourceSpanFromTreeNode(node); 259 SourceSpan get location => computeSourceSpanFromTreeNode(node);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 MemberEntity get currentMember; 379 MemberEntity get currentMember;
377 380
378 // TODO(johnniwinther): Make these return the [KernelToLocalsMap] to use from 381 // TODO(johnniwinther): Make these return the [KernelToLocalsMap] to use from
379 // now on. 382 // now on.
380 /// Call to notify that [member] is currently being inlined. 383 /// Call to notify that [member] is currently being inlined.
381 void enterInlinedMember(covariant MemberEntity member); 384 void enterInlinedMember(covariant MemberEntity member);
382 385
383 /// Call to notify that [member] is no longer being inlined. 386 /// Call to notify that [member] is no longer being inlined.
384 void leaveInlinedMember(covariant MemberEntity member); 387 void leaveInlinedMember(covariant MemberEntity member);
385 388
386 /// Returns the [Local] for [node]. 389 /// Returns the [Local] for [node]. If [isClosureCallMethod] is true, this
387 Local getLocalVariable(ir.VariableDeclaration node); 390 /// gives the locals map permission to also look one scope higher within the
391 /// class for the corresponding local. This can happen in the case of free
392 /// variables involved with a closure class.
393 Local getLocalVariable(ir.VariableDeclaration node,
394 {bool isClosureCallMethod = false});
388 395
389 /// Returns the [Local] corresponding to the [node]. The node must be either 396 /// Returns the [Local] corresponding to the [node]. The node must be either
390 /// a [ir.FunctionDeclaration] or [ir.FunctionExpression]. 397 /// a [ir.FunctionDeclaration] or [ir.FunctionExpression].
391 Local getLocalFunction(ir.TreeNode node); 398 Local getLocalFunction(ir.TreeNode node);
392 399
393 /// Returns the [JumpTarget] for the break statement [node]. 400 /// Returns the [JumpTarget] for the break statement [node].
394 JumpTarget getJumpTargetForBreak(ir.BreakStatement node); 401 JumpTarget getJumpTargetForBreak(ir.BreakStatement node);
395 402
396 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget]. 403 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget].
397 bool generateContinueForBreak(ir.BreakStatement node); 404 bool generateContinueForBreak(ir.BreakStatement node);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 uri = Uri.parse(node.location.file); 456 uri = Uri.parse(node.location.file);
450 break; 457 break;
451 } 458 }
452 node = node.parent; 459 node = node.parent;
453 } 460 }
454 if (uri != null) { 461 if (uri != null) {
455 return new SourceSpan(uri, offset, offset + 1); 462 return new SourceSpan(uri, offset, offset + 1);
456 } 463 }
457 return null; 464 return null;
458 } 465 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_model/locals.dart ('k') | pkg/compiler/lib/src/kernel/element_map_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698