| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'package:kernel/ast.dart' as ir; |
| 6 |
| 7 import '../elements/elements.dart'; |
| 8 import '../elements/entities.dart'; |
| 9 import '../elements/types.dart'; |
| 10 import '../native/native.dart' as native; |
| 11 import '../universe/call_structure.dart'; |
| 12 import '../universe/selector.dart'; |
| 13 |
| 14 /// Interface that translates between Kernel IR nodes and entities. |
| 15 abstract class KernelElementAdapter { |
| 16 /// Returns the [DartType] corresponding to [type]. |
| 17 DartType getDartType(ir.DartType type); |
| 18 |
| 19 /// Returns the list of [DartType]s corresponding to [types]. |
| 20 List<DartType> getDartTypes(List<ir.DartType> types); |
| 21 |
| 22 /// Returns the [InterfaceType] corresponding to [type]. |
| 23 InterfaceType getInterfaceType(ir.InterfaceType type); |
| 24 |
| 25 /// Return the [InterfaceType] corresponding to the [cls] with the given |
| 26 /// [typeArguments]. |
| 27 InterfaceType createInterfaceType( |
| 28 ir.Class cls, List<ir.DartType> typeArguments); |
| 29 |
| 30 /// Returns the [CallStructure] corresponding to the [arguments]. |
| 31 CallStructure getCallStructure(ir.Arguments arguments); |
| 32 |
| 33 /// Returns the [Selector] corresponding to the invocation or getter/setter |
| 34 /// access of [node]. |
| 35 Selector getSelector(ir.Expression node); |
| 36 |
| 37 /// Returns the [FunctionEntity] corresponding to the generative or factory |
| 38 /// constructor [node]. |
| 39 FunctionEntity getConstructor(ir.Member node); |
| 40 |
| 41 /// Returns the [MemberEntity] corresponding to the member [node]. |
| 42 MemberEntity getMember(ir.Member node); |
| 43 |
| 44 /// Returns the [FunctionEntity] corresponding to the procedure [node]. |
| 45 FunctionEntity getMethod(ir.Procedure node); |
| 46 |
| 47 /// Returns the [FieldEntity] corresponding to the field [node]. |
| 48 FieldEntity getField(ir.Field node); |
| 49 |
| 50 /// Returns the [ClassEntity] corresponding to the class [node]. |
| 51 ClassEntity getClass(ir.Class node); |
| 52 |
| 53 /// Returns the [Local] corresponding to the [node]. The node must be either |
| 54 /// a [ir.FunctionDeclaration] or [ir.FunctionExpression]. |
| 55 Local getLocalFunction(ir.Node node); |
| 56 |
| 57 /// Returns the [Name] corresponding to [name]. |
| 58 Name getName(ir.Name name); |
| 59 |
| 60 /// Returns `true` is [node] has a `@Native(...)` annotation. |
| 61 bool isNativeClass(ir.Class node); |
| 62 |
| 63 /// Return `true` if [node] is the `dart:_foreign_helper` library. |
| 64 bool isForeignLibrary(ir.Library node); |
| 65 |
| 66 /// Computes the native behavior for reading the native [field]. |
| 67 native.NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field); |
| 68 |
| 69 /// Computes the native behavior for writing to the native [field]. |
| 70 native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field); |
| 71 |
| 72 /// Computes the native behavior for calling [procedure]. |
| 73 native.NativeBehavior getNativeBehaviorForMethod(ir.Procedure procedure); |
| 74 |
| 75 /// Computes the [native.NativeBehavior] for a call to the [JS] function. |
| 76 native.NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node); |
| 77 |
| 78 /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN] |
| 79 /// function. |
| 80 native.NativeBehavior getNativeBehaviorForJsBuiltinCall( |
| 81 ir.StaticInvocation node); |
| 82 |
| 83 /// Computes the [native.NativeBehavior] for a call to the |
| 84 /// [JS_EMBEDDED_GLOBAL] function. |
| 85 native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall( |
| 86 ir.StaticInvocation node); |
| 87 |
| 88 /// Compute the kind of foreign helper function called by [node], if any. |
| 89 ForeignKind getForeignKind(ir.StaticInvocation node); |
| 90 |
| 91 /// Computes the [InterfaceType] referenced by a call to the |
| 92 /// [JS_INTERCEPTOR_CONSTANT] function, if any. |
| 93 InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node); |
| 94 } |
| 95 |
| 96 /// Kinds of foreign functions. |
| 97 enum ForeignKind { |
| 98 JS, |
| 99 JS_BUILTIN, |
| 100 JS_EMBEDDED_GLOBAL, |
| 101 JS_INTERCEPTOR_CONSTANT, |
| 102 NONE, |
| 103 } |
| OLD | NEW |