OLD | NEW |
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 closurelib; | 7 import '../closure.dart' as closurelib; |
8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
11 import '../dart2jslib.dart'; | 11 import '../dart2jslib.dart'; |
12 import '../elements/elements.dart'; | 12 import '../elements/elements.dart'; |
13 import '../elements/modelx.dart' show SynthesizedConstructorElementX, | 13 import '../elements/modelx.dart' show SynthesizedConstructorElementX, |
14 ConstructorBodyElementX, FunctionSignatureX; | 14 ConstructorBodyElementX, FunctionSignatureX; |
15 import '../io/source_information.dart'; | 15 import '../io/source_information.dart'; |
16 import '../js_backend/js_backend.dart' show JavaScriptBackend; | 16 import '../js_backend/js_backend.dart' show JavaScriptBackend; |
17 import '../resolution/semantic_visitor.dart'; | 17 import '../resolution/semantic_visitor.dart'; |
18 import '../resolution/operators.dart' as op; | 18 import '../resolution/operators.dart' as op; |
19 import '../tree/tree.dart' as ast; | 19 import '../tree/tree.dart' as ast; |
20 import '../universe/universe.dart' show SelectorKind, CallStructure; | 20 import '../universe/universe.dart' show SelectorKind, CallStructure; |
| 21 import '../constants/values.dart' show ConstantValue; |
21 import 'cps_ir_nodes.dart' as ir; | 22 import 'cps_ir_nodes.dart' as ir; |
22 import 'cps_ir_builder.dart'; | 23 import 'cps_ir_builder.dart'; |
23 import '../native/native.dart' show NativeBehavior; | 24 import '../native/native.dart' show NativeBehavior; |
24 | 25 |
25 // TODO(karlklose): remove. | 26 // TODO(karlklose): remove. |
26 import '../js/js.dart' as js show js, Template, Expression; | 27 import '../js/js.dart' as js show js, Template, Expression; |
27 import '../ssa/ssa.dart' show TypeMaskFactory; | 28 import '../ssa/ssa.dart' show TypeMaskFactory; |
28 import '../types/types.dart' show TypeMask; | 29 import '../types/types.dart' show TypeMask; |
29 import '../util/util.dart'; | 30 import '../util/util.dart'; |
30 | 31 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 variableElement: variableElement, | 347 variableElement: variableElement, |
347 variableSelector: selector, | 348 variableSelector: selector, |
348 buildBody: subbuild(node.body), | 349 buildBody: subbuild(node.body), |
349 target: elements.getTargetDefinition(node), | 350 target: elements.getTargetDefinition(node), |
350 closureScope: getClosureScopeForNode(node)); | 351 closureScope: getClosureScopeForNode(node)); |
351 } | 352 } |
352 | 353 |
353 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) { | 354 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) { |
354 assert(irBuilder.isOpen); | 355 assert(irBuilder.isOpen); |
355 if (node.modifiers.isConst) { | 356 if (node.modifiers.isConst) { |
356 for (ast.SendSet definition in node.definitions.nodes) { | 357 // Do nothing. |
357 assert(!definition.arguments.isEmpty); | 358 // handleLocalConstantGet inlines the constant at use-site. |
358 assert(definition.arguments.tail.isEmpty); | |
359 VariableElement element = elements[definition]; | |
360 ConstantExpression value = getConstantForVariable(element); | |
361 irBuilder.declareLocalConstant(element, value); | |
362 } | |
363 } else { | 359 } else { |
364 for (ast.Node definition in node.definitions.nodes) { | 360 for (ast.Node definition in node.definitions.nodes) { |
365 Element element = elements[definition]; | 361 Element element = elements[definition]; |
366 ir.Primitive initialValue; | 362 ir.Primitive initialValue; |
367 // Definitions are either SendSets if there is an initializer, or | 363 // Definitions are either SendSets if there is an initializer, or |
368 // Identifiers if there is no initializer. | 364 // Identifiers if there is no initializer. |
369 if (definition is ast.SendSet) { | 365 if (definition is ast.SendSet) { |
370 assert(!definition.arguments.isEmpty); | 366 assert(!definition.arguments.isEmpty); |
371 assert(definition.arguments.tail.isEmpty); | 367 assert(definition.arguments.tail.isEmpty); |
372 initialValue = visit(definition.arguments.head); | 368 initialValue = visit(definition.arguments.head); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 ir.Primitive visitLiteralNull(ast.LiteralNull node) { | 488 ir.Primitive visitLiteralNull(ast.LiteralNull node) { |
493 assert(irBuilder.isOpen); | 489 assert(irBuilder.isOpen); |
494 return irBuilder.buildNullConstant(); | 490 return irBuilder.buildNullConstant(); |
495 } | 491 } |
496 | 492 |
497 ir.Primitive visitLiteralString(ast.LiteralString node) { | 493 ir.Primitive visitLiteralString(ast.LiteralString node) { |
498 assert(irBuilder.isOpen); | 494 assert(irBuilder.isOpen); |
499 return irBuilder.buildDartStringConstant(node.dartString); | 495 return irBuilder.buildDartStringConstant(node.dartString); |
500 } | 496 } |
501 | 497 |
502 ConstantExpression getConstantForNode(ast.Node node) { | 498 ConstantValue getConstantForNode(ast.Node node) { |
503 ConstantExpression constant = | 499 return irBuilder.state.constants.getConstantValueForNode(node, elements); |
504 irBuilder.state.constants.getConstantForNode(node, elements); | |
505 assert(invariant(node, constant != null, | |
506 message: 'No constant computed for $node')); | |
507 return constant; | |
508 } | 500 } |
509 | 501 |
510 ConstantExpression getConstantForVariable(VariableElement element) { | 502 ConstantValue getConstantForVariable(VariableElement element) { |
511 ConstantExpression constant = | 503 return irBuilder.state.constants.getConstantValueForVariable(element); |
512 irBuilder.state.constants.getConstantForVariable(element); | |
513 assert(invariant(element, constant != null, | |
514 message: 'No constant computed for $element')); | |
515 return constant; | |
516 } | 504 } |
517 | 505 |
518 /// Builds a constant pulling the value from the constant environment. | 506 ir.Primitive buildConstantExpression(ConstantExpression expression) { |
519 // TODO(johnniwinther): Remove this when [IrBuilder.buildConstant] only takes | 507 return irBuilder.buildConstant( |
520 // a [ConstantExpression]. | |
521 ir.Primitive buildConstant(ConstantExpression expression) { | |
522 return irBuilder.buildConstant(expression, | |
523 irBuilder.state.constants.getConstantValue(expression)); | 508 irBuilder.state.constants.getConstantValue(expression)); |
524 } | 509 } |
525 | 510 |
526 ir.Primitive visitLiteralList(ast.LiteralList node) { | 511 ir.Primitive visitLiteralList(ast.LiteralList node) { |
527 if (node.isConst) { | 512 if (node.isConst) { |
528 return translateConstant(node); | 513 return translateConstant(node); |
529 } | 514 } |
530 List<ir.Primitive> values = node.elements.nodes.mapToList(visit); | 515 List<ir.Primitive> values = node.elements.nodes.mapToList(visit); |
531 InterfaceType type = elements.getType(node); | 516 InterfaceType type = elements.getType(node); |
532 return irBuilder.buildListLiteral(type, values); | 517 return irBuilder.buildListLiteral(type, values); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 /// Returns `true` if [node] is a super call. | 595 /// Returns `true` if [node] is a super call. |
611 // TODO(johnniwinther): Remove the need for this. | 596 // TODO(johnniwinther): Remove the need for this. |
612 bool isSuperCall(ast.Send node) { | 597 bool isSuperCall(ast.Send node) { |
613 return node != null && node.receiver != null && node.receiver.isSuper(); | 598 return node != null && node.receiver != null && node.receiver.isSuper(); |
614 } | 599 } |
615 | 600 |
616 @override | 601 @override |
617 ir.Primitive handleConstantGet( | 602 ir.Primitive handleConstantGet( |
618 ast.Node node, | 603 ast.Node node, |
619 ConstantExpression constant, _) { | 604 ConstantExpression constant, _) { |
620 return buildConstant(constant); | 605 return buildConstantExpression(constant); |
621 } | 606 } |
622 | 607 |
623 /// If [node] is null, returns this. | 608 /// If [node] is null, returns this. |
624 /// Otherwise visits [node] and returns the result. | 609 /// Otherwise visits [node] and returns the result. |
625 ir.Primitive translateReceiver(ast.Expression node) { | 610 ir.Primitive translateReceiver(ast.Expression node) { |
626 return node != null ? visit(node) : irBuilder.buildThis(); | 611 return node != null ? visit(node) : irBuilder.buildThis(); |
627 } | 612 } |
628 | 613 |
629 @override | 614 @override |
630 ir.Primitive handleDynamicGet( | 615 ir.Primitive handleDynamicGet( |
(...skipping 16 matching lines...) Expand all Loading... |
647 return irBuilder.buildIfNotNullSend( | 632 return irBuilder.buildIfNotNullSend( |
648 target, | 633 target, |
649 nested(() => irBuilder.buildDynamicGet(target, selector))); | 634 nested(() => irBuilder.buildDynamicGet(target, selector))); |
650 } | 635 } |
651 | 636 |
652 @override | 637 @override |
653 ir.Primitive visitDynamicTypeLiteralGet( | 638 ir.Primitive visitDynamicTypeLiteralGet( |
654 ast.Send node, | 639 ast.Send node, |
655 ConstantExpression constant, | 640 ConstantExpression constant, |
656 _) { | 641 _) { |
657 return buildConstant(constant); | 642 return buildConstantExpression(constant); |
658 } | 643 } |
659 | 644 |
660 @override | 645 @override |
661 ir.Primitive visitLocalVariableGet( | 646 ir.Primitive visitLocalVariableGet( |
662 ast.Send node, | 647 ast.Send node, |
663 LocalVariableElement element, | 648 LocalVariableElement element, |
664 _) { | 649 _) { |
665 return element.isConst | 650 return element.isConst |
666 ? buildConstant(getConstantForVariable(element)) | 651 ? irBuilder.buildConstant(getConstantForVariable(element)) |
667 : irBuilder.buildLocalVariableGet(element); | 652 : irBuilder.buildLocalVariableGet(element); |
668 } | 653 } |
669 | 654 |
670 @override | 655 @override |
671 ir.Primitive handleLocalGet( | 656 ir.Primitive handleLocalGet( |
672 ast.Send node, | 657 ast.Send node, |
673 LocalElement element, | 658 LocalElement element, |
674 _) { | 659 _) { |
675 return irBuilder.buildLocalVariableGet(element); | 660 return irBuilder.buildLocalVariableGet(element); |
676 } | 661 } |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 translateDynamicArguments(arguments, callStructure)); | 951 translateDynamicArguments(arguments, callStructure)); |
967 } | 952 } |
968 | 953 |
969 @override | 954 @override |
970 ir.Primitive handleConstantInvoke( | 955 ir.Primitive handleConstantInvoke( |
971 ast.Send node, | 956 ast.Send node, |
972 ConstantExpression constant, | 957 ConstantExpression constant, |
973 ast.NodeList arguments, | 958 ast.NodeList arguments, |
974 CallStructure callStructure, | 959 CallStructure callStructure, |
975 _) { | 960 _) { |
976 ir.Primitive target = buildConstant(constant); | 961 ir.Primitive target = buildConstantExpression(constant); |
977 return translateCallInvoke(target, arguments, callStructure); | 962 return translateCallInvoke(target, arguments, callStructure); |
978 } | 963 } |
979 | 964 |
980 @override | 965 @override |
981 ir.Primitive handleDynamicInvoke( | 966 ir.Primitive handleDynamicInvoke( |
982 ast.Send node, | 967 ast.Send node, |
983 ast.Node receiver, | 968 ast.Node receiver, |
984 ast.NodeList arguments, | 969 ast.NodeList arguments, |
985 Selector selector, | 970 Selector selector, |
986 _) { | 971 _) { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 return irBuilder.buildStaticSetterSet(setter, visit(rhs)); | 1280 return irBuilder.buildStaticSetterSet(setter, visit(rhs)); |
1296 } | 1281 } |
1297 | 1282 |
1298 @override | 1283 @override |
1299 ir.Primitive handleTypeLiteralConstantCompounds( | 1284 ir.Primitive handleTypeLiteralConstantCompounds( |
1300 ast.SendSet node, | 1285 ast.SendSet node, |
1301 ConstantExpression constant, | 1286 ConstantExpression constant, |
1302 CompoundRhs rhs, | 1287 CompoundRhs rhs, |
1303 arg) { | 1288 arg) { |
1304 return translateCompounds( | 1289 return translateCompounds( |
1305 getValue: () => buildConstant(constant), | 1290 getValue: () => buildConstantExpression(constant), |
1306 rhs: rhs, | 1291 rhs: rhs, |
1307 setValue: (value) {}); // The binary operator will throw before this. | 1292 setValue: (value) {}); // The binary operator will throw before this. |
1308 } | 1293 } |
1309 | 1294 |
1310 @override | 1295 @override |
1311 ir.Primitive handleDynamicCompounds( | 1296 ir.Primitive handleDynamicCompounds( |
1312 ast.Send node, | 1297 ast.Send node, |
1313 ast.Node receiver, | 1298 ast.Node receiver, |
1314 CompoundRhs rhs, | 1299 CompoundRhs rhs, |
1315 Selector getterSelector, | 1300 Selector getterSelector, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 setValue: (ir.Primitive result) { | 1501 setValue: (ir.Primitive result) { |
1517 if (isSetterValid) { | 1502 if (isSetterValid) { |
1518 irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result); | 1503 irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result); |
1519 } else { | 1504 } else { |
1520 buildInstanceNoSuchMethod( | 1505 buildInstanceNoSuchMethod( |
1521 new Selector.indexSet(), <ir.Primitive>[indexValue, result]); | 1506 new Selector.indexSet(), <ir.Primitive>[indexValue, result]); |
1522 } | 1507 } |
1523 }); | 1508 }); |
1524 } | 1509 } |
1525 | 1510 |
| 1511 /// Evaluates a string interpolation and appends each part to [accumulator] |
| 1512 /// (after stringify conversion). |
| 1513 void buildStringParts(ast.Node node, List<ir.Primitive> accumulator) { |
| 1514 if (node is ast.StringJuxtaposition) { |
| 1515 buildStringParts(node.first, accumulator); |
| 1516 buildStringParts(node.second, accumulator); |
| 1517 } else if (node is ast.StringInterpolation) { |
| 1518 buildStringParts(node.string, accumulator); |
| 1519 for (ast.StringInterpolationPart part in node.parts) { |
| 1520 buildStringParts(part.expression, accumulator); |
| 1521 buildStringParts(part.string, accumulator); |
| 1522 } |
| 1523 } else if (node is ast.LiteralString) { |
| 1524 // Empty strings often occur at the end of a string interpolation, |
| 1525 // do not bother to include them. |
| 1526 if (!node.dartString.isEmpty) { |
| 1527 accumulator.add(irBuilder.buildDartStringConstant(node.dartString)); |
| 1528 } |
| 1529 } else if (node is ast.ParenthesizedExpression) { |
| 1530 buildStringParts(node.expression, accumulator); |
| 1531 } else { |
| 1532 ir.Primitive value = visit(node); |
| 1533 accumulator.add(irBuilder.buildStringify(value)); |
| 1534 } |
| 1535 } |
| 1536 |
1526 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) { | 1537 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) { |
1527 assert(irBuilder.isOpen); | 1538 assert(irBuilder.isOpen); |
1528 ir.Primitive first = visit(node.first); | 1539 List<ir.Primitive> parts = <ir.Primitive>[]; |
1529 ir.Primitive second = visit(node.second); | 1540 buildStringParts(node, parts); |
1530 return irBuilder.buildStringConcatenation([first, second]); | 1541 return irBuilder.buildStringConcatenation(parts); |
1531 } | 1542 } |
1532 | 1543 |
1533 ir.Primitive visitStringInterpolation(ast.StringInterpolation node) { | 1544 ir.Primitive visitStringInterpolation(ast.StringInterpolation node) { |
1534 assert(irBuilder.isOpen); | 1545 assert(irBuilder.isOpen); |
1535 List<ir.Primitive> arguments = []; | 1546 List<ir.Primitive> parts = <ir.Primitive>[]; |
1536 arguments.add(visitLiteralString(node.string)); | 1547 buildStringParts(node, parts); |
1537 var it = node.parts.iterator; | 1548 return irBuilder.buildStringConcatenation(parts); |
1538 while (it.moveNext()) { | |
1539 ast.StringInterpolationPart part = it.current; | |
1540 arguments.add(visit(part.expression)); | |
1541 arguments.add(visitLiteralString(part.string)); | |
1542 } | |
1543 return irBuilder.buildStringConcatenation(arguments); | |
1544 } | 1549 } |
1545 | 1550 |
1546 ir.Primitive translateConstant(ast.Node node) { | 1551 ir.Primitive translateConstant(ast.Node node) { |
1547 assert(irBuilder.isOpen); | 1552 assert(irBuilder.isOpen); |
1548 return buildConstant(getConstantForNode(node)); | 1553 return irBuilder.buildConstant(getConstantForNode(node)); |
1549 } | 1554 } |
1550 | 1555 |
1551 ir.Primitive visitThrow(ast.Throw node) { | 1556 ir.Primitive visitThrow(ast.Throw node) { |
1552 assert(irBuilder.isOpen); | 1557 assert(irBuilder.isOpen); |
1553 // This function is not called for throw expressions occurring as | 1558 // This function is not called for throw expressions occurring as |
1554 // statements. | 1559 // statements. |
1555 return irBuilder.buildNonTailThrow(visit(node.expression)); | 1560 return irBuilder.buildNonTailThrow(visit(node.expression)); |
1556 } | 1561 } |
1557 | 1562 |
1558 ir.Primitive buildStaticNoSuchMethod( | 1563 ir.Primitive buildStaticNoSuchMethod( |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 JavaScriptBackend get _backend => _compiler.backend; | 2097 JavaScriptBackend get _backend => _compiler.backend; |
2093 | 2098 |
2094 GlobalProgramInformation(this._compiler); | 2099 GlobalProgramInformation(this._compiler); |
2095 | 2100 |
2096 /// Returns [true], if the analysis could not determine that the type | 2101 /// Returns [true], if the analysis could not determine that the type |
2097 /// arguments for the class [cls] are never used in the program. | 2102 /// arguments for the class [cls] are never used in the program. |
2098 bool requiresRuntimeTypesFor(ClassElement cls) { | 2103 bool requiresRuntimeTypesFor(ClassElement cls) { |
2099 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); | 2104 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); |
2100 } | 2105 } |
2101 | 2106 |
| 2107 FunctionElement get stringifyFunction { |
| 2108 return _backend.getStringInterpolationHelper(); |
| 2109 } |
| 2110 |
2102 FunctionElement get throwTypeErrorHelper => _backend.getThrowTypeError(); | 2111 FunctionElement get throwTypeErrorHelper => _backend.getThrowTypeError(); |
2103 | 2112 |
2104 ClassElement get nullClass => _compiler.nullClass; | 2113 ClassElement get nullClass => _compiler.nullClass; |
2105 | 2114 |
2106 DartType unaliasType(DartType type) => type.unalias(_compiler); | 2115 DartType unaliasType(DartType type) => type.unalias(_compiler); |
2107 | 2116 |
2108 TypeMask getTypeMaskForForeign(NativeBehavior behavior) { | 2117 TypeMask getTypeMaskForForeign(NativeBehavior behavior) { |
2109 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler); | 2118 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler); |
2110 } | 2119 } |
2111 } | 2120 } |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 [irBuilder.buildStringConstant(element.name)]); | 2883 [irBuilder.buildStringConstant(element.name)]); |
2875 } | 2884 } |
2876 | 2885 |
2877 @override | 2886 @override |
2878 ir.Primitive handleStaticFieldGet(ast.Send node, FieldElement field, _) { | 2887 ir.Primitive handleStaticFieldGet(ast.Send node, FieldElement field, _) { |
2879 SourceInformation src = sourceInformationBuilder.buildGet(node); | 2888 SourceInformation src = sourceInformationBuilder.buildGet(node); |
2880 return buildStaticFieldGet(field, src); | 2889 return buildStaticFieldGet(field, src); |
2881 } | 2890 } |
2882 | 2891 |
2883 ir.Primitive buildStaticFieldGet(FieldElement field, SourceInformation src) { | 2892 ir.Primitive buildStaticFieldGet(FieldElement field, SourceInformation src) { |
2884 ConstantExpression constant = | 2893 ConstantValue constant = getConstantForVariable(field); |
2885 backend.constants.getConstantForVariable(field); | |
2886 if (constant != null && !field.isAssignable) { | 2894 if (constant != null && !field.isAssignable) { |
2887 return buildConstant(constant); | 2895 return irBuilder.buildConstant(constant); |
2888 } else if (backend.constants.lazyStatics.contains(field)) { | 2896 } else if (backend.constants.lazyStatics.contains(field)) { |
2889 return irBuilder.buildStaticFieldLazyGet(field, src); | 2897 return irBuilder.buildStaticFieldLazyGet(field, src); |
2890 } else { | 2898 } else { |
2891 return irBuilder.buildStaticFieldGet(field, src); | 2899 return irBuilder.buildStaticFieldGet(field, src); |
2892 } | 2900 } |
2893 } | 2901 } |
2894 | 2902 |
2895 /// Build code to handle foreign code, that is, native JavaScript code, or | 2903 /// Build code to handle foreign code, that is, native JavaScript code, or |
2896 /// builtin values and operations of the backend. | 2904 /// builtin values and operations of the backend. |
2897 ir.Primitive handleForeignCode(ast.Send node, | 2905 ir.Primitive handleForeignCode(ast.Send node, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3021 | 3029 |
3022 case 'JS_INTERCEPTOR_CONSTANT': | 3030 case 'JS_INTERCEPTOR_CONSTANT': |
3023 validateArgumentCount(exactly: 1); | 3031 validateArgumentCount(exactly: 1); |
3024 | 3032 |
3025 ast.Node argument = argumentNodes.head; | 3033 ast.Node argument = argumentNodes.head; |
3026 ir.Primitive argumentValue = visit(argument); | 3034 ir.Primitive argumentValue = visit(argument); |
3027 if (argumentValue is ir.Constant && argumentValue.value.isType) { | 3035 if (argumentValue is ir.Constant && argumentValue.value.isType) { |
3028 TypeConstantValue constant = argumentValue.value; | 3036 TypeConstantValue constant = argumentValue.value; |
3029 ConstantValue interceptorValue = | 3037 ConstantValue interceptorValue = |
3030 new InterceptorConstantValue(constant.representedType); | 3038 new InterceptorConstantValue(constant.representedType); |
3031 return irBuilder.buildConstant(argumentValue.expression, | 3039 return irBuilder.buildConstant(interceptorValue); |
3032 interceptorValue); | |
3033 } else { | 3040 } else { |
3034 internalError(argument, 'expected Type as argument'); | 3041 internalError(argument, 'expected Type as argument'); |
3035 } | 3042 } |
3036 break; | 3043 break; |
3037 | 3044 |
3038 case 'JS_EFFECT': | 3045 case 'JS_EFFECT': |
3039 return irBuilder.buildNullConstant(); | 3046 return irBuilder.buildNullConstant(); |
3040 | 3047 |
3041 case 'JS_GET_NAME': | 3048 case 'JS_GET_NAME': |
3042 validateArgumentCount(exactly: 1); | 3049 validateArgumentCount(exactly: 1); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3169 } | 3176 } |
3170 | 3177 |
3171 processSetStatic(ir.SetStatic node) { | 3178 processSetStatic(ir.SetStatic node) { |
3172 node.body = replacementFor(node.body); | 3179 node.body = replacementFor(node.body); |
3173 } | 3180 } |
3174 | 3181 |
3175 processContinuation(ir.Continuation node) { | 3182 processContinuation(ir.Continuation node) { |
3176 node.body = replacementFor(node.body); | 3183 node.body = replacementFor(node.body); |
3177 } | 3184 } |
3178 } | 3185 } |
OLD | NEW |