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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1574543003: dart2js: Start creating IR nodes in the IrBuilderVisitor class. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closure; 7 import '../closure.dart' as closure;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Names, 10 Names,
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 irBuilder.add(new ir.LetPrim(instance)); 463 irBuilder.add(new ir.LetPrim(instance));
464 464
465 // --- Call constructor bodies --- 465 // --- Call constructor bodies ---
466 for (ConstructorElement target in constructorList) { 466 for (ConstructorElement target in constructorList) {
467 ConstructorBodyElement bodyElement = getConstructorBody(target); 467 ConstructorBodyElement bodyElement = getConstructorBody(target);
468 if (bodyElement == null) continue; // Skip if constructor has no body. 468 if (bodyElement == null) continue; // Skip if constructor has no body.
469 List<ir.Primitive> bodyArguments = <ir.Primitive>[]; 469 List<ir.Primitive> bodyArguments = <ir.Primitive>[];
470 for (Local param in getConstructorBodyParameters(bodyElement)) { 470 for (Local param in getConstructorBodyParameters(bodyElement)) {
471 bodyArguments.add(irBuilder.environment.lookup(param)); 471 bodyArguments.add(irBuilder.environment.lookup(param));
472 } 472 }
473 irBuilder.buildInvokeDirectly(bodyElement, instance, bodyArguments); 473 Selector selector = new Selector.call(target.memberName,
474 new CallStructure(bodyArguments.length));
475 irBuilder.addPrimitive(new ir.InvokeMethodDirectly(
476 instance, bodyElement, selector, bodyArguments, null));
474 } 477 }
475 478
476 // --- step 4: return the created object ---- 479 // --- step 4: return the created object ----
477 irBuilder.buildReturn( 480 irBuilder.buildReturn(
478 value: instance, 481 value: instance,
479 sourceInformation: 482 sourceInformation:
480 sourceInformationBuilder.buildImplicitReturn(constructor)); 483 sourceInformationBuilder.buildImplicitReturn(constructor));
481 484
482 return irBuilder.makeFunctionDefinition(); 485 return irBuilder.makeFunctionDefinition();
483 }); 486 });
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 target: elements.getTargetDefinition(node), 1058 target: elements.getTargetDefinition(node),
1056 closureScope: getClosureScopeForNode(node)); 1059 closureScope: getClosureScopeForNode(node));
1057 } 1060 }
1058 1061
1059 visitAsyncForIn(ast.AsyncForIn node) { 1062 visitAsyncForIn(ast.AsyncForIn node) {
1060 // await for is not yet implemented. 1063 // await for is not yet implemented.
1061 return giveup(node, 'await for'); 1064 return giveup(node, 'await for');
1062 } 1065 }
1063 1066
1064 visitAwait(ast.Await node) { 1067 visitAwait(ast.Await node) {
1068 assert(irBuilder.isOpen);
1065 ir.Primitive value = visit(node.expression); 1069 ir.Primitive value = visit(node.expression);
1066 return irBuilder.buildAwait(value); 1070 return irBuilder.addPrimitive(new ir.Await(value));
1067 } 1071 }
1068 1072
1069 visitYield(ast.Yield node) { 1073 visitYield(ast.Yield node) {
1074 assert(irBuilder.isOpen);
1070 ir.Primitive value = visit(node.expression); 1075 ir.Primitive value = visit(node.expression);
1071 return irBuilder.buildYield(value, node.hasStar); 1076 return irBuilder.addPrimitive(new ir.Yield(value, node.hasStar));
1072 } 1077 }
1073 1078
1074 visitSyncForIn(ast.SyncForIn node) { 1079 visitSyncForIn(ast.SyncForIn node) {
1075 // [node.declaredIdentifier] can be either an [ast.VariableDefinitions] 1080 // [node.declaredIdentifier] can be either an [ast.VariableDefinitions]
1076 // (defining a new local variable) or a send designating some existing 1081 // (defining a new local variable) or a send designating some existing
1077 // variable. 1082 // variable.
1078 ast.Node identifier = node.declaredIdentifier; 1083 ast.Node identifier = node.declaredIdentifier;
1079 ast.VariableDefinitions variableDeclaration = 1084 ast.VariableDefinitions variableDeclaration =
1080 identifier.asVariableDefinitions(); 1085 identifier.asVariableDefinitions();
1081 Element variableElement = elements.getForInVariable(node); 1086 Element variableElement = elements.getForInVariable(node);
(...skipping 14 matching lines...) Expand all
1096 } 1101 }
1097 1102
1098 /// If compiling with trusted type annotations, assumes that [value] is 1103 /// If compiling with trusted type annotations, assumes that [value] is
1099 /// now known to be `null` or an instance of [type]. 1104 /// now known to be `null` or an instance of [type].
1100 /// 1105 ///
1101 /// This is also where we should add type checks in checked mode, but this 1106 /// This is also where we should add type checks in checked mode, but this
1102 /// is not supported yet. 1107 /// is not supported yet.
1103 ir.Primitive checkType(ir.Primitive value, DartType dartType) { 1108 ir.Primitive checkType(ir.Primitive value, DartType dartType) {
1104 if (!compiler.trustTypeAnnotations) return value; 1109 if (!compiler.trustTypeAnnotations) return value;
1105 TypeMask type = typeMaskSystem.subtypesOf(dartType).nullable(); 1110 TypeMask type = typeMaskSystem.subtypesOf(dartType).nullable();
1106 return irBuilder.buildRefinement(value, type); 1111 return irBuilder.addPrimitive(new ir.Refinement(value, type));
1107 } 1112 }
1108 1113
1109 ir.Primitive checkTypeVsElement(ir.Primitive value, TypedElement element) { 1114 ir.Primitive checkTypeVsElement(ir.Primitive value, TypedElement element) {
1110 return checkType(value, element.type); 1115 return checkType(value, element.type);
1111 } 1116 }
1112 1117
1113 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) { 1118 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) {
1114 assert(irBuilder.isOpen); 1119 assert(irBuilder.isOpen);
1115 for (ast.Node definition in node.definitions.nodes) { 1120 for (ast.Node definition in node.definitions.nodes) {
1116 Element element = elements[definition]; 1121 Element element = elements[definition];
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 // ## Sends ## 1389 // ## Sends ##
1385 @override 1390 @override
1386 void previsitDeferredAccess(ast.Send node, PrefixElement prefix, _) { 1391 void previsitDeferredAccess(ast.Send node, PrefixElement prefix, _) {
1387 if (prefix != null) buildCheckDeferredIsLoaded(prefix, node); 1392 if (prefix != null) buildCheckDeferredIsLoaded(prefix, node);
1388 } 1393 }
1389 1394
1390 /// Create a call to check that a deferred import has already been loaded. 1395 /// Create a call to check that a deferred import has already been loaded.
1391 ir.Primitive buildCheckDeferredIsLoaded(PrefixElement prefix, ast.Send node) { 1396 ir.Primitive buildCheckDeferredIsLoaded(PrefixElement prefix, ast.Send node) {
1392 SourceInformation sourceInformation = 1397 SourceInformation sourceInformation =
1393 sourceInformationBuilder.buildCall(node, node.selector); 1398 sourceInformationBuilder.buildCall(node, node.selector);
1399 ir.Primitive name = irBuilder.buildStringConstant(
1400 compiler.deferredLoadTask.getImportDeferName(node, prefix));
1401 ir.Primitive uri =
1402 irBuilder.buildStringConstant('${prefix.deferredImport.uri}');
1394 return irBuilder.buildStaticFunctionInvocation( 1403 return irBuilder.buildStaticFunctionInvocation(
1395 helpers.checkDeferredIsLoaded, 1404 helpers.checkDeferredIsLoaded,
1396 CallStructure.TWO_ARGS, <ir.Primitive>[ 1405 <ir.Primitive>[name, uri],
1397 irBuilder.buildStringConstant( 1406 sourceInformation: sourceInformation);
1398 compiler.deferredLoadTask.getImportDeferName(node, prefix)),
1399 irBuilder.buildStringConstant('${prefix.deferredImport.uri}'),
1400 ], sourceInformation: sourceInformation);
1401 } 1407 }
1402 1408
1403 ir.Primitive visitNamedArgument(ast.NamedArgument node) { 1409 ir.Primitive visitNamedArgument(ast.NamedArgument node) {
1404 assert(irBuilder.isOpen); 1410 assert(irBuilder.isOpen);
1405 return visit(node.expression); 1411 return visit(node.expression);
1406 } 1412 }
1407 1413
1408 @override 1414 @override
1409 ir.Primitive visitExpressionInvoke(ast.Send node, 1415 ir.Primitive visitExpressionInvoke(ast.Send node,
1410 ast.Node expression, 1416 ast.Node expression,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 /// pseudo-function on library prefixes of deferred imports. 1530 /// pseudo-function on library prefixes of deferred imports.
1525 ir.Primitive buildStaticGetterGet(MethodElement getter, ast.Send node) { 1531 ir.Primitive buildStaticGetterGet(MethodElement getter, ast.Send node) {
1526 SourceInformation sourceInformation = 1532 SourceInformation sourceInformation =
1527 sourceInformationBuilder.buildGet(node); 1533 sourceInformationBuilder.buildGet(node);
1528 if (getter.isDeferredLoaderGetter) { 1534 if (getter.isDeferredLoaderGetter) {
1529 PrefixElement prefix = getter.enclosingElement; 1535 PrefixElement prefix = getter.enclosingElement;
1530 ir.Primitive loadId = irBuilder.buildStringConstant( 1536 ir.Primitive loadId = irBuilder.buildStringConstant(
1531 compiler.deferredLoadTask.getImportDeferName(node, prefix)); 1537 compiler.deferredLoadTask.getImportDeferName(node, prefix));
1532 return irBuilder.buildStaticFunctionInvocation( 1538 return irBuilder.buildStaticFunctionInvocation(
1533 compiler.loadLibraryFunction, 1539 compiler.loadLibraryFunction,
1534 CallStructure.ONE_ARG, <ir.Primitive>[loadId], 1540 <ir.Primitive>[loadId],
1535 sourceInformation: sourceInformation); 1541 sourceInformation: sourceInformation);
1536 } else { 1542 } else {
1537 return irBuilder.buildStaticGetterGet(getter, sourceInformation); 1543 return irBuilder.buildStaticGetterGet(getter, sourceInformation);
1538 } 1544 }
1539 } 1545 }
1540 1546
1541 @override 1547 @override
1542 ir.Primitive visitSuperFieldGet( 1548 ir.Primitive visitSuperFieldGet(
1543 ast.Send node, 1549 ast.Send node,
1544 FieldElement field, 1550 FieldElement field,
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 MethodElement function, 2003 MethodElement function,
1998 ast.NodeList argumentsNode, 2004 ast.NodeList argumentsNode,
1999 CallStructure callStructure, 2005 CallStructure callStructure,
2000 _) { 2006 _) {
2001 if (compiler.backend.isForeign(function)) { 2007 if (compiler.backend.isForeign(function)) {
2002 return handleForeignCode(node, function, argumentsNode, callStructure); 2008 return handleForeignCode(node, function, argumentsNode, callStructure);
2003 } else { 2009 } else {
2004 List<ir.Primitive> arguments = <ir.Primitive>[]; 2010 List<ir.Primitive> arguments = <ir.Primitive>[];
2005 callStructure = translateStaticArguments(argumentsNode, function, 2011 callStructure = translateStaticArguments(argumentsNode, function,
2006 callStructure, arguments); 2012 callStructure, arguments);
2007 return irBuilder.buildStaticFunctionInvocation(function, 2013 Selector selector = new Selector.call(function.memberName, callStructure);
2008 callStructure, 2014 return irBuilder.buildInvokeStatic(function, selector, arguments,
2009 arguments,
2010 sourceInformation:
2011 sourceInformationBuilder.buildCall(node, node.selector)); 2015 sourceInformationBuilder.buildCall(node, node.selector));
2012 } 2016 }
2013 } 2017 }
2014 2018
2015 @override 2019 @override
2016 ir.Primitive handleStaticFunctionIncompatibleInvoke( 2020 ir.Primitive handleStaticFunctionIncompatibleInvoke(
2017 ast.Send node, 2021 ast.Send node,
2018 MethodElement function, 2022 MethodElement function,
2019 ast.NodeList arguments, 2023 ast.NodeList arguments,
2020 CallStructure callStructure, _) { 2024 CallStructure callStructure, _) {
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 /// its own isolate structure, that encapsulates dart2js's isolate. 2785 /// its own isolate structure, that encapsulates dart2js's isolate.
2782 ir.Primitive buildIsolateHelperInvocation(Element element, 2786 ir.Primitive buildIsolateHelperInvocation(Element element,
2783 CallStructure callStructure) { 2787 CallStructure callStructure) {
2784 if (element == null) { 2788 if (element == null) {
2785 reporter.internalError(node, 2789 reporter.internalError(node,
2786 'Isolate library and compiler mismatch.'); 2790 'Isolate library and compiler mismatch.');
2787 } 2791 }
2788 List<ir.Primitive> arguments = <ir.Primitive>[]; 2792 List<ir.Primitive> arguments = <ir.Primitive>[];
2789 callStructure = translateStaticArguments(argumentList, element, 2793 callStructure = translateStaticArguments(argumentList, element,
2790 callStructure, arguments); 2794 callStructure, arguments);
2791 return irBuilder.buildStaticFunctionInvocation( 2795 Selector selector = new Selector.call(element.memberName, callStructure);
2792 element, 2796 return irBuilder.buildInvokeStatic(element, selector, arguments,
2793 callStructure,
2794 arguments,
2795 sourceInformation:
2796 sourceInformationBuilder.buildCall(node, node.selector)); 2797 sourceInformationBuilder.buildCall(node, node.selector));
2797 } 2798 }
2798 2799
2799 /// Lookup the value of the enum described by [node]. 2800 /// Lookup the value of the enum described by [node].
2800 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) { 2801 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) {
2801 Element element = elements[node]; 2802 Element element = elements[node];
2802 if (element is! FieldElement || element.enclosingClass != enumClass) { 2803 if (element is! FieldElement || element.enclosingClass != enumClass) {
2803 internalError(node, 'expected a JsBuiltin enum value'); 2804 internalError(node, 'expected a JsBuiltin enum value');
2804 } 2805 }
2805 2806
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3006 } else if (node is ast.LiteralString) { 3007 } else if (node is ast.LiteralString) {
3007 // Empty strings often occur at the end of a string interpolation, 3008 // Empty strings often occur at the end of a string interpolation,
3008 // do not bother to include them. 3009 // do not bother to include them.
3009 if (!node.dartString.isEmpty) { 3010 if (!node.dartString.isEmpty) {
3010 accumulator.add(irBuilder.buildDartStringConstant(node.dartString)); 3011 accumulator.add(irBuilder.buildDartStringConstant(node.dartString));
3011 } 3012 }
3012 } else if (node is ast.ParenthesizedExpression) { 3013 } else if (node is ast.ParenthesizedExpression) {
3013 buildStringParts(node.expression, accumulator); 3014 buildStringParts(node.expression, accumulator);
3014 } else { 3015 } else {
3015 ir.Primitive value = visit(node); 3016 ir.Primitive value = visit(node);
3016 accumulator.add(irBuilder.buildStringify(value)); 3017 accumulator.add(irBuilder.buildStaticFunctionInvocation(
3018 helpers.stringInterpolationHelper,
3019 <ir.Primitive>[value]));
3017 } 3020 }
3018 } 3021 }
3019 3022
3020 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) { 3023 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) {
3021 assert(irBuilder.isOpen); 3024 assert(irBuilder.isOpen);
3022 List<ir.Primitive> parts = <ir.Primitive>[]; 3025 List<ir.Primitive> parts = <ir.Primitive>[];
3023 buildStringParts(node, parts); 3026 buildStringParts(node, parts);
3024 return irBuilder.buildStringConcatenation(parts); 3027 return irBuilder.buildStringConcatenation(parts);
3025 } 3028 }
3026 3029
(...skipping 21 matching lines...) Expand all
3048 ir.Primitive buildInstanceNoSuchMethod(Selector selector, 3051 ir.Primitive buildInstanceNoSuchMethod(Selector selector,
3049 TypeMask mask, 3052 TypeMask mask,
3050 List<ir.Primitive> arguments) { 3053 List<ir.Primitive> arguments) {
3051 return irBuilder.buildDynamicInvocation( 3054 return irBuilder.buildDynamicInvocation(
3052 irBuilder.buildThis(), 3055 irBuilder.buildThis(),
3053 Selectors.noSuchMethod_, 3056 Selectors.noSuchMethod_,
3054 mask, 3057 mask,
3055 [irBuilder.buildInvocationMirror(selector, arguments)]); 3058 [irBuilder.buildInvocationMirror(selector, arguments)]);
3056 } 3059 }
3057 3060
3058 ir.Primitive buildRuntimeError(String message) {
3059 return irBuilder.buildStaticFunctionInvocation(
3060 helpers.throwRuntimeError,
3061 new CallStructure.unnamed(1),
3062 [irBuilder.buildStringConstant(message)]);
3063 }
3064
3065 ir.Primitive buildAbstractClassInstantiationError(ClassElement element) {
3066 return irBuilder.buildStaticFunctionInvocation(
3067 helpers.throwAbstractClassInstantiationError,
3068 new CallStructure.unnamed(1),
3069 [irBuilder.buildStringConstant(element.name)]);
3070 }
3071
3072 @override 3061 @override
3073 ir.Primitive visitUnresolvedCompound( 3062 ir.Primitive visitUnresolvedCompound(
3074 ast.Send node, 3063 ast.Send node,
3075 Element element, 3064 Element element,
3076 op.AssignmentOperator operator, 3065 op.AssignmentOperator operator,
3077 ast.Node rhs, _) { 3066 ast.Node rhs, _) {
3078 // TODO(asgerf): What is unresolved? The getter and/or the setter? 3067 // TODO(asgerf): What is unresolved? The getter and/or the setter?
3079 // If it was the setter, we must evaluate the right-hand side. 3068 // If it was the setter, we must evaluate the right-hand side.
3080 return irBuilder.buildStaticNoSuchMethod(elements.getSelector(node), []); 3069 return irBuilder.buildStaticNoSuchMethod(elements.getSelector(node), []);
3081 } 3070 }
3082 3071
3083 @override 3072 @override
3084 ir.Primitive visitUnresolvedClassConstructorInvoke( 3073 ir.Primitive visitUnresolvedClassConstructorInvoke(
3085 ast.NewExpression node, 3074 ast.NewExpression node,
3086 Element element, 3075 Element element,
3087 DartType type, 3076 DartType type,
3088 ast.NodeList arguments, 3077 ast.NodeList arguments,
3089 Selector selector, _) { 3078 Selector selector, _) {
3090 // If the class is missing it's a runtime error. 3079 // If the class is missing it's a runtime error.
3091 return buildRuntimeError("Unresolved class: '${element.name}'"); 3080 ir.Primitive message =
3081 irBuilder.buildStringConstant("Unresolved class: '${element.name}'");
3082 return irBuilder.buildStaticFunctionInvocation(
3083 helpers.throwRuntimeError,
3084 <ir.Primitive>[message]);
3092 } 3085 }
3093 3086
3094 @override 3087 @override
3095 ir.Primitive visitUnresolvedConstructorInvoke( 3088 ir.Primitive visitUnresolvedConstructorInvoke(
3096 ast.NewExpression node, 3089 ast.NewExpression node,
3097 Element constructor, 3090 Element constructor,
3098 DartType type, 3091 DartType type,
3099 ast.NodeList argumentsNode, 3092 ast.NodeList argumentsNode,
3100 Selector selector, _) { 3093 Selector selector, _) {
3101 // If the class is there but the constructor is missing, it's an NSM error. 3094 // If the class is there but the constructor is missing, it's an NSM error.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 } 3241 }
3249 3242
3250 @override 3243 @override
3251 ir.Primitive visitAbstractClassConstructorInvoke( 3244 ir.Primitive visitAbstractClassConstructorInvoke(
3252 ast.NewExpression node, 3245 ast.NewExpression node,
3253 ConstructorElement element, 3246 ConstructorElement element,
3254 InterfaceType type, 3247 InterfaceType type,
3255 ast.NodeList arguments, 3248 ast.NodeList arguments,
3256 CallStructure callStructure, _) { 3249 CallStructure callStructure, _) {
3257 for (ast.Node argument in arguments) visit(argument); 3250 for (ast.Node argument in arguments) visit(argument);
3258 return buildAbstractClassInstantiationError(element.enclosingClass); 3251 ir.Primitive name =
3252 irBuilder.buildStringConstant(element.enclosingClass.name);
3253 return irBuilder.buildStaticFunctionInvocation(
3254 helpers.throwAbstractClassInstantiationError,
3255 <ir.Primitive>[name]);
3259 } 3256 }
3260 3257
3261 @override 3258 @override
3262 ir.Primitive handleFinalStaticFieldSet( 3259 ir.Primitive handleFinalStaticFieldSet(
3263 ast.SendSet node, 3260 ast.SendSet node,
3264 FieldElement field, 3261 FieldElement field,
3265 ast.Node rhs, _) { 3262 ast.Node rhs, _) {
3266 // TODO(asgerf): Include class name somehow for static class members? 3263 // TODO(asgerf): Include class name somehow for static class members?
3267 return irBuilder.buildStaticNoSuchMethod( 3264 return irBuilder.buildStaticNoSuchMethod(
3268 new Selector.setter(field.memberName), 3265 new Selector.setter(field.memberName),
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
3590 JavaScriptBackend get _backend => _compiler.backend; 3587 JavaScriptBackend get _backend => _compiler.backend;
3591 3588
3592 GlobalProgramInformation(this._compiler); 3589 GlobalProgramInformation(this._compiler);
3593 3590
3594 /// Returns [true], if the analysis could not determine that the type 3591 /// Returns [true], if the analysis could not determine that the type
3595 /// arguments for the class [cls] are never used in the program. 3592 /// arguments for the class [cls] are never used in the program.
3596 bool requiresRuntimeTypesFor(ClassElement cls) { 3593 bool requiresRuntimeTypesFor(ClassElement cls) {
3597 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); 3594 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls);
3598 } 3595 }
3599 3596
3600 FunctionElement get stringifyFunction {
3601 return _backend.helpers.stringInterpolationHelper;
3602 }
3603
3604 FunctionElement get throwTypeErrorHelper => _backend.helpers.throwTypeError; 3597 FunctionElement get throwTypeErrorHelper => _backend.helpers.throwTypeError;
3605 Element get throwNoSuchMethod => _backend.helpers.throwNoSuchMethod; 3598 Element get throwNoSuchMethod => _backend.helpers.throwNoSuchMethod;
3606 3599
3607 ClassElement get nullClass => _compiler.coreClasses.nullClass; 3600 ClassElement get nullClass => _compiler.coreClasses.nullClass;
3608 3601
3609 DartType unaliasType(DartType type) => type.unaliased; 3602 DartType unaliasType(DartType type) => type.unaliased;
3610 3603
3611 TypeMask getTypeMaskForForeign(NativeBehavior behavior) { 3604 TypeMask getTypeMaskForForeign(NativeBehavior behavior) {
3612 if (behavior == null) { 3605 if (behavior == null) {
3613 return _backend.dynamicType; 3606 return _backend.dynamicType;
3614 } 3607 }
3615 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler); 3608 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler);
3616 } 3609 }
3617 3610
3618 FieldElement locateSingleField(Selector selector, TypeMask type) { 3611 FieldElement locateSingleField(Selector selector, TypeMask type) {
3619 return _compiler.world.locateSingleField(selector, type); 3612 return _compiler.world.locateSingleField(selector, type);
3620 } 3613 }
3621 3614
3622 Element get closureConverter { 3615 Element get closureConverter {
3623 return _backend.helpers.closureConverter; 3616 return _backend.helpers.closureConverter;
3624 } 3617 }
3625 3618
3626 void addNativeMethod(FunctionElement function) { 3619 void addNativeMethod(FunctionElement function) {
3627 _backend.emitter.nativeEmitter.nativeMethods.add(function); 3620 _backend.emitter.nativeEmitter.nativeMethods.add(function);
3628 } 3621 }
3629 } 3622 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698