| OLD | NEW |
| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 // TODO(johnniwinther,efortuna): Add more when needed. | 208 // TODO(johnniwinther,efortuna): Add more when needed. |
| 209 // TODO(johnniwinther): Should we split regular into method, field, etc.? | 209 // TODO(johnniwinther): Should we split regular into method, field, etc.? |
| 210 enum MemberKind { | 210 enum MemberKind { |
| 211 // A regular member defined by an [ir.Node]. | 211 // A regular member defined by an [ir.Node]. |
| 212 regular, | 212 regular, |
| 213 // A constructor whose initializer is defined by an [ir.Constructor] node. | 213 // A constructor whose initializer is defined by an [ir.Constructor] node. |
| 214 constructor, | 214 constructor, |
| 215 // A constructor whose body is defined by an [ir.Constructor] node. | 215 // A constructor whose body is defined by an [ir.Constructor] node. |
| 216 constructorBody, | 216 constructorBody, |
| 217 // A closure class `call` method whose body is defined by an | 217 // A closure class `call` method whose body is defined by an |
| 218 // [ir.FunctionExpression]. | 218 // [ir.FunctionExpression] or [ir.FunctionDeclaration]. |
| 219 closureCall, | 219 closureCall, |
| 220 // A field corresponding to a captured variable in the closure. It does not | 220 // A field corresponding to a captured variable in the closure. It does not |
| 221 // have a corresponding ir.Node. | 221 // have a corresponding ir.Node. |
| 222 closureField, | 222 closureField, |
| 223 } | 223 } |
| 224 | 224 |
| 225 /// Definition information for a [MemberEntity]. | 225 /// Definition information for a [MemberEntity]. |
| 226 abstract class MemberDefinition { | 226 abstract class MemberDefinition { |
| 227 /// The defined member. | 227 /// The defined member. |
| 228 MemberEntity get member; | 228 MemberEntity get member; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 void leaveInlinedMember(covariant MemberEntity member); | 384 void leaveInlinedMember(covariant MemberEntity member); |
| 385 | 385 |
| 386 /// Returns the [Local] for [node]. If [isClosureCallMethod] is true, this | 386 /// Returns the [Local] for [node]. If [isClosureCallMethod] is true, this |
| 387 /// gives the locals map permission to also look one scope higher within the | 387 /// gives the locals map permission to also look one scope higher within the |
| 388 /// class for the corresponding local. This can happen in the case of free | 388 /// class for the corresponding local. This can happen in the case of free |
| 389 /// variables involved with a closure class. | 389 /// variables involved with a closure class. |
| 390 // TODO(efortuna, johnniwinther): convey this information without a boolean | 390 // TODO(efortuna, johnniwinther): convey this information without a boolean |
| 391 // parameter. | 391 // parameter. |
| 392 Local getLocalVariable(ir.VariableDeclaration node); | 392 Local getLocalVariable(ir.VariableDeclaration node); |
| 393 | 393 |
| 394 /// Returns the [ir.FunctionNode] that declared [parameter]. |
| 395 ir.FunctionNode getFunctionNodeForParameter(Local parameter); |
| 396 |
| 397 /// Returns the [ir.DartType] of [parameter]. |
| 398 ir.DartType getParameterType(Local parameter); |
| 399 |
| 394 /// Returns the [JumpTarget] for the break statement [node]. | 400 /// Returns the [JumpTarget] for the break statement [node]. |
| 395 JumpTarget getJumpTargetForBreak(ir.BreakStatement node); | 401 JumpTarget getJumpTargetForBreak(ir.BreakStatement node); |
| 396 | 402 |
| 397 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget]. | 403 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget]. |
| 398 bool generateContinueForBreak(ir.BreakStatement node); | 404 bool generateContinueForBreak(ir.BreakStatement node); |
| 399 | 405 |
| 400 /// Returns the [JumpTarget] defined by the labelled statement [node] or | 406 /// Returns the [JumpTarget] defined by the labelled statement [node] or |
| 401 /// `null` if [node] is not a jump target. | 407 /// `null` if [node] is not a jump target. |
| 402 JumpTarget getJumpTargetForLabel(ir.LabeledStatement node); | 408 JumpTarget getJumpTargetForLabel(ir.LabeledStatement node); |
| 403 | 409 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 uri = Uri.parse(node.location.file); | 463 uri = Uri.parse(node.location.file); |
| 458 break; | 464 break; |
| 459 } | 465 } |
| 460 node = node.parent; | 466 node = node.parent; |
| 461 } | 467 } |
| 462 if (uri != null) { | 468 if (uri != null) { |
| 463 return new SourceSpan(uri, offset, offset + 1); | 469 return new SourceSpan(uri, offset, offset + 1); |
| 464 } | 470 } |
| 465 return null; | 471 return null; |
| 466 } | 472 } |
| OLD | NEW |