| Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| index 8ea98e335a3eec3d501e1e4f38c27686efc71c92..b5a458c26db567032d40e9211aa509d3b8752ee9 100644
|
| --- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| +++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| @@ -9,7 +9,12 @@ import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
|
| import '../common/names.dart';
|
| import '../common/tasks.dart' show CompilerTask;
|
| import '../compiler.dart';
|
| -import '../constants/values.dart' show StringConstantValue;
|
| +import '../constants/values.dart'
|
| + show
|
| + ConstantValue,
|
| + InterceptorConstantValue,
|
| + StringConstantValue,
|
| + TypeConstantValue;
|
| import '../dart_types.dart';
|
| import '../elements/elements.dart';
|
| import '../io/source_information.dart';
|
| @@ -868,6 +873,24 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| }
|
|
|
| @override
|
| + void visitTypeLiteral(ir.TypeLiteral typeLiteral) {
|
| + ir.DartType type = typeLiteral.type;
|
| + if (type is ir.InterfaceType) {
|
| + ConstantValue constant = astAdapter.getConstantForType(type);
|
| + stack.add(graph.addConstant(constant, compiler));
|
| + return;
|
| + }
|
| + if (type is ir.TypeParameterType) {
|
| + // TODO(27394): Load type parameter from current 'this' object.
|
| + defaultExpression(typeLiteral);
|
| + return;
|
| + }
|
| + // TODO(27394): 'dynamic' and function types observed. Where are they from?
|
| + defaultExpression(typeLiteral);
|
| + return;
|
| + }
|
| +
|
| + @override
|
| void visitStaticGet(ir.StaticGet staticGet) {
|
| ir.Member staticTarget = staticGet.target;
|
| if (staticTarget is ir.Procedure &&
|
| @@ -1311,7 +1334,30 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| }
|
|
|
| void handleJsInterceptorConstant(ir.StaticInvocation invocation) {
|
| - unhandledForeign(invocation);
|
| + // Single argument must be a TypeConstant which is converted into a
|
| + // InterceptorConstant.
|
| + if (_unexpectedForeignArguments(invocation, 1, 1)) {
|
| + stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
|
| + return;
|
| + }
|
| + ir.Expression argument = invocation.arguments.positional.single;
|
| + argument.accept(this);
|
| + HInstruction argumentInstruction = pop();
|
| + if (argumentInstruction is HConstant) {
|
| + ConstantValue argumentConstant = argumentInstruction.constant;
|
| + if (argumentConstant is TypeConstantValue) {
|
| + // TODO(sra): Check that type is a subclass of [Interceptor].
|
| + ConstantValue constant =
|
| + new InterceptorConstantValue(argumentConstant.representedType);
|
| + HInstruction instruction = graph.addConstant(constant, compiler);
|
| + stack.add(instruction);
|
| + return;
|
| + }
|
| + }
|
| +
|
| + compiler.reporter.reportErrorMessage(astAdapter.getNode(invocation),
|
| + MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
|
| + stack.add(graph.addConstantNull(compiler));
|
| }
|
|
|
| void handleForeignJs(ir.StaticInvocation invocation) {
|
|
|