Chromium Code Reviews| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart'; | 8 import '../common/names.dart'; |
| 9 import '../constants/constructors.dart'; | 9 import '../constants/constructors.dart'; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| 11 import '../constants/values.dart'; | 11 import '../constants/values.dart'; |
| 12 import '../common_elements.dart'; | 12 import '../common_elements.dart'; |
| 13 import '../elements/elements.dart' show JumpTarget; | |
| 13 import '../elements/entities.dart'; | 14 import '../elements/entities.dart'; |
| 14 import '../elements/names.dart'; | 15 import '../elements/names.dart'; |
| 15 import '../elements/operators.dart'; | 16 import '../elements/operators.dart'; |
| 16 import '../elements/types.dart'; | 17 import '../elements/types.dart'; |
| 17 import '../js_backend/backend.dart' show JavaScriptBackend; | 18 import '../js_backend/backend.dart' show JavaScriptBackend; |
| 18 import '../native/native.dart' as native; | 19 import '../native/native.dart' as native; |
| 19 import '../types/types.dart'; | 20 import '../types/types.dart'; |
| 20 import '../universe/call_structure.dart'; | 21 import '../universe/call_structure.dart'; |
| 21 import '../universe/selector.dart'; | 22 import '../universe/selector.dart'; |
| 22 import '../world.dart'; | 23 import '../world.dart'; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 /// Computes the [ConstantValue] for the constant [expression]. | 149 /// Computes the [ConstantValue] for the constant [expression]. |
| 149 ConstantValue getConstantValue(ir.Expression expression); | 150 ConstantValue getConstantValue(ir.Expression expression); |
| 150 | 151 |
| 151 /// Returns the `noSuchMethod` [FunctionEntity] call from a | 152 /// Returns the `noSuchMethod` [FunctionEntity] call from a |
| 152 /// `super.noSuchMethod` invocation within [cls]. | 153 /// `super.noSuchMethod` invocation within [cls]. |
| 153 FunctionEntity getSuperNoSuchMethod(ClassEntity cls); | 154 FunctionEntity getSuperNoSuchMethod(ClassEntity cls); |
| 154 | 155 |
| 155 /// Returns a [Spannable] for a message pointing to the IR [node] in the | 156 /// Returns a [Spannable] for a message pointing to the IR [node] in the |
| 156 /// context of [member]. | 157 /// context of [member]. |
| 157 Spannable getSpannable(MemberEntity member, ir.Node node); | 158 Spannable getSpannable(MemberEntity member, ir.Node node); |
| 158 | |
| 159 // TODO(johnniwinther): Move these to a `KernelToLocalsMap`, maybe even make | |
|
Siggi Cherem (dart-lang)
2017/06/01 22:13:40
now I understand what you meant with the TODO!
se
| |
| 160 // the return the `KernelToLocalsMap` to use from now on. | |
| 161 /// Call to notify that [member] is currently being inlined. | |
| 162 void enterInlinedMember(MemberEntity member); | |
| 163 | |
| 164 /// Call to notify that [member] is no longer being inlined. | |
| 165 void leaveInlinedMember(MemberEntity member); | |
| 166 } | 159 } |
| 167 | 160 |
| 168 /// Kinds of foreign functions. | 161 /// Kinds of foreign functions. |
| 169 enum ForeignKind { | 162 enum ForeignKind { |
| 170 JS, | 163 JS, |
| 171 JS_BUILTIN, | 164 JS_BUILTIN, |
| 172 JS_EMBEDDED_GLOBAL, | 165 JS_EMBEDDED_GLOBAL, |
| 173 JS_INTERCEPTOR_CONSTANT, | 166 JS_INTERCEPTOR_CONSTANT, |
| 174 NONE, | 167 NONE, |
| 175 } | 168 } |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 // `Object.superNoSuchMethod`. | 503 // `Object.superNoSuchMethod`. |
| 511 break; | 504 break; |
| 512 } | 505 } |
| 513 } | 506 } |
| 514 FunctionEntity function = elementEnvironment.lookupClassMember( | 507 FunctionEntity function = elementEnvironment.lookupClassMember( |
| 515 commonElements.objectClass, Identifiers.noSuchMethod_); | 508 commonElements.objectClass, Identifiers.noSuchMethod_); |
| 516 assert(invariant(cls, function != null, | 509 assert(invariant(cls, function != null, |
| 517 message: "No super noSuchMethod found for class $cls.")); | 510 message: "No super noSuchMethod found for class $cls.")); |
| 518 return function; | 511 return function; |
| 519 } | 512 } |
| 520 | |
| 521 @override | |
| 522 void enterInlinedMember(MemberEntity member) {} | |
| 523 | |
| 524 @override | |
| 525 void leaveInlinedMember(MemberEntity member) {} | |
| 526 } | 513 } |
| 527 | 514 |
| 528 /// Visitor that converts string literals and concatenations of string literals | 515 /// Visitor that converts string literals and concatenations of string literals |
| 529 /// into the string value. | 516 /// into the string value. |
| 530 class Stringifier extends ir.ExpressionVisitor<String> { | 517 class Stringifier extends ir.ExpressionVisitor<String> { |
| 531 @override | 518 @override |
| 532 String visitStringLiteral(ir.StringLiteral node) => node.value; | 519 String visitStringLiteral(ir.StringLiteral node) => node.value; |
| 533 | 520 |
| 534 @override | 521 @override |
| 535 String visitStringConcatenation(ir.StringConcatenation node) { | 522 String visitStringConcatenation(ir.StringConcatenation node) { |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 TypeMask getInferredTypeOf(MemberEntity member); | 932 TypeMask getInferredTypeOf(MemberEntity member); |
| 946 | 933 |
| 947 /// Returns the inferred type of a dynamic [selector] access on a receiver of | 934 /// Returns the inferred type of a dynamic [selector] access on a receiver of |
| 948 /// type [mask]. | 935 /// type [mask]. |
| 949 TypeMask selectorTypeOf(Selector selector, TypeMask mask); | 936 TypeMask selectorTypeOf(Selector selector, TypeMask mask); |
| 950 | 937 |
| 951 /// Returns the returned type annotation in the [nativeBehavior]. | 938 /// Returns the returned type annotation in the [nativeBehavior]. |
| 952 TypeMask typeFromNativeBehavior( | 939 TypeMask typeFromNativeBehavior( |
| 953 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld); | 940 native.NativeBehavior nativeBehavior, ClosedWorld closedWorld); |
| 954 } | 941 } |
| 942 | |
| 943 /// Map from kernel IR nodes to local entities. | |
| 944 abstract class KernelToLocalsMap { | |
| 945 // TODO(johnniwinther): Make these return the [KernelToLocalsMap] to use from | |
| 946 // now on. | |
| 947 /// Call to notify that [member] is currently being inlined. | |
| 948 void enterInlinedMember(MemberEntity member); | |
| 949 | |
| 950 /// Call to notify that [member] is no longer being inlined. | |
| 951 void leaveInlinedMember(MemberEntity member); | |
| 952 | |
| 953 /// Returns the [Local] for [node]. | |
| 954 Local getLocal(ir.VariableDeclaration node); | |
| 955 | |
| 956 /// Returns the [JumpTarget] for the branch in [node]. | |
| 957 // TODO(johnniwinther): Split this by kind of [node]? | |
| 958 JumpTarget getJumpTarget(ir.TreeNode node, {bool isContinueTarget: false}); | |
| 959 } | |
| OLD | NEW |