| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.body_builder; | 5 library fasta.body_builder; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
| 8 hide InvalidExpression, InvalidInitializer, InvalidStatement; | 8 hide InvalidExpression, InvalidInitializer, InvalidStatement; |
| 9 | 9 |
| 10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; | 10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 var statement = statements[i]; | 267 var statement = statements[i]; |
| 268 if (statement is List) { | 268 if (statement is List) { |
| 269 copy ??= new List<Statement>.from(statements.getRange(0, i)); | 269 copy ??= new List<Statement>.from(statements.getRange(0, i)); |
| 270 // TODO(sigmund): remove this assignment (issue #28651) | 270 // TODO(sigmund): remove this assignment (issue #28651) |
| 271 Iterable subStatements = statement; | 271 Iterable subStatements = statement; |
| 272 copy.addAll(subStatements); | 272 copy.addAll(subStatements); |
| 273 } else if (copy != null) { | 273 } else if (copy != null) { |
| 274 copy.add(statement); | 274 copy.add(statement); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 return new KernelBlock(copy ?? statements) | 277 return new ShadowBlock(copy ?? statements) |
| 278 ..fileOffset = offsetForToken(beginToken); | 278 ..fileOffset = offsetForToken(beginToken); |
| 279 } | 279 } |
| 280 | 280 |
| 281 Statement popStatementIfNotNull(Object value) { | 281 Statement popStatementIfNotNull(Object value) { |
| 282 return value == null ? null : popStatement(); | 282 return value == null ? null : popStatement(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 Statement popStatement() { | 285 Statement popStatement() { |
| 286 var statement = pop(); | 286 var statement = pop(); |
| 287 if (statement is List) { | 287 if (statement is List) { |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 target.addAnnotation(annotation); | 604 target.addAnnotation(annotation); |
| 605 } | 605 } |
| 606 if (formals?.optional != null) { | 606 if (formals?.optional != null) { |
| 607 Iterator<FormalParameterBuilder> formalBuilders = | 607 Iterator<FormalParameterBuilder> formalBuilders = |
| 608 builder.formals.skip(formals.required.length).iterator; | 608 builder.formals.skip(formals.required.length).iterator; |
| 609 for (VariableDeclaration parameter in formals.optional.formals) { | 609 for (VariableDeclaration parameter in formals.optional.formals) { |
| 610 bool hasMore = formalBuilders.moveNext(); | 610 bool hasMore = formalBuilders.moveNext(); |
| 611 assert(hasMore); | 611 assert(hasMore); |
| 612 VariableDeclaration realParameter = formalBuilders.current.target; | 612 VariableDeclaration realParameter = formalBuilders.current.target; |
| 613 Expression initializer = | 613 Expression initializer = |
| 614 parameter.initializer ?? new KernelNullLiteral(); | 614 parameter.initializer ?? new ShadowNullLiteral(); |
| 615 _typeInferrer.inferParameterInitializer( | 615 _typeInferrer.inferParameterInitializer( |
| 616 initializer, realParameter.type); | 616 initializer, realParameter.type); |
| 617 realParameter.initializer = initializer..parent = realParameter; | 617 realParameter.initializer = initializer..parent = realParameter; |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 if (builder is KernelConstructorBuilder) { | 620 if (builder is KernelConstructorBuilder) { |
| 621 finishConstructor(builder, asyncModifier); | 621 finishConstructor(builder, asyncModifier); |
| 622 } else if (builder is KernelProcedureBuilder) { | 622 } else if (builder is KernelProcedureBuilder) { |
| 623 builder.asyncModifier = asyncModifier; | 623 builder.asyncModifier = asyncModifier; |
| 624 } else { | 624 } else { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 /// >and no body is provided, then c implicitly has an empty body {}. | 678 /// >and no body is provided, then c implicitly has an empty body {}. |
| 679 /// We use an empty statement instead. | 679 /// We use an empty statement instead. |
| 680 constructor.function.body = new EmptyStatement(); | 680 constructor.function.body = new EmptyStatement(); |
| 681 constructor.function.body.parent = constructor.function; | 681 constructor.function.body.parent = constructor.function; |
| 682 } | 682 } |
| 683 } | 683 } |
| 684 | 684 |
| 685 @override | 685 @override |
| 686 void endExpressionStatement(Token token) { | 686 void endExpressionStatement(Token token) { |
| 687 debugEvent("ExpressionStatement"); | 687 debugEvent("ExpressionStatement"); |
| 688 push(new KernelExpressionStatement(popForEffect())); | 688 push(new ShadowExpressionStatement(popForEffect())); |
| 689 } | 689 } |
| 690 | 690 |
| 691 @override | 691 @override |
| 692 void endArguments(int count, Token beginToken, Token endToken) { | 692 void endArguments(int count, Token beginToken, Token endToken) { |
| 693 debugEvent("Arguments"); | 693 debugEvent("Arguments"); |
| 694 List arguments = popList(count) ?? <Expression>[]; | 694 List arguments = popList(count) ?? <Expression>[]; |
| 695 int firstNamedArgumentIndex = arguments.length; | 695 int firstNamedArgumentIndex = arguments.length; |
| 696 for (int i = 0; i < arguments.length; i++) { | 696 for (int i = 0; i < arguments.length; i++) { |
| 697 var node = arguments[i]; | 697 var node = arguments[i]; |
| 698 if (node is NamedExpression) { | 698 if (node is NamedExpression) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 "Duplicated named argument '${expression.name}'.", | 734 "Duplicated named argument '${expression.name}'.", |
| 735 expression.fileOffset); | 735 expression.fileOffset); |
| 736 } else { | 736 } else { |
| 737 seenNames[expression.name] = expression; | 737 seenNames[expression.name] = expression; |
| 738 } | 738 } |
| 739 } | 739 } |
| 740 if (hasProblem) { | 740 if (hasProblem) { |
| 741 named = new List<NamedExpression>.from(seenNames.values); | 741 named = new List<NamedExpression>.from(seenNames.values); |
| 742 } | 742 } |
| 743 } | 743 } |
| 744 push(new KernelArguments(positional, named: named) | 744 push(new ShadowArguments(positional, named: named) |
| 745 ..fileOffset = beginToken.charOffset); | 745 ..fileOffset = beginToken.charOffset); |
| 746 } else { | 746 } else { |
| 747 push(new KernelArguments(arguments)..fileOffset = beginToken.charOffset); | 747 push(new ShadowArguments(arguments)..fileOffset = beginToken.charOffset); |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 | 750 |
| 751 @override | 751 @override |
| 752 void handleParenthesizedExpression(Token token) { | 752 void handleParenthesizedExpression(Token token) { |
| 753 debugEvent("ParenthesizedExpression"); | 753 debugEvent("ParenthesizedExpression"); |
| 754 push(new ParenthesizedExpression( | 754 push(new ParenthesizedExpression( |
| 755 this, popForValue(), closeBraceTokenFor(token))); | 755 this, popForValue(), closeBraceTokenFor(token))); |
| 756 } | 756 } |
| 757 | 757 |
| 758 @override | 758 @override |
| 759 void handleSend(Token beginToken, Token endToken) { | 759 void handleSend(Token beginToken, Token endToken) { |
| 760 debugEvent("Send"); | 760 debugEvent("Send"); |
| 761 Arguments arguments = pop(); | 761 Arguments arguments = pop(); |
| 762 List<DartType> typeArguments = pop(); | 762 List<DartType> typeArguments = pop(); |
| 763 Object receiver = pop(); | 763 Object receiver = pop(); |
| 764 if (arguments != null && typeArguments != null) { | 764 if (arguments != null && typeArguments != null) { |
| 765 assert(arguments.types.isEmpty); | 765 assert(arguments.types.isEmpty); |
| 766 KernelArguments.setExplicitArgumentTypes(arguments, typeArguments); | 766 ShadowArguments.setExplicitArgumentTypes(arguments, typeArguments); |
| 767 } else { | 767 } else { |
| 768 assert(typeArguments == null); | 768 assert(typeArguments == null); |
| 769 } | 769 } |
| 770 if (receiver is Identifier) { | 770 if (receiver is Identifier) { |
| 771 Name name = new Name(receiver.name, library.library); | 771 Name name = new Name(receiver.name, library.library); |
| 772 if (arguments == null) { | 772 if (arguments == null) { |
| 773 push(new IncompletePropertyAccessor(this, beginToken, name)); | 773 push(new IncompletePropertyAccessor(this, beginToken, name)); |
| 774 } else { | 774 } else { |
| 775 push(new SendAccessor(this, beginToken, name, arguments)); | 775 push(new SendAccessor(this, beginToken, name, arguments)); |
| 776 } | 776 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 789 return buildMethodInvocation( | 789 return buildMethodInvocation( |
| 790 toValue(receiver), callName, arguments, charOffset, | 790 toValue(receiver), callName, arguments, charOffset, |
| 791 isImplicitCall: true); | 791 isImplicitCall: true); |
| 792 } | 792 } |
| 793 } | 793 } |
| 794 | 794 |
| 795 @override | 795 @override |
| 796 void beginCascade(Token token) { | 796 void beginCascade(Token token) { |
| 797 debugEvent("beginCascade"); | 797 debugEvent("beginCascade"); |
| 798 Expression expression = popForValue(); | 798 Expression expression = popForValue(); |
| 799 if (expression is KernelCascadeExpression) { | 799 if (expression is ShadowCascadeExpression) { |
| 800 push(expression); | 800 push(expression); |
| 801 push(new VariableAccessor(this, token, expression.variable)); | 801 push(new VariableAccessor(this, token, expression.variable)); |
| 802 expression.extend(); | 802 expression.extend(); |
| 803 } else { | 803 } else { |
| 804 VariableDeclaration variable = new KernelVariableDeclaration.forValue( | 804 VariableDeclaration variable = new ShadowVariableDeclaration.forValue( |
| 805 expression, functionNestingLevel); | 805 expression, functionNestingLevel); |
| 806 push(new KernelCascadeExpression(variable)); | 806 push(new ShadowCascadeExpression(variable)); |
| 807 push(new VariableAccessor(this, token, variable)); | 807 push(new VariableAccessor(this, token, variable)); |
| 808 } | 808 } |
| 809 } | 809 } |
| 810 | 810 |
| 811 @override | 811 @override |
| 812 void endCascade() { | 812 void endCascade() { |
| 813 debugEvent("endCascade"); | 813 debugEvent("endCascade"); |
| 814 Expression expression = popForEffect(); | 814 Expression expression = popForEffect(); |
| 815 KernelCascadeExpression cascadeReceiver = pop(); | 815 ShadowCascadeExpression cascadeReceiver = pop(); |
| 816 cascadeReceiver.finalize(expression); | 816 cascadeReceiver.finalize(expression); |
| 817 push(cascadeReceiver); | 817 push(cascadeReceiver); |
| 818 } | 818 } |
| 819 | 819 |
| 820 @override | 820 @override |
| 821 void beginCaseExpression(Token caseKeyword) { | 821 void beginCaseExpression(Token caseKeyword) { |
| 822 debugEvent("beginCaseExpression"); | 822 debugEvent("beginCaseExpression"); |
| 823 super.push(constantExpressionRequired); | 823 super.push(constantExpressionRequired); |
| 824 constantExpressionRequired = true; | 824 constantExpressionRequired = true; |
| 825 } | 825 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 842 return doLogicalExpression(token); | 842 return doLogicalExpression(token); |
| 843 } | 843 } |
| 844 if (optional("??", token)) return doIfNull(token); | 844 if (optional("??", token)) return doIfNull(token); |
| 845 if (optional("?.", token)) return doIfNotNull(token); | 845 if (optional("?.", token)) return doIfNotNull(token); |
| 846 Expression argument = popForValue(); | 846 Expression argument = popForValue(); |
| 847 var receiver = pop(); | 847 var receiver = pop(); |
| 848 bool isSuper = false; | 848 bool isSuper = false; |
| 849 if (receiver is ThisAccessor && receiver.isSuper) { | 849 if (receiver is ThisAccessor && receiver.isSuper) { |
| 850 ThisAccessor thisAccessorReceiver = receiver; | 850 ThisAccessor thisAccessorReceiver = receiver; |
| 851 isSuper = true; | 851 isSuper = true; |
| 852 receiver = new KernelThisExpression() | 852 receiver = new ShadowThisExpression() |
| 853 ..fileOffset = offsetForToken(thisAccessorReceiver.token); | 853 ..fileOffset = offsetForToken(thisAccessorReceiver.token); |
| 854 } | 854 } |
| 855 push(buildBinaryOperator(toValue(receiver), token, argument, isSuper)); | 855 push(buildBinaryOperator(toValue(receiver), token, argument, isSuper)); |
| 856 } | 856 } |
| 857 | 857 |
| 858 Expression buildBinaryOperator( | 858 Expression buildBinaryOperator( |
| 859 Expression a, Token token, Expression b, bool isSuper) { | 859 Expression a, Token token, Expression b, bool isSuper) { |
| 860 bool negate = false; | 860 bool negate = false; |
| 861 String operator = token.stringValue; | 861 String operator = token.stringValue; |
| 862 if (identical("!=", operator)) { | 862 if (identical("!=", operator)) { |
| 863 operator = "=="; | 863 operator = "=="; |
| 864 negate = true; | 864 negate = true; |
| 865 } | 865 } |
| 866 if (!isBinaryOperator(operator) && !isMinusOperator(operator)) { | 866 if (!isBinaryOperator(operator) && !isMinusOperator(operator)) { |
| 867 return deprecated_buildCompileTimeError( | 867 return deprecated_buildCompileTimeError( |
| 868 "Not an operator: '$operator'.", token.charOffset); | 868 "Not an operator: '$operator'.", token.charOffset); |
| 869 } else { | 869 } else { |
| 870 Expression result = | 870 Expression result = |
| 871 makeBinary(a, new Name(operator), null, b, offset: token.charOffset); | 871 makeBinary(a, new Name(operator), null, b, offset: token.charOffset); |
| 872 if (isSuper) { | 872 if (isSuper) { |
| 873 result = toSuperMethodInvocation(result); | 873 result = toSuperMethodInvocation(result); |
| 874 } | 874 } |
| 875 return negate ? new KernelNot(result) : result; | 875 return negate ? new ShadowNot(result) : result; |
| 876 } | 876 } |
| 877 } | 877 } |
| 878 | 878 |
| 879 void doLogicalExpression(Token token) { | 879 void doLogicalExpression(Token token) { |
| 880 Expression argument = popForValue(); | 880 Expression argument = popForValue(); |
| 881 Expression receiver = popForValue(); | 881 Expression receiver = popForValue(); |
| 882 push(new KernelLogicalExpression(receiver, token.stringValue, argument)); | 882 push(new ShadowLogicalExpression(receiver, token.stringValue, argument)); |
| 883 } | 883 } |
| 884 | 884 |
| 885 /// Handle `a ?? b`. | 885 /// Handle `a ?? b`. |
| 886 void doIfNull(Token token) { | 886 void doIfNull(Token token) { |
| 887 Expression b = popForValue(); | 887 Expression b = popForValue(); |
| 888 Expression a = popForValue(); | 888 Expression a = popForValue(); |
| 889 VariableDeclaration variable = new VariableDeclaration.forValue(a); | 889 VariableDeclaration variable = new VariableDeclaration.forValue(a); |
| 890 push(new KernelIfNullExpression( | 890 push(new ShadowIfNullExpression( |
| 891 variable, | 891 variable, |
| 892 new ConditionalExpression( | 892 new ConditionalExpression( |
| 893 buildIsNull(new VariableGet(variable), offsetForToken(token)), | 893 buildIsNull(new VariableGet(variable), offsetForToken(token)), |
| 894 b, | 894 b, |
| 895 new VariableGet(variable), | 895 new VariableGet(variable), |
| 896 null))); | 896 null))); |
| 897 } | 897 } |
| 898 | 898 |
| 899 /// Handle `a?.b(...)`. | 899 /// Handle `a?.b(...)`. |
| 900 void doIfNotNull(Token token) { | 900 void doIfNotNull(Token token) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 917 warnUnresolvedSuperMethod(node.name, node.fileOffset); | 917 warnUnresolvedSuperMethod(node.name, node.fileOffset); |
| 918 } else if (!areArgumentsCompatible(target.function, node.arguments)) { | 918 } else if (!areArgumentsCompatible(target.function, node.arguments)) { |
| 919 target = null; | 919 target = null; |
| 920 warning( | 920 warning( |
| 921 fasta.templateSuperclassMethodArgumentMismatch | 921 fasta.templateSuperclassMethodArgumentMismatch |
| 922 .withArguments(node.name.name), | 922 .withArguments(node.name.name), |
| 923 node.fileOffset); | 923 node.fileOffset); |
| 924 } | 924 } |
| 925 Expression result; | 925 Expression result; |
| 926 if (target != null) { | 926 if (target != null) { |
| 927 result = new KernelDirectMethodInvocation( | 927 result = new ShadowDirectMethodInvocation( |
| 928 new KernelThisExpression()..fileOffset = node.fileOffset, | 928 new ShadowThisExpression()..fileOffset = node.fileOffset, |
| 929 target, | 929 target, |
| 930 node.arguments); | 930 node.arguments); |
| 931 } | 931 } |
| 932 // TODO(ahe): Use [DirectMethodInvocation] when possible, that is, | 932 // TODO(ahe): Use [DirectMethodInvocation] when possible, that is, |
| 933 // make the next line conditional: | 933 // make the next line conditional: |
| 934 result = | 934 result = |
| 935 new KernelSuperMethodInvocation(node.name, node.arguments, target); | 935 new ShadowSuperMethodInvocation(node.name, node.arguments, target); |
| 936 return result..fileOffset = node.fileOffset; | 936 return result..fileOffset = node.fileOffset; |
| 937 } | 937 } |
| 938 | 938 |
| 939 Expression receiver = new KernelDirectPropertyGet( | 939 Expression receiver = new ShadowDirectPropertyGet( |
| 940 new KernelThisExpression()..fileOffset = node.fileOffset, target) | 940 new ShadowThisExpression()..fileOffset = node.fileOffset, target) |
| 941 ..fileOffset = node.fileOffset; | 941 ..fileOffset = node.fileOffset; |
| 942 // TODO(ahe): Use [DirectPropertyGet] when possible, that is, make the next | 942 // TODO(ahe): Use [DirectPropertyGet] when possible, that is, make the next |
| 943 // line conditional: | 943 // line conditional: |
| 944 receiver = new KernelSuperPropertyGet(node.name, target) | 944 receiver = new ShadowSuperPropertyGet(node.name, target) |
| 945 ..fileOffset = node.fileOffset; | 945 ..fileOffset = node.fileOffset; |
| 946 return buildMethodInvocation( | 946 return buildMethodInvocation( |
| 947 receiver, callName, node.arguments, node.arguments.fileOffset, | 947 receiver, callName, node.arguments, node.arguments.fileOffset, |
| 948 isImplicitCall: true); | 948 isImplicitCall: true); |
| 949 } | 949 } |
| 950 | 950 |
| 951 bool areArgumentsCompatible(FunctionNode function, Arguments arguments) { | 951 bool areArgumentsCompatible(FunctionNode function, Arguments arguments) { |
| 952 // TODO(ahe): Implement this. | 952 // TODO(ahe): Implement this. |
| 953 return true; | 953 return true; |
| 954 } | 954 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 976 return buildCompileTimeError(message, charOffset); | 976 return buildCompileTimeError(message, charOffset); |
| 977 } else { | 977 } else { |
| 978 Expression error = library.loader.instantiateNoSuchMethodError( | 978 Expression error = library.loader.instantiateNoSuchMethodError( |
| 979 receiver, name, arguments, charOffset, | 979 receiver, name, arguments, charOffset, |
| 980 isMethod: !isGetter && !isSetter, | 980 isMethod: !isGetter && !isSetter, |
| 981 isGetter: isGetter, | 981 isGetter: isGetter, |
| 982 isSetter: isSetter, | 982 isSetter: isSetter, |
| 983 isStatic: isStatic, | 983 isStatic: isStatic, |
| 984 isTopLevel: !isStatic && !isSuper); | 984 isTopLevel: !isStatic && !isSuper); |
| 985 warning(message, charOffset); | 985 warning(message, charOffset); |
| 986 return new KernelSyntheticExpression(new Throw(error)); | 986 return new ShadowSyntheticExpression(new Throw(error)); |
| 987 } | 987 } |
| 988 } | 988 } |
| 989 | 989 |
| 990 @override | 990 @override |
| 991 void warnUnresolvedSuperGet(Name name, int charOffset) { | 991 void warnUnresolvedSuperGet(Name name, int charOffset) { |
| 992 warning(fasta.templateSuperclassHasNoGetter.withArguments(name.name), | 992 warning(fasta.templateSuperclassHasNoGetter.withArguments(name.name), |
| 993 charOffset); | 993 charOffset); |
| 994 } | 994 } |
| 995 | 995 |
| 996 @override | 996 @override |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 return deprecated_buildCompileTimeError(message, offset); | 1086 return deprecated_buildCompileTimeError(message, offset); |
| 1087 } else if (!isQualified && isInstanceContext) { | 1087 } else if (!isQualified && isInstanceContext) { |
| 1088 assert(builder == null); | 1088 assert(builder == null); |
| 1089 if (constantExpressionRequired || member.isField) { | 1089 if (constantExpressionRequired || member.isField) { |
| 1090 return new UnresolvedAccessor(this, n, token); | 1090 return new UnresolvedAccessor(this, n, token); |
| 1091 } | 1091 } |
| 1092 return new ThisPropertyAccessor(this, token, n, null, null); | 1092 return new ThisPropertyAccessor(this, token, n, null, null); |
| 1093 } else if (ignoreMainInGetMainClosure && | 1093 } else if (ignoreMainInGetMainClosure && |
| 1094 name == "main" && | 1094 name == "main" && |
| 1095 member?.name == "_getMainClosure") { | 1095 member?.name == "_getMainClosure") { |
| 1096 return new KernelNullLiteral()..fileOffset = offsetForToken(token); | 1096 return new ShadowNullLiteral()..fileOffset = offsetForToken(token); |
| 1097 } else { | 1097 } else { |
| 1098 return new UnresolvedAccessor(this, n, token); | 1098 return new UnresolvedAccessor(this, n, token); |
| 1099 } | 1099 } |
| 1100 } else if (builder.isTypeDeclaration) { | 1100 } else if (builder.isTypeDeclaration) { |
| 1101 if (constantExpressionRequired && | 1101 if (constantExpressionRequired && |
| 1102 builder.isTypeVariable && | 1102 builder.isTypeVariable && |
| 1103 !member.isConstructor) { | 1103 !member.isConstructor) { |
| 1104 deprecated_addCompileTimeError( | 1104 deprecated_addCompileTimeError( |
| 1105 offsetForToken(token), "Not a constant expression."); | 1105 offsetForToken(token), "Not a constant expression."); |
| 1106 } | 1106 } |
| 1107 return new TypeDeclarationAccessor(this, builder, name, token); | 1107 return new TypeDeclarationAccessor(this, builder, name, token); |
| 1108 } else if (builder.isLocal) { | 1108 } else if (builder.isLocal) { |
| 1109 if (constantExpressionRequired && | 1109 if (constantExpressionRequired && |
| 1110 !builder.isConst && | 1110 !builder.isConst && |
| 1111 !member.isConstructor) { | 1111 !member.isConstructor) { |
| 1112 deprecated_addCompileTimeError( | 1112 deprecated_addCompileTimeError( |
| 1113 offsetForToken(token), "Not a constant expression."); | 1113 offsetForToken(token), "Not a constant expression."); |
| 1114 } | 1114 } |
| 1115 // An initializing formal parameter might be final without its | 1115 // An initializing formal parameter might be final without its |
| 1116 // VariableDeclaration being final. See | 1116 // VariableDeclaration being final. See |
| 1117 // [ProcedureBuilder.computeFormalParameterInitializerScope]. If that | 1117 // [ProcedureBuilder.computeFormalParameterInitializerScope]. If that |
| 1118 // wasn't the case, we could always use VariableAccessor. | 1118 // wasn't the case, we could always use VariableAccessor. |
| 1119 if (builder.isFinal) { | 1119 if (builder.isFinal) { |
| 1120 var fact = | 1120 var fact = |
| 1121 typePromoter.getFactForAccess(builder.target, functionNestingLevel); | 1121 typePromoter.getFactForAccess(builder.target, functionNestingLevel); |
| 1122 var scope = typePromoter.currentScope; | 1122 var scope = typePromoter.currentScope; |
| 1123 return new ReadOnlyAccessor( | 1123 return new ReadOnlyAccessor( |
| 1124 this, | 1124 this, |
| 1125 new KernelVariableGet(builder.target, fact, scope) | 1125 new ShadowVariableGet(builder.target, fact, scope) |
| 1126 ..fileOffset = offsetForToken(token), | 1126 ..fileOffset = offsetForToken(token), |
| 1127 name, | 1127 name, |
| 1128 token); | 1128 token); |
| 1129 } else { | 1129 } else { |
| 1130 return new VariableAccessor(this, token, builder.target); | 1130 return new VariableAccessor(this, token, builder.target); |
| 1131 } | 1131 } |
| 1132 } else if (builder.isInstanceMember) { | 1132 } else if (builder.isInstanceMember) { |
| 1133 if (constantExpressionRequired && | 1133 if (constantExpressionRequired && |
| 1134 !inInitializer && | 1134 !inInitializer && |
| 1135 // TODO(ahe): This is a hack because Fasta sets up the scope | 1135 // TODO(ahe): This is a hack because Fasta sets up the scope |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 debugEvent("StringPart"); | 1200 debugEvent("StringPart"); |
| 1201 push(token); | 1201 push(token); |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 @override | 1204 @override |
| 1205 void endLiteralString(int interpolationCount, Token endToken) { | 1205 void endLiteralString(int interpolationCount, Token endToken) { |
| 1206 debugEvent("endLiteralString"); | 1206 debugEvent("endLiteralString"); |
| 1207 if (interpolationCount == 0) { | 1207 if (interpolationCount == 0) { |
| 1208 Token token = pop(); | 1208 Token token = pop(); |
| 1209 String value = unescapeString(token.lexeme); | 1209 String value = unescapeString(token.lexeme); |
| 1210 push(new KernelStringLiteral(value)..fileOffset = offsetForToken(token)); | 1210 push(new ShadowStringLiteral(value)..fileOffset = offsetForToken(token)); |
| 1211 } else { | 1211 } else { |
| 1212 List parts = popList(1 + interpolationCount * 2); | 1212 List parts = popList(1 + interpolationCount * 2); |
| 1213 Token first = parts.first; | 1213 Token first = parts.first; |
| 1214 Token last = parts.last; | 1214 Token last = parts.last; |
| 1215 Quote quote = analyzeQuote(first.lexeme); | 1215 Quote quote = analyzeQuote(first.lexeme); |
| 1216 List<Expression> expressions = <Expression>[]; | 1216 List<Expression> expressions = <Expression>[]; |
| 1217 // Contains more than just \' or \". | 1217 // Contains more than just \' or \". |
| 1218 if (first.lexeme.length > 1) { | 1218 if (first.lexeme.length > 1) { |
| 1219 String value = unescapeFirstStringPart(first.lexeme, quote); | 1219 String value = unescapeFirstStringPart(first.lexeme, quote); |
| 1220 expressions.add( | 1220 expressions.add( |
| 1221 new KernelStringLiteral(value)..fileOffset = offsetForToken(first)); | 1221 new ShadowStringLiteral(value)..fileOffset = offsetForToken(first)); |
| 1222 } | 1222 } |
| 1223 for (int i = 1; i < parts.length - 1; i++) { | 1223 for (int i = 1; i < parts.length - 1; i++) { |
| 1224 var part = parts[i]; | 1224 var part = parts[i]; |
| 1225 if (part is Token) { | 1225 if (part is Token) { |
| 1226 if (part.lexeme.length != 0) { | 1226 if (part.lexeme.length != 0) { |
| 1227 String value = unescape(part.lexeme, quote); | 1227 String value = unescape(part.lexeme, quote); |
| 1228 expressions.add(new KernelStringLiteral(value) | 1228 expressions.add(new ShadowStringLiteral(value) |
| 1229 ..fileOffset = offsetForToken(part)); | 1229 ..fileOffset = offsetForToken(part)); |
| 1230 } | 1230 } |
| 1231 } else { | 1231 } else { |
| 1232 expressions.add(toValue(part)); | 1232 expressions.add(toValue(part)); |
| 1233 } | 1233 } |
| 1234 } | 1234 } |
| 1235 // Contains more than just \' or \". | 1235 // Contains more than just \' or \". |
| 1236 if (last.lexeme.length > 1) { | 1236 if (last.lexeme.length > 1) { |
| 1237 String value = unescapeLastStringPart(last.lexeme, quote); | 1237 String value = unescapeLastStringPart(last.lexeme, quote); |
| 1238 expressions.add( | 1238 expressions.add( |
| 1239 new KernelStringLiteral(value)..fileOffset = offsetForToken(last)); | 1239 new ShadowStringLiteral(value)..fileOffset = offsetForToken(last)); |
| 1240 } | 1240 } |
| 1241 push(new KernelStringConcatenation(expressions) | 1241 push(new ShadowStringConcatenation(expressions) |
| 1242 ..fileOffset = offsetForToken(endToken)); | 1242 ..fileOffset = offsetForToken(endToken)); |
| 1243 } | 1243 } |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 @override | 1246 @override |
| 1247 void handleScript(Token token) { | 1247 void handleScript(Token token) { |
| 1248 debugEvent("Script"); | 1248 debugEvent("Script"); |
| 1249 } | 1249 } |
| 1250 | 1250 |
| 1251 @override | 1251 @override |
| 1252 void handleStringJuxtaposition(int literalCount) { | 1252 void handleStringJuxtaposition(int literalCount) { |
| 1253 debugEvent("StringJuxtaposition"); | 1253 debugEvent("StringJuxtaposition"); |
| 1254 List<Expression> parts = popListForValue(literalCount); | 1254 List<Expression> parts = popListForValue(literalCount); |
| 1255 List<Expression> expressions; | 1255 List<Expression> expressions; |
| 1256 // Flatten string juxtapositions of string interpolation. | 1256 // Flatten string juxtapositions of string interpolation. |
| 1257 for (int i = 0; i < parts.length; i++) { | 1257 for (int i = 0; i < parts.length; i++) { |
| 1258 Expression part = parts[i]; | 1258 Expression part = parts[i]; |
| 1259 if (part is StringConcatenation) { | 1259 if (part is StringConcatenation) { |
| 1260 if (expressions == null) { | 1260 if (expressions == null) { |
| 1261 expressions = parts.sublist(0, i); | 1261 expressions = parts.sublist(0, i); |
| 1262 } | 1262 } |
| 1263 expressions.addAll(part.expressions); | 1263 expressions.addAll(part.expressions); |
| 1264 } else { | 1264 } else { |
| 1265 if (expressions != null) { | 1265 if (expressions != null) { |
| 1266 expressions.add(part); | 1266 expressions.add(part); |
| 1267 } | 1267 } |
| 1268 } | 1268 } |
| 1269 } | 1269 } |
| 1270 push(new KernelStringConcatenation(expressions ?? parts)); | 1270 push(new ShadowStringConcatenation(expressions ?? parts)); |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 @override | 1273 @override |
| 1274 void handleLiteralInt(Token token) { | 1274 void handleLiteralInt(Token token) { |
| 1275 debugEvent("LiteralInt"); | 1275 debugEvent("LiteralInt"); |
| 1276 int value = int.parse(token.lexeme, onError: (_) => null); | 1276 int value = int.parse(token.lexeme, onError: (_) => null); |
| 1277 if (value == null) { | 1277 if (value == null) { |
| 1278 push(buildCompileTimeError( | 1278 push(buildCompileTimeError( |
| 1279 fasta.templateIntegerLiteralIsOutOfRange.withArguments(token), | 1279 fasta.templateIntegerLiteralIsOutOfRange.withArguments(token), |
| 1280 token.charOffset)); | 1280 token.charOffset)); |
| 1281 } else { | 1281 } else { |
| 1282 push(new KernelIntLiteral(value)..fileOffset = offsetForToken(token)); | 1282 push(new ShadowIntLiteral(value)..fileOffset = offsetForToken(token)); |
| 1283 } | 1283 } |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 @override | 1286 @override |
| 1287 void handleEmptyFunctionBody(Token semicolon) { | 1287 void handleEmptyFunctionBody(Token semicolon) { |
| 1288 debugEvent("ExpressionFunctionBody"); | 1288 debugEvent("ExpressionFunctionBody"); |
| 1289 endBlockFunctionBody(0, null, semicolon); | 1289 endBlockFunctionBody(0, null, semicolon); |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 @override | 1292 @override |
| 1293 void handleExpressionFunctionBody(Token arrowToken, Token endToken) { | 1293 void handleExpressionFunctionBody(Token arrowToken, Token endToken) { |
| 1294 debugEvent("ExpressionFunctionBody"); | 1294 debugEvent("ExpressionFunctionBody"); |
| 1295 endReturnStatement(true, arrowToken.next, endToken); | 1295 endReturnStatement(true, arrowToken.next, endToken); |
| 1296 } | 1296 } |
| 1297 | 1297 |
| 1298 @override | 1298 @override |
| 1299 void endReturnStatement( | 1299 void endReturnStatement( |
| 1300 bool hasExpression, Token beginToken, Token endToken) { | 1300 bool hasExpression, Token beginToken, Token endToken) { |
| 1301 debugEvent("ReturnStatement"); | 1301 debugEvent("ReturnStatement"); |
| 1302 Expression expression = hasExpression ? popForValue() : null; | 1302 Expression expression = hasExpression ? popForValue() : null; |
| 1303 if (expression != null && inConstructor) { | 1303 if (expression != null && inConstructor) { |
| 1304 push(deprecated_buildCompileTimeErrorStatement( | 1304 push(deprecated_buildCompileTimeErrorStatement( |
| 1305 "Can't return from a constructor.", beginToken.charOffset)); | 1305 "Can't return from a constructor.", beginToken.charOffset)); |
| 1306 } else { | 1306 } else { |
| 1307 push(new KernelReturnStatement(expression) | 1307 push(new ShadowReturnStatement(expression) |
| 1308 ..fileOffset = beginToken.charOffset); | 1308 ..fileOffset = beginToken.charOffset); |
| 1309 } | 1309 } |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 @override | 1312 @override |
| 1313 void beginThenStatement(Token token) { | 1313 void beginThenStatement(Token token) { |
| 1314 Expression condition = popForValue(); | 1314 Expression condition = popForValue(); |
| 1315 typePromoter.enterThen(condition); | 1315 typePromoter.enterThen(condition); |
| 1316 push(condition); | 1316 push(condition); |
| 1317 super.beginThenStatement(token); | 1317 super.beginThenStatement(token); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 @override | 1320 @override |
| 1321 void endThenStatement(Token token) { | 1321 void endThenStatement(Token token) { |
| 1322 typePromoter.enterElse(); | 1322 typePromoter.enterElse(); |
| 1323 super.endThenStatement(token); | 1323 super.endThenStatement(token); |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 @override | 1326 @override |
| 1327 void endIfStatement(Token ifToken, Token elseToken) { | 1327 void endIfStatement(Token ifToken, Token elseToken) { |
| 1328 Statement elsePart = popStatementIfNotNull(elseToken); | 1328 Statement elsePart = popStatementIfNotNull(elseToken); |
| 1329 Statement thenPart = popStatement(); | 1329 Statement thenPart = popStatement(); |
| 1330 Expression condition = popForValue(); | 1330 Expression condition = popForValue(); |
| 1331 typePromoter.exitConditional(); | 1331 typePromoter.exitConditional(); |
| 1332 push(new KernelIfStatement(condition, thenPart, elsePart)); | 1332 push(new ShadowIfStatement(condition, thenPart, elsePart)); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 @override | 1335 @override |
| 1336 void endVariableInitializer(Token assignmentOperator) { | 1336 void endVariableInitializer(Token assignmentOperator) { |
| 1337 debugEvent("VariableInitializer"); | 1337 debugEvent("VariableInitializer"); |
| 1338 assert(assignmentOperator.stringValue == "="); | 1338 assert(assignmentOperator.stringValue == "="); |
| 1339 pushNewLocalVariable(popForValue(), equalsToken: assignmentOperator); | 1339 pushNewLocalVariable(popForValue(), equalsToken: assignmentOperator); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 @override | 1342 @override |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1359 } | 1359 } |
| 1360 pushNewLocalVariable(initializer); | 1360 pushNewLocalVariable(initializer); |
| 1361 } | 1361 } |
| 1362 | 1362 |
| 1363 void pushNewLocalVariable(Expression initializer, {Token equalsToken}) { | 1363 void pushNewLocalVariable(Expression initializer, {Token equalsToken}) { |
| 1364 Identifier identifier = pop(); | 1364 Identifier identifier = pop(); |
| 1365 assert(currentLocalVariableModifiers != -1); | 1365 assert(currentLocalVariableModifiers != -1); |
| 1366 bool isConst = (currentLocalVariableModifiers & constMask) != 0; | 1366 bool isConst = (currentLocalVariableModifiers & constMask) != 0; |
| 1367 bool isFinal = (currentLocalVariableModifiers & finalMask) != 0; | 1367 bool isFinal = (currentLocalVariableModifiers & finalMask) != 0; |
| 1368 assert(isConst == constantExpressionRequired); | 1368 assert(isConst == constantExpressionRequired); |
| 1369 push(new KernelVariableDeclaration(identifier.name, functionNestingLevel, | 1369 push(new ShadowVariableDeclaration(identifier.name, functionNestingLevel, |
| 1370 initializer: initializer, | 1370 initializer: initializer, |
| 1371 type: currentLocalVariableType, | 1371 type: currentLocalVariableType, |
| 1372 isFinal: isFinal, | 1372 isFinal: isFinal, |
| 1373 isConst: isConst) | 1373 isConst: isConst) |
| 1374 ..fileOffset = offsetForToken(identifier.token) | 1374 ..fileOffset = offsetForToken(identifier.token) |
| 1375 ..fileEqualsOffset = offsetForToken(equalsToken)); | 1375 ..fileEqualsOffset = offsetForToken(equalsToken)); |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 @override | 1378 @override |
| 1379 void endFieldInitializer(Token assignmentOperator, Token token) { | 1379 void endFieldInitializer(Token assignmentOperator, Token token) { |
| 1380 debugEvent("FieldInitializer"); | 1380 debugEvent("FieldInitializer"); |
| 1381 assert(assignmentOperator.stringValue == "="); | 1381 assert(assignmentOperator.stringValue == "="); |
| 1382 push(popForValue()); | 1382 push(popForValue()); |
| 1383 } | 1383 } |
| 1384 | 1384 |
| 1385 @override | 1385 @override |
| 1386 void handleNoFieldInitializer(Token token) { | 1386 void handleNoFieldInitializer(Token token) { |
| 1387 debugEvent("NoFieldInitializer"); | 1387 debugEvent("NoFieldInitializer"); |
| 1388 if (constantExpressionRequired) { | 1388 if (constantExpressionRequired) { |
| 1389 // Creating a null value to prevent the Dart VM from crashing. | 1389 // Creating a null value to prevent the Dart VM from crashing. |
| 1390 push(new KernelNullLiteral()..fileOffset = offsetForToken(token)); | 1390 push(new ShadowNullLiteral()..fileOffset = offsetForToken(token)); |
| 1391 } else { | 1391 } else { |
| 1392 push(NullValue.FieldInitializer); | 1392 push(NullValue.FieldInitializer); |
| 1393 } | 1393 } |
| 1394 } | 1394 } |
| 1395 | 1395 |
| 1396 @override | 1396 @override |
| 1397 void endInitializedIdentifier(Token nameToken) { | 1397 void endInitializedIdentifier(Token nameToken) { |
| 1398 // TODO(ahe): Use [InitializedIdentifier] here? | 1398 // TODO(ahe): Use [InitializedIdentifier] here? |
| 1399 debugEvent("InitializedIdentifier"); | 1399 debugEvent("InitializedIdentifier"); |
| 1400 VariableDeclaration variable = pop(); | 1400 VariableDeclaration variable = pop(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 } | 1494 } |
| 1495 if (variableOrExpression is VariableDeclaration) { | 1495 if (variableOrExpression is VariableDeclaration) { |
| 1496 variables.add(variableOrExpression); | 1496 variables.add(variableOrExpression); |
| 1497 } else if (variableOrExpression is List) { | 1497 } else if (variableOrExpression is List) { |
| 1498 // TODO(sigmund): remove this assignment (see issue #28651) | 1498 // TODO(sigmund): remove this assignment (see issue #28651) |
| 1499 Iterable vars = variableOrExpression; | 1499 Iterable vars = variableOrExpression; |
| 1500 variables.addAll(vars); | 1500 variables.addAll(vars); |
| 1501 } else if (variableOrExpression == null) { | 1501 } else if (variableOrExpression == null) { |
| 1502 // Do nothing. | 1502 // Do nothing. |
| 1503 } else if (variableOrExpression is Expression) { | 1503 } else if (variableOrExpression is Expression) { |
| 1504 begin = new KernelExpressionStatement(variableOrExpression); | 1504 begin = new ShadowExpressionStatement(variableOrExpression); |
| 1505 } else { | 1505 } else { |
| 1506 return unhandled("${variableOrExpression.runtimeType}", "endForStatement", | 1506 return unhandled("${variableOrExpression.runtimeType}", "endForStatement", |
| 1507 forKeyword.charOffset, uri); | 1507 forKeyword.charOffset, uri); |
| 1508 } | 1508 } |
| 1509 exitLocalScope(); | 1509 exitLocalScope(); |
| 1510 JumpTarget continueTarget = exitContinueTarget(); | 1510 JumpTarget continueTarget = exitContinueTarget(); |
| 1511 JumpTarget breakTarget = exitBreakTarget(); | 1511 JumpTarget breakTarget = exitBreakTarget(); |
| 1512 if (continueTarget.hasUsers) { | 1512 if (continueTarget.hasUsers) { |
| 1513 body = new KernelLabeledStatement(body); | 1513 body = new ShadowLabeledStatement(body); |
| 1514 continueTarget.resolveContinues(body); | 1514 continueTarget.resolveContinues(body); |
| 1515 } | 1515 } |
| 1516 Statement result = | 1516 Statement result = |
| 1517 new KernelForStatement(variables, condition, updates, body) | 1517 new ShadowForStatement(variables, condition, updates, body) |
| 1518 ..fileOffset = forKeyword.charOffset; | 1518 ..fileOffset = forKeyword.charOffset; |
| 1519 if (begin != null) { | 1519 if (begin != null) { |
| 1520 result = new KernelBlock(<Statement>[begin, result]); | 1520 result = new ShadowBlock(<Statement>[begin, result]); |
| 1521 } | 1521 } |
| 1522 if (breakTarget.hasUsers) { | 1522 if (breakTarget.hasUsers) { |
| 1523 result = new KernelLabeledStatement(result); | 1523 result = new ShadowLabeledStatement(result); |
| 1524 breakTarget.resolveBreaks(result); | 1524 breakTarget.resolveBreaks(result); |
| 1525 } | 1525 } |
| 1526 exitLoopOrSwitch(result); | 1526 exitLoopOrSwitch(result); |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 @override | 1529 @override |
| 1530 void endAwaitExpression(Token keyword, Token endToken) { | 1530 void endAwaitExpression(Token keyword, Token endToken) { |
| 1531 debugEvent("AwaitExpression"); | 1531 debugEvent("AwaitExpression"); |
| 1532 push(new KernelAwaitExpression(popForValue()) | 1532 push(new ShadowAwaitExpression(popForValue()) |
| 1533 ..fileOffset = offsetForToken(keyword)); | 1533 ..fileOffset = offsetForToken(keyword)); |
| 1534 } | 1534 } |
| 1535 | 1535 |
| 1536 @override | 1536 @override |
| 1537 void handleAsyncModifier(Token asyncToken, Token starToken) { | 1537 void handleAsyncModifier(Token asyncToken, Token starToken) { |
| 1538 debugEvent("AsyncModifier"); | 1538 debugEvent("AsyncModifier"); |
| 1539 push(asyncMarkerFromTokens(asyncToken, starToken)); | 1539 push(asyncMarkerFromTokens(asyncToken, starToken)); |
| 1540 } | 1540 } |
| 1541 | 1541 |
| 1542 @override | 1542 @override |
| 1543 void handleLiteralList( | 1543 void handleLiteralList( |
| 1544 int count, Token beginToken, Token constKeyword, Token endToken) { | 1544 int count, Token beginToken, Token constKeyword, Token endToken) { |
| 1545 debugEvent("LiteralList"); | 1545 debugEvent("LiteralList"); |
| 1546 List<Expression> expressions = popListForValue(count); | 1546 List<Expression> expressions = popListForValue(count); |
| 1547 List<DartType> typeArguments = pop(); | 1547 List<DartType> typeArguments = pop(); |
| 1548 DartType typeArgument; | 1548 DartType typeArgument; |
| 1549 if (typeArguments != null) { | 1549 if (typeArguments != null) { |
| 1550 typeArgument = typeArguments.first; | 1550 typeArgument = typeArguments.first; |
| 1551 if (typeArguments.length > 1) { | 1551 if (typeArguments.length > 1) { |
| 1552 typeArgument = null; | 1552 typeArgument = null; |
| 1553 warningNotError(fasta.messageListLiteralTooManyTypeArguments, | 1553 warningNotError(fasta.messageListLiteralTooManyTypeArguments, |
| 1554 beginToken.charOffset); | 1554 beginToken.charOffset); |
| 1555 } | 1555 } |
| 1556 } | 1556 } |
| 1557 push(new KernelListLiteral(expressions, | 1557 push(new ShadowListLiteral(expressions, |
| 1558 typeArgument: typeArgument, isConst: constKeyword != null) | 1558 typeArgument: typeArgument, isConst: constKeyword != null) |
| 1559 ..fileOffset = offsetForToken(constKeyword ?? beginToken)); | 1559 ..fileOffset = offsetForToken(constKeyword ?? beginToken)); |
| 1560 } | 1560 } |
| 1561 | 1561 |
| 1562 @override | 1562 @override |
| 1563 void handleLiteralBool(Token token) { | 1563 void handleLiteralBool(Token token) { |
| 1564 debugEvent("LiteralBool"); | 1564 debugEvent("LiteralBool"); |
| 1565 bool value = optional("true", token); | 1565 bool value = optional("true", token); |
| 1566 assert(value || optional("false", token)); | 1566 assert(value || optional("false", token)); |
| 1567 push(new KernelBoolLiteral(value)..fileOffset = offsetForToken(token)); | 1567 push(new ShadowBoolLiteral(value)..fileOffset = offsetForToken(token)); |
| 1568 } | 1568 } |
| 1569 | 1569 |
| 1570 @override | 1570 @override |
| 1571 void handleLiteralDouble(Token token) { | 1571 void handleLiteralDouble(Token token) { |
| 1572 debugEvent("LiteralDouble"); | 1572 debugEvent("LiteralDouble"); |
| 1573 push(new KernelDoubleLiteral(double.parse(token.lexeme)) | 1573 push(new ShadowDoubleLiteral(double.parse(token.lexeme)) |
| 1574 ..fileOffset = offsetForToken(token)); | 1574 ..fileOffset = offsetForToken(token)); |
| 1575 } | 1575 } |
| 1576 | 1576 |
| 1577 @override | 1577 @override |
| 1578 void handleLiteralNull(Token token) { | 1578 void handleLiteralNull(Token token) { |
| 1579 debugEvent("LiteralNull"); | 1579 debugEvent("LiteralNull"); |
| 1580 push(new KernelNullLiteral()..fileOffset = offsetForToken(token)); | 1580 push(new ShadowNullLiteral()..fileOffset = offsetForToken(token)); |
| 1581 } | 1581 } |
| 1582 | 1582 |
| 1583 @override | 1583 @override |
| 1584 void handleLiteralMap( | 1584 void handleLiteralMap( |
| 1585 int count, Token beginToken, Token constKeyword, Token endToken) { | 1585 int count, Token beginToken, Token constKeyword, Token endToken) { |
| 1586 debugEvent("LiteralMap"); | 1586 debugEvent("LiteralMap"); |
| 1587 List<MapEntry> entries = popList(count) ?? <MapEntry>[]; | 1587 List<MapEntry> entries = popList(count) ?? <MapEntry>[]; |
| 1588 List<DartType> typeArguments = pop(); | 1588 List<DartType> typeArguments = pop(); |
| 1589 DartType keyType; | 1589 DartType keyType; |
| 1590 DartType valueType; | 1590 DartType valueType; |
| 1591 if (typeArguments != null) { | 1591 if (typeArguments != null) { |
| 1592 if (typeArguments.length != 2) { | 1592 if (typeArguments.length != 2) { |
| 1593 keyType = null; | 1593 keyType = null; |
| 1594 valueType = null; | 1594 valueType = null; |
| 1595 warningNotError(fasta.messageListLiteralTypeArgumentMismatch, | 1595 warningNotError(fasta.messageListLiteralTypeArgumentMismatch, |
| 1596 beginToken.charOffset); | 1596 beginToken.charOffset); |
| 1597 } else { | 1597 } else { |
| 1598 keyType = typeArguments[0]; | 1598 keyType = typeArguments[0]; |
| 1599 valueType = typeArguments[1]; | 1599 valueType = typeArguments[1]; |
| 1600 } | 1600 } |
| 1601 } | 1601 } |
| 1602 push(new KernelMapLiteral(entries, | 1602 push(new ShadowMapLiteral(entries, |
| 1603 keyType: keyType, valueType: valueType, isConst: constKeyword != null) | 1603 keyType: keyType, valueType: valueType, isConst: constKeyword != null) |
| 1604 ..fileOffset = constKeyword?.charOffset ?? offsetForToken(beginToken)); | 1604 ..fileOffset = constKeyword?.charOffset ?? offsetForToken(beginToken)); |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 @override | 1607 @override |
| 1608 void endLiteralMapEntry(Token colon, Token endToken) { | 1608 void endLiteralMapEntry(Token colon, Token endToken) { |
| 1609 debugEvent("LiteralMapEntry"); | 1609 debugEvent("LiteralMapEntry"); |
| 1610 Expression value = popForValue(); | 1610 Expression value = popForValue(); |
| 1611 Expression key = popForValue(); | 1611 Expression key = popForValue(); |
| 1612 push(new MapEntry(key, value)); | 1612 push(new MapEntry(key, value)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1629 if (identifierCount == 1) { | 1629 if (identifierCount == 1) { |
| 1630 value = symbolPartToString(pop()); | 1630 value = symbolPartToString(pop()); |
| 1631 } else { | 1631 } else { |
| 1632 List parts = popList(identifierCount); | 1632 List parts = popList(identifierCount); |
| 1633 value = symbolPartToString(parts.first); | 1633 value = symbolPartToString(parts.first); |
| 1634 for (int i = 1; i < parts.length; i++) { | 1634 for (int i = 1; i < parts.length; i++) { |
| 1635 value += ".${symbolPartToString(parts[i])}"; | 1635 value += ".${symbolPartToString(parts[i])}"; |
| 1636 } | 1636 } |
| 1637 } | 1637 } |
| 1638 push( | 1638 push( |
| 1639 new KernelSymbolLiteral(value)..fileOffset = offsetForToken(hashToken)); | 1639 new ShadowSymbolLiteral(value)..fileOffset = offsetForToken(hashToken)); |
| 1640 } | 1640 } |
| 1641 | 1641 |
| 1642 DartType kernelTypeFromString( | 1642 DartType kernelTypeFromString( |
| 1643 String name, List<DartType> arguments, int charOffset) { | 1643 String name, List<DartType> arguments, int charOffset) { |
| 1644 Builder builder = scope.lookup(name, charOffset, uri); | 1644 Builder builder = scope.lookup(name, charOffset, uri); |
| 1645 if (builder == null) { | 1645 if (builder == null) { |
| 1646 warning(fasta.templateTypeNotFound.withArguments(name), charOffset); | 1646 warning(fasta.templateTypeNotFound.withArguments(name), charOffset); |
| 1647 return const InvalidType(); | 1647 return const InvalidType(); |
| 1648 } else { | 1648 } else { |
| 1649 return kernelTypeFromBuilder(builder, arguments, charOffset); | 1649 return kernelTypeFromBuilder(builder, arguments, charOffset); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 | 1771 |
| 1772 @override | 1772 @override |
| 1773 void handleAsOperator(Token operator, Token endToken) { | 1773 void handleAsOperator(Token operator, Token endToken) { |
| 1774 debugEvent("AsOperator"); | 1774 debugEvent("AsOperator"); |
| 1775 DartType type = pop(); | 1775 DartType type = pop(); |
| 1776 Expression expression = popForValue(); | 1776 Expression expression = popForValue(); |
| 1777 if (constantExpressionRequired) { | 1777 if (constantExpressionRequired) { |
| 1778 push(deprecated_buildCompileTimeError( | 1778 push(deprecated_buildCompileTimeError( |
| 1779 "Not a constant expression.", operator.charOffset)); | 1779 "Not a constant expression.", operator.charOffset)); |
| 1780 } else { | 1780 } else { |
| 1781 push(new KernelAsExpression(expression, type) | 1781 push(new ShadowAsExpression(expression, type) |
| 1782 ..fileOffset = offsetForToken(operator)); | 1782 ..fileOffset = offsetForToken(operator)); |
| 1783 } | 1783 } |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 @override | 1786 @override |
| 1787 void handleIsOperator(Token operator, Token not, Token endToken) { | 1787 void handleIsOperator(Token operator, Token not, Token endToken) { |
| 1788 debugEvent("IsOperator"); | 1788 debugEvent("IsOperator"); |
| 1789 DartType type = pop(); | 1789 DartType type = pop(); |
| 1790 Expression operand = popForValue(); | 1790 Expression operand = popForValue(); |
| 1791 bool isInverted = not != null; | 1791 bool isInverted = not != null; |
| 1792 var offset = offsetForToken(operator); | 1792 var offset = offsetForToken(operator); |
| 1793 Expression isExpression = isInverted | 1793 Expression isExpression = isInverted |
| 1794 ? new KernelIsNotExpression(operand, type, offset) | 1794 ? new ShadowIsNotExpression(operand, type, offset) |
| 1795 : new KernelIsExpression(operand, type) | 1795 : new ShadowIsExpression(operand, type) |
| 1796 ..fileOffset = offset; | 1796 ..fileOffset = offset; |
| 1797 if (operand is VariableGet) { | 1797 if (operand is VariableGet) { |
| 1798 typePromoter.handleIsCheck(isExpression, isInverted, operand.variable, | 1798 typePromoter.handleIsCheck(isExpression, isInverted, operand.variable, |
| 1799 type, functionNestingLevel); | 1799 type, functionNestingLevel); |
| 1800 } | 1800 } |
| 1801 if (constantExpressionRequired) { | 1801 if (constantExpressionRequired) { |
| 1802 push(deprecated_buildCompileTimeError( | 1802 push(deprecated_buildCompileTimeError( |
| 1803 "Not a constant expression.", operator.charOffset)); | 1803 "Not a constant expression.", operator.charOffset)); |
| 1804 } else { | 1804 } else { |
| 1805 push(isExpression); | 1805 push(isExpression); |
| 1806 } | 1806 } |
| 1807 } | 1807 } |
| 1808 | 1808 |
| 1809 @override | 1809 @override |
| 1810 void handleConditionalExpression(Token question, Token colon) { | 1810 void handleConditionalExpression(Token question, Token colon) { |
| 1811 debugEvent("ConditionalExpression"); | 1811 debugEvent("ConditionalExpression"); |
| 1812 Expression elseExpression = popForValue(); | 1812 Expression elseExpression = popForValue(); |
| 1813 Expression thenExpression = popForValue(); | 1813 Expression thenExpression = popForValue(); |
| 1814 Expression condition = popForValue(); | 1814 Expression condition = popForValue(); |
| 1815 push(new KernelConditionalExpression( | 1815 push(new ShadowConditionalExpression( |
| 1816 condition, thenExpression, elseExpression)); | 1816 condition, thenExpression, elseExpression)); |
| 1817 } | 1817 } |
| 1818 | 1818 |
| 1819 @override | 1819 @override |
| 1820 void handleThrowExpression(Token throwToken, Token endToken) { | 1820 void handleThrowExpression(Token throwToken, Token endToken) { |
| 1821 debugEvent("ThrowExpression"); | 1821 debugEvent("ThrowExpression"); |
| 1822 Expression expression = popForValue(); | 1822 Expression expression = popForValue(); |
| 1823 if (constantExpressionRequired) { | 1823 if (constantExpressionRequired) { |
| 1824 push(deprecated_buildCompileTimeError( | 1824 push(deprecated_buildCompileTimeError( |
| 1825 "Not a constant expression.", throwToken.charOffset)); | 1825 "Not a constant expression.", throwToken.charOffset)); |
| 1826 } else { | 1826 } else { |
| 1827 push( | 1827 push( |
| 1828 new KernelThrow(expression)..fileOffset = offsetForToken(throwToken)); | 1828 new ShadowThrow(expression)..fileOffset = offsetForToken(throwToken)); |
| 1829 } | 1829 } |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 @override | 1832 @override |
| 1833 void endFormalParameter(Token thisKeyword, Token nameToken, | 1833 void endFormalParameter(Token thisKeyword, Token nameToken, |
| 1834 FormalParameterKind kind, MemberKind memberKind) { | 1834 FormalParameterKind kind, MemberKind memberKind) { |
| 1835 debugEvent("FormalParameter"); | 1835 debugEvent("FormalParameter"); |
| 1836 if (thisKeyword != null) { | 1836 if (thisKeyword != null) { |
| 1837 if (!inConstructor) { | 1837 if (!inConstructor) { |
| 1838 deprecated_addCompileTimeError(thisKeyword.charOffset, | 1838 deprecated_addCompileTimeError(thisKeyword.charOffset, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1859 internalProblem( | 1859 internalProblem( |
| 1860 fasta.templateInternalProblemNotFoundIn | 1860 fasta.templateInternalProblemNotFoundIn |
| 1861 .withArguments(name.name, "formals"), | 1861 .withArguments(name.name, "formals"), |
| 1862 member.charOffset, | 1862 member.charOffset, |
| 1863 member.fileUri); | 1863 member.fileUri); |
| 1864 } else { | 1864 } else { |
| 1865 variable = formal.build(library); | 1865 variable = formal.build(library); |
| 1866 variable.initializer = name.initializer; | 1866 variable.initializer = name.initializer; |
| 1867 } | 1867 } |
| 1868 } else { | 1868 } else { |
| 1869 variable = new KernelVariableDeclaration(name?.name, functionNestingLevel, | 1869 variable = new ShadowVariableDeclaration(name?.name, functionNestingLevel, |
| 1870 type: type, | 1870 type: type, |
| 1871 initializer: name?.initializer, | 1871 initializer: name?.initializer, |
| 1872 isFinal: isFinal, | 1872 isFinal: isFinal, |
| 1873 isConst: isConst); | 1873 isConst: isConst); |
| 1874 if (name != null) { | 1874 if (name != null) { |
| 1875 // TODO(ahe): Need an offset when name is null. | 1875 // TODO(ahe): Need an offset when name is null. |
| 1876 variable.fileOffset = offsetForToken(name.token); | 1876 variable.fileOffset = offsetForToken(name.token); |
| 1877 } | 1877 } |
| 1878 } | 1878 } |
| 1879 push(variable); | 1879 push(variable); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 push(new Catch(exception, body, guard: type, stackTrace: stackTrace)); | 2000 push(new Catch(exception, body, guard: type, stackTrace: stackTrace)); |
| 2001 } | 2001 } |
| 2002 | 2002 |
| 2003 @override | 2003 @override |
| 2004 void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) { | 2004 void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) { |
| 2005 Statement finallyBlock = popStatementIfNotNull(finallyKeyword); | 2005 Statement finallyBlock = popStatementIfNotNull(finallyKeyword); |
| 2006 List<Catch> catches = popList(catchCount); | 2006 List<Catch> catches = popList(catchCount); |
| 2007 Statement tryBlock = popStatement(); | 2007 Statement tryBlock = popStatement(); |
| 2008 if (compileTimeErrorInTry == null) { | 2008 if (compileTimeErrorInTry == null) { |
| 2009 if (catches != null) { | 2009 if (catches != null) { |
| 2010 tryBlock = new KernelTryCatch(tryBlock, catches); | 2010 tryBlock = new ShadowTryCatch(tryBlock, catches); |
| 2011 } | 2011 } |
| 2012 if (finallyBlock != null) { | 2012 if (finallyBlock != null) { |
| 2013 tryBlock = new KernelTryFinally(tryBlock, finallyBlock); | 2013 tryBlock = new ShadowTryFinally(tryBlock, finallyBlock); |
| 2014 } | 2014 } |
| 2015 push(tryBlock); | 2015 push(tryBlock); |
| 2016 } else { | 2016 } else { |
| 2017 push(compileTimeErrorInTry); | 2017 push(compileTimeErrorInTry); |
| 2018 compileTimeErrorInTry = null; | 2018 compileTimeErrorInTry = null; |
| 2019 } | 2019 } |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 @override | 2022 @override |
| 2023 void handleNoExpression(Token token) { | 2023 void handleNoExpression(Token token) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2039 this, openSquareBracket, toValue(receiver), index, null, null)); | 2039 this, openSquareBracket, toValue(receiver), index, null, null)); |
| 2040 } | 2040 } |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 @override | 2043 @override |
| 2044 void handleUnaryPrefixExpression(Token token) { | 2044 void handleUnaryPrefixExpression(Token token) { |
| 2045 debugEvent("UnaryPrefixExpression"); | 2045 debugEvent("UnaryPrefixExpression"); |
| 2046 var receiver = pop(); | 2046 var receiver = pop(); |
| 2047 if (optional("!", token)) { | 2047 if (optional("!", token)) { |
| 2048 push( | 2048 push( |
| 2049 new KernelNot(toValue(receiver))..fileOffset = offsetForToken(token)); | 2049 new ShadowNot(toValue(receiver))..fileOffset = offsetForToken(token)); |
| 2050 } else { | 2050 } else { |
| 2051 String operator = token.stringValue; | 2051 String operator = token.stringValue; |
| 2052 if (optional("-", token)) { | 2052 if (optional("-", token)) { |
| 2053 operator = "unary-"; | 2053 operator = "unary-"; |
| 2054 } | 2054 } |
| 2055 if (receiver is ThisAccessor && receiver.isSuper) { | 2055 if (receiver is ThisAccessor && receiver.isSuper) { |
| 2056 push(toSuperMethodInvocation(buildMethodInvocation( | 2056 push(toSuperMethodInvocation(buildMethodInvocation( |
| 2057 new KernelThisExpression() | 2057 new ShadowThisExpression() |
| 2058 ..fileOffset = offsetForToken(receiver.token), | 2058 ..fileOffset = offsetForToken(receiver.token), |
| 2059 new Name(operator), | 2059 new Name(operator), |
| 2060 new Arguments.empty(), | 2060 new Arguments.empty(), |
| 2061 token.charOffset))); | 2061 token.charOffset))); |
| 2062 } else { | 2062 } else { |
| 2063 push(buildMethodInvocation(toValue(receiver), new Name(operator), | 2063 push(buildMethodInvocation(toValue(receiver), new Name(operator), |
| 2064 new Arguments.empty(), token.charOffset, | 2064 new Arguments.empty(), token.charOffset, |
| 2065 // This *could* be a constant expression, we can't know without | 2065 // This *could* be a constant expression, we can't know without |
| 2066 // evaluating [receiver]. | 2066 // evaluating [receiver]. |
| 2067 isConstantExpression: true)); | 2067 isConstantExpression: true)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2183 } | 2183 } |
| 2184 if (!checkArguments(target.function, arguments, typeParameters)) { | 2184 if (!checkArguments(target.function, arguments, typeParameters)) { |
| 2185 return throwNoSuchMethodError(new NullLiteral()..fileOffset = charOffset, | 2185 return throwNoSuchMethodError(new NullLiteral()..fileOffset = charOffset, |
| 2186 target.name.name, arguments, charOffset); | 2186 target.name.name, arguments, charOffset); |
| 2187 } | 2187 } |
| 2188 if (target is Constructor) { | 2188 if (target is Constructor) { |
| 2189 if (isConst && !target.isConst) { | 2189 if (isConst && !target.isConst) { |
| 2190 return deprecated_buildCompileTimeError( | 2190 return deprecated_buildCompileTimeError( |
| 2191 "Not a const constructor.", charOffset); | 2191 "Not a const constructor.", charOffset); |
| 2192 } | 2192 } |
| 2193 return new KernelConstructorInvocation(target, initialTarget, arguments, | 2193 return new ShadowConstructorInvocation(target, initialTarget, arguments, |
| 2194 isConst: isConst) | 2194 isConst: isConst) |
| 2195 ..fileOffset = charOffset; | 2195 ..fileOffset = charOffset; |
| 2196 } else { | 2196 } else { |
| 2197 Procedure procedure = target; | 2197 Procedure procedure = target; |
| 2198 if (isConst && !procedure.isConst) { | 2198 if (isConst && !procedure.isConst) { |
| 2199 return deprecated_buildCompileTimeError( | 2199 return deprecated_buildCompileTimeError( |
| 2200 "Not a const factory.", charOffset); | 2200 "Not a const factory.", charOffset); |
| 2201 } else if (procedure.isFactory) { | 2201 } else if (procedure.isFactory) { |
| 2202 return new KernelFactoryConstructorInvocation( | 2202 return new ShadowFactoryConstructorInvocation( |
| 2203 target, initialTarget, arguments, | 2203 target, initialTarget, arguments, |
| 2204 isConst: isConst) | 2204 isConst: isConst) |
| 2205 ..fileOffset = charOffset; | 2205 ..fileOffset = charOffset; |
| 2206 } else { | 2206 } else { |
| 2207 return new KernelStaticInvocation(target, arguments, isConst: isConst) | 2207 return new ShadowStaticInvocation(target, arguments, isConst: isConst) |
| 2208 ..fileOffset = charOffset; | 2208 ..fileOffset = charOffset; |
| 2209 } | 2209 } |
| 2210 } | 2210 } |
| 2211 } | 2211 } |
| 2212 | 2212 |
| 2213 @override | 2213 @override |
| 2214 bool checkArguments(FunctionNode function, Arguments arguments, | 2214 bool checkArguments(FunctionNode function, Arguments arguments, |
| 2215 List<TypeParameter> typeParameters) { | 2215 List<TypeParameter> typeParameters) { |
| 2216 if (arguments.positional.length < function.requiredParameterCount || | 2216 if (arguments.positional.length < function.requiredParameterCount || |
| 2217 arguments.positional.length > function.positionalParameters.length) { | 2217 arguments.positional.length > function.positionalParameters.length) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 debugEvent("endConstLiteral"); | 2273 debugEvent("endConstLiteral"); |
| 2274 var literal = pop(); | 2274 var literal = pop(); |
| 2275 constantExpressionRequired = pop(); | 2275 constantExpressionRequired = pop(); |
| 2276 push(literal); | 2276 push(literal); |
| 2277 } | 2277 } |
| 2278 | 2278 |
| 2279 @override | 2279 @override |
| 2280 void endNewExpression(Token token) { | 2280 void endNewExpression(Token token) { |
| 2281 debugEvent("NewExpression"); | 2281 debugEvent("NewExpression"); |
| 2282 Token nameToken = token.next; | 2282 Token nameToken = token.next; |
| 2283 KernelArguments arguments = pop(); | 2283 ShadowArguments arguments = pop(); |
| 2284 String name = pop(); | 2284 String name = pop(); |
| 2285 List<DartType> typeArguments = pop(); | 2285 List<DartType> typeArguments = pop(); |
| 2286 var type = pop(); | 2286 var type = pop(); |
| 2287 if (type is TypeDeclarationAccessor) { | 2287 if (type is TypeDeclarationAccessor) { |
| 2288 TypeDeclarationAccessor accessor = type; | 2288 TypeDeclarationAccessor accessor = type; |
| 2289 type = accessor.declaration; | 2289 type = accessor.declaration; |
| 2290 } | 2290 } |
| 2291 bool savedConstantExpressionRequired = pop(); | 2291 bool savedConstantExpressionRequired = pop(); |
| 2292 () { | 2292 () { |
| 2293 if (arguments == null) { | 2293 if (arguments == null) { |
| 2294 push(deprecated_buildCompileTimeError( | 2294 push(deprecated_buildCompileTimeError( |
| 2295 "No arguments.", nameToken.charOffset)); | 2295 "No arguments.", nameToken.charOffset)); |
| 2296 return; | 2296 return; |
| 2297 } | 2297 } |
| 2298 | 2298 |
| 2299 if (typeArguments != null) { | 2299 if (typeArguments != null) { |
| 2300 assert(arguments.types.isEmpty); | 2300 assert(arguments.types.isEmpty); |
| 2301 KernelArguments.setExplicitArgumentTypes(arguments, typeArguments); | 2301 ShadowArguments.setExplicitArgumentTypes(arguments, typeArguments); |
| 2302 } | 2302 } |
| 2303 | 2303 |
| 2304 String errorName; | 2304 String errorName; |
| 2305 if (type is ClassBuilder) { | 2305 if (type is ClassBuilder) { |
| 2306 if (type is EnumBuilder) { | 2306 if (type is EnumBuilder) { |
| 2307 push(deprecated_buildCompileTimeError( | 2307 push(deprecated_buildCompileTimeError( |
| 2308 "An enum class can't be instantiated.", nameToken.charOffset)); | 2308 "An enum class can't be instantiated.", nameToken.charOffset)); |
| 2309 return; | 2309 return; |
| 2310 } | 2310 } |
| 2311 Builder b = | 2311 Builder b = |
| 2312 type.findConstructorOrFactory(name, token.charOffset, uri, library); | 2312 type.findConstructorOrFactory(name, token.charOffset, uri, library); |
| 2313 Member target; | 2313 Member target; |
| 2314 Member initialTarget; | 2314 Member initialTarget; |
| 2315 if (b == null) { | 2315 if (b == null) { |
| 2316 // Not found. Reported below. | 2316 // Not found. Reported below. |
| 2317 } else if (b.isConstructor) { | 2317 } else if (b.isConstructor) { |
| 2318 initialTarget = b.target; | 2318 initialTarget = b.target; |
| 2319 if (type.isAbstract) { | 2319 if (type.isAbstract) { |
| 2320 push(new KernelSyntheticExpression(evaluateArgumentsBefore( | 2320 push(new ShadowSyntheticExpression(evaluateArgumentsBefore( |
| 2321 arguments, | 2321 arguments, |
| 2322 buildAbstractClassInstantiationError( | 2322 buildAbstractClassInstantiationError( |
| 2323 type.name, nameToken.charOffset)))); | 2323 type.name, nameToken.charOffset)))); |
| 2324 return; | 2324 return; |
| 2325 } else { | 2325 } else { |
| 2326 target = initialTarget; | 2326 target = initialTarget; |
| 2327 } | 2327 } |
| 2328 } else if (b.isFactory) { | 2328 } else if (b.isFactory) { |
| 2329 initialTarget = b.target; | 2329 initialTarget = b.target; |
| 2330 target = getRedirectionTarget(initialTarget); | 2330 target = getRedirectionTarget(initialTarget); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 Expression value = popForValue(); | 2407 Expression value = popForValue(); |
| 2408 Identifier identifier = pop(); | 2408 Identifier identifier = pop(); |
| 2409 push(new NamedExpression(identifier.name, value) | 2409 push(new NamedExpression(identifier.name, value) |
| 2410 ..fileOffset = offsetForToken(identifier.token)); | 2410 ..fileOffset = offsetForToken(identifier.token)); |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 @override | 2413 @override |
| 2414 void endFunctionName(Token beginToken, Token token) { | 2414 void endFunctionName(Token beginToken, Token token) { |
| 2415 debugEvent("FunctionName"); | 2415 debugEvent("FunctionName"); |
| 2416 Identifier name = pop(); | 2416 Identifier name = pop(); |
| 2417 VariableDeclaration variable = new KernelVariableDeclaration( | 2417 VariableDeclaration variable = new ShadowVariableDeclaration( |
| 2418 name.name, functionNestingLevel, | 2418 name.name, functionNestingLevel, |
| 2419 isFinal: true, isLocalFunction: true) | 2419 isFinal: true, isLocalFunction: true) |
| 2420 ..fileOffset = offsetForToken(name.token); | 2420 ..fileOffset = offsetForToken(name.token); |
| 2421 if (scope.local[variable.name] != null) { | 2421 if (scope.local[variable.name] != null) { |
| 2422 deprecated_addCompileTimeError(offsetForToken(name.token), | 2422 deprecated_addCompileTimeError(offsetForToken(name.token), |
| 2423 "'${variable.name}' already declared in this scope."); | 2423 "'${variable.name}' already declared in this scope."); |
| 2424 } | 2424 } |
| 2425 push(new KernelFunctionDeclaration( | 2425 push(new ShadowFunctionDeclaration( |
| 2426 variable, | 2426 variable, |
| 2427 // The function node is created later. | 2427 // The function node is created later. |
| 2428 null) | 2428 null) |
| 2429 ..fileOffset = beginToken.charOffset); | 2429 ..fileOffset = beginToken.charOffset); |
| 2430 declareVariable(variable, scope.parent); | 2430 declareVariable(variable, scope.parent); |
| 2431 } | 2431 } |
| 2432 | 2432 |
| 2433 void enterFunction() { | 2433 void enterFunction() { |
| 2434 debugEvent("enterFunction"); | 2434 debugEvent("enterFunction"); |
| 2435 enterFunctionTypeScope(); | 2435 enterFunctionTypeScope(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 List<TypeParameter> typeParameters = typeVariableBuildersToKernel(pop()); | 2487 List<TypeParameter> typeParameters = typeVariableBuildersToKernel(pop()); |
| 2488 FunctionNode function = formals.addToFunction(new FunctionNode(body, | 2488 FunctionNode function = formals.addToFunction(new FunctionNode(body, |
| 2489 typeParameters: typeParameters, | 2489 typeParameters: typeParameters, |
| 2490 asyncMarker: asyncModifier, | 2490 asyncMarker: asyncModifier, |
| 2491 returnType: returnType) | 2491 returnType: returnType) |
| 2492 ..fileOffset = formals.charOffset | 2492 ..fileOffset = formals.charOffset |
| 2493 ..fileEndOffset = token.charOffset); | 2493 ..fileEndOffset = token.charOffset); |
| 2494 | 2494 |
| 2495 if (declaration is FunctionDeclaration) { | 2495 if (declaration is FunctionDeclaration) { |
| 2496 VariableDeclaration variable = declaration.variable; | 2496 VariableDeclaration variable = declaration.variable; |
| 2497 KernelFunctionDeclaration.setHasImplicitReturnType( | 2497 ShadowFunctionDeclaration.setHasImplicitReturnType( |
| 2498 declaration, hasImplicitReturnType); | 2498 declaration, hasImplicitReturnType); |
| 2499 | 2499 |
| 2500 variable.type = function.functionType; | 2500 variable.type = function.functionType; |
| 2501 if (isFunctionExpression) { | 2501 if (isFunctionExpression) { |
| 2502 variable.initializer = new KernelFunctionExpression(function) | 2502 variable.initializer = new ShadowFunctionExpression(function) |
| 2503 ..parent = variable | 2503 ..parent = variable |
| 2504 ..fileOffset = formals.charOffset; | 2504 ..fileOffset = formals.charOffset; |
| 2505 exitLocalScope(); | 2505 exitLocalScope(); |
| 2506 push(new KernelNamedFunctionExpression(variable)); | 2506 push(new ShadowNamedFunctionExpression(variable)); |
| 2507 } else { | 2507 } else { |
| 2508 declaration.function = function; | 2508 declaration.function = function; |
| 2509 function.parent = declaration; | 2509 function.parent = declaration; |
| 2510 push(declaration); | 2510 push(declaration); |
| 2511 } | 2511 } |
| 2512 } else if (declaration is ExpressionStatement) { | 2512 } else if (declaration is ExpressionStatement) { |
| 2513 // If [declaration] isn't a [FunctionDeclaration], it must be because | 2513 // If [declaration] isn't a [FunctionDeclaration], it must be because |
| 2514 // there was a compile-time error. | 2514 // there was a compile-time error. |
| 2515 assert(library.hasCompileTimeErrors); | 2515 assert(library.hasCompileTimeErrors); |
| 2516 | 2516 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 exitFunction(); | 2549 exitFunction(); |
| 2550 List<TypeParameter> typeParameters = typeVariableBuildersToKernel(pop()); | 2550 List<TypeParameter> typeParameters = typeVariableBuildersToKernel(pop()); |
| 2551 FunctionNode function = formals.addToFunction(new FunctionNode(body, | 2551 FunctionNode function = formals.addToFunction(new FunctionNode(body, |
| 2552 typeParameters: typeParameters, asyncMarker: asyncModifier) | 2552 typeParameters: typeParameters, asyncMarker: asyncModifier) |
| 2553 ..fileOffset = beginToken.charOffset | 2553 ..fileOffset = beginToken.charOffset |
| 2554 ..fileEndOffset = token.charOffset); | 2554 ..fileEndOffset = token.charOffset); |
| 2555 if (constantExpressionRequired) { | 2555 if (constantExpressionRequired) { |
| 2556 push(deprecated_buildCompileTimeError( | 2556 push(deprecated_buildCompileTimeError( |
| 2557 "Not a constant expression.", formals.charOffset)); | 2557 "Not a constant expression.", formals.charOffset)); |
| 2558 } else { | 2558 } else { |
| 2559 push(new KernelFunctionExpression(function) | 2559 push(new ShadowFunctionExpression(function) |
| 2560 ..fileOffset = offsetForToken(beginToken)); | 2560 ..fileOffset = offsetForToken(beginToken)); |
| 2561 } | 2561 } |
| 2562 } | 2562 } |
| 2563 | 2563 |
| 2564 @override | 2564 @override |
| 2565 void endDoWhileStatement( | 2565 void endDoWhileStatement( |
| 2566 Token doKeyword, Token whileKeyword, Token endToken) { | 2566 Token doKeyword, Token whileKeyword, Token endToken) { |
| 2567 debugEvent("DoWhileStatement"); | 2567 debugEvent("DoWhileStatement"); |
| 2568 Expression condition = popForValue(); | 2568 Expression condition = popForValue(); |
| 2569 Statement body = popStatement(); | 2569 Statement body = popStatement(); |
| 2570 JumpTarget continueTarget = exitContinueTarget(); | 2570 JumpTarget continueTarget = exitContinueTarget(); |
| 2571 JumpTarget breakTarget = exitBreakTarget(); | 2571 JumpTarget breakTarget = exitBreakTarget(); |
| 2572 if (continueTarget.hasUsers) { | 2572 if (continueTarget.hasUsers) { |
| 2573 body = new KernelLabeledStatement(body); | 2573 body = new ShadowLabeledStatement(body); |
| 2574 continueTarget.resolveContinues(body); | 2574 continueTarget.resolveContinues(body); |
| 2575 } | 2575 } |
| 2576 Statement result = new KernelDoStatement(body, condition) | 2576 Statement result = new ShadowDoStatement(body, condition) |
| 2577 ..fileOffset = doKeyword.charOffset; | 2577 ..fileOffset = doKeyword.charOffset; |
| 2578 if (breakTarget.hasUsers) { | 2578 if (breakTarget.hasUsers) { |
| 2579 result = new KernelLabeledStatement(result); | 2579 result = new ShadowLabeledStatement(result); |
| 2580 breakTarget.resolveBreaks(result); | 2580 breakTarget.resolveBreaks(result); |
| 2581 } | 2581 } |
| 2582 exitLoopOrSwitch(result); | 2582 exitLoopOrSwitch(result); |
| 2583 } | 2583 } |
| 2584 | 2584 |
| 2585 @override | 2585 @override |
| 2586 void beginForInExpression(Token token) { | 2586 void beginForInExpression(Token token) { |
| 2587 enterLocalScope(null, scope.parent); | 2587 enterLocalScope(null, scope.parent); |
| 2588 } | 2588 } |
| 2589 | 2589 |
| 2590 @override | 2590 @override |
| 2591 void endForInExpression(Token token) { | 2591 void endForInExpression(Token token) { |
| 2592 debugEvent("ForInExpression"); | 2592 debugEvent("ForInExpression"); |
| 2593 Expression expression = popForValue(); | 2593 Expression expression = popForValue(); |
| 2594 exitLocalScope(); | 2594 exitLocalScope(); |
| 2595 push(expression ?? NullValue.Expression); | 2595 push(expression ?? NullValue.Expression); |
| 2596 } | 2596 } |
| 2597 | 2597 |
| 2598 @override | 2598 @override |
| 2599 void endForIn(Token awaitToken, Token forToken, Token leftParenthesis, | 2599 void endForIn(Token awaitToken, Token forToken, Token leftParenthesis, |
| 2600 Token inKeyword, Token rightParenthesis, Token endToken) { | 2600 Token inKeyword, Token rightParenthesis, Token endToken) { |
| 2601 debugEvent("ForIn"); | 2601 debugEvent("ForIn"); |
| 2602 Statement body = popStatement(); | 2602 Statement body = popStatement(); |
| 2603 Expression expression = popForValue(); | 2603 Expression expression = popForValue(); |
| 2604 var lvalue = pop(); | 2604 var lvalue = pop(); |
| 2605 exitLocalScope(); | 2605 exitLocalScope(); |
| 2606 JumpTarget continueTarget = exitContinueTarget(); | 2606 JumpTarget continueTarget = exitContinueTarget(); |
| 2607 JumpTarget breakTarget = exitBreakTarget(); | 2607 JumpTarget breakTarget = exitBreakTarget(); |
| 2608 if (continueTarget.hasUsers) { | 2608 if (continueTarget.hasUsers) { |
| 2609 body = new KernelLabeledStatement(body); | 2609 body = new ShadowLabeledStatement(body); |
| 2610 continueTarget.resolveContinues(body); | 2610 continueTarget.resolveContinues(body); |
| 2611 } | 2611 } |
| 2612 VariableDeclaration variable; | 2612 VariableDeclaration variable; |
| 2613 bool declaresVariable = false; | 2613 bool declaresVariable = false; |
| 2614 if (lvalue is VariableDeclaration) { | 2614 if (lvalue is VariableDeclaration) { |
| 2615 declaresVariable = true; | 2615 declaresVariable = true; |
| 2616 variable = lvalue; | 2616 variable = lvalue; |
| 2617 if (variable.isConst) { | 2617 if (variable.isConst) { |
| 2618 deprecated_addCompileTimeError( | 2618 deprecated_addCompileTimeError( |
| 2619 variable.fileOffset, "A for-in loop-variable can't be 'const'."); | 2619 variable.fileOffset, "A for-in loop-variable can't be 'const'."); |
| 2620 } | 2620 } |
| 2621 } else if (lvalue is FastaAccessor) { | 2621 } else if (lvalue is FastaAccessor) { |
| 2622 /// We are in this case, where `lvalue` isn't a [VariableDeclaration]: | 2622 /// We are in this case, where `lvalue` isn't a [VariableDeclaration]: |
| 2623 /// | 2623 /// |
| 2624 /// for (lvalue in expression) body | 2624 /// for (lvalue in expression) body |
| 2625 /// | 2625 /// |
| 2626 /// This is normalized to: | 2626 /// This is normalized to: |
| 2627 /// | 2627 /// |
| 2628 /// for (final #t in expression) { | 2628 /// for (final #t in expression) { |
| 2629 /// lvalue = #t; | 2629 /// lvalue = #t; |
| 2630 /// body; | 2630 /// body; |
| 2631 /// } | 2631 /// } |
| 2632 variable = new VariableDeclaration.forValue(null); | 2632 variable = new VariableDeclaration.forValue(null); |
| 2633 body = combineStatements( | 2633 body = combineStatements( |
| 2634 new KernelSyntheticStatement(new ExpressionStatement(lvalue | 2634 new ShadowSyntheticStatement(new ExpressionStatement(lvalue |
| 2635 .buildAssignment(new VariableGet(variable), voidContext: true))), | 2635 .buildAssignment(new VariableGet(variable), voidContext: true))), |
| 2636 body); | 2636 body); |
| 2637 } else { | 2637 } else { |
| 2638 variable = new VariableDeclaration.forValue( | 2638 variable = new VariableDeclaration.forValue( |
| 2639 deprecated_buildCompileTimeError("Expected lvalue, but got ${lvalue}", | 2639 deprecated_buildCompileTimeError("Expected lvalue, but got ${lvalue}", |
| 2640 forToken.next.next.charOffset)); | 2640 forToken.next.next.charOffset)); |
| 2641 } | 2641 } |
| 2642 Statement result = new KernelForInStatement( | 2642 Statement result = new ShadowForInStatement( |
| 2643 variable, expression, body, declaresVariable, | 2643 variable, expression, body, declaresVariable, |
| 2644 isAsync: awaitToken != null) | 2644 isAsync: awaitToken != null) |
| 2645 ..fileOffset = forToken.charOffset | 2645 ..fileOffset = forToken.charOffset |
| 2646 ..bodyOffset = body.fileOffset; | 2646 ..bodyOffset = body.fileOffset; |
| 2647 if (breakTarget.hasUsers) { | 2647 if (breakTarget.hasUsers) { |
| 2648 result = new KernelLabeledStatement(result); | 2648 result = new ShadowLabeledStatement(result); |
| 2649 breakTarget.resolveBreaks(result); | 2649 breakTarget.resolveBreaks(result); |
| 2650 } | 2650 } |
| 2651 exitLoopOrSwitch(result); | 2651 exitLoopOrSwitch(result); |
| 2652 } | 2652 } |
| 2653 | 2653 |
| 2654 @override | 2654 @override |
| 2655 void handleLabel(Token token) { | 2655 void handleLabel(Token token) { |
| 2656 debugEvent("Label"); | 2656 debugEvent("Label"); |
| 2657 Identifier identifier = pop(); | 2657 Identifier identifier = pop(); |
| 2658 push(new Label(identifier.name)); | 2658 push(new Label(identifier.name)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2672 } | 2672 } |
| 2673 | 2673 |
| 2674 @override | 2674 @override |
| 2675 void endLabeledStatement(int labelCount) { | 2675 void endLabeledStatement(int labelCount) { |
| 2676 debugEvent("LabeledStatement"); | 2676 debugEvent("LabeledStatement"); |
| 2677 Statement statement = popStatement(); | 2677 Statement statement = popStatement(); |
| 2678 LabelTarget target = pop(); | 2678 LabelTarget target = pop(); |
| 2679 exitLocalScope(); | 2679 exitLocalScope(); |
| 2680 if (target.breakTarget.hasUsers) { | 2680 if (target.breakTarget.hasUsers) { |
| 2681 if (statement is! LabeledStatement) { | 2681 if (statement is! LabeledStatement) { |
| 2682 statement = new KernelLabeledStatement(statement); | 2682 statement = new ShadowLabeledStatement(statement); |
| 2683 } | 2683 } |
| 2684 target.breakTarget.resolveBreaks(statement); | 2684 target.breakTarget.resolveBreaks(statement); |
| 2685 } | 2685 } |
| 2686 if (target.continueTarget.hasUsers) { | 2686 if (target.continueTarget.hasUsers) { |
| 2687 if (statement is! LabeledStatement) { | 2687 if (statement is! LabeledStatement) { |
| 2688 statement = new KernelLabeledStatement(statement); | 2688 statement = new ShadowLabeledStatement(statement); |
| 2689 } | 2689 } |
| 2690 target.continueTarget.resolveContinues(statement); | 2690 target.continueTarget.resolveContinues(statement); |
| 2691 } | 2691 } |
| 2692 push(statement); | 2692 push(statement); |
| 2693 } | 2693 } |
| 2694 | 2694 |
| 2695 @override | 2695 @override |
| 2696 void endRethrowStatement(Token rethrowToken, Token endToken) { | 2696 void endRethrowStatement(Token rethrowToken, Token endToken) { |
| 2697 debugEvent("RethrowStatement"); | 2697 debugEvent("RethrowStatement"); |
| 2698 if (inCatchBlock) { | 2698 if (inCatchBlock) { |
| 2699 push(new KernelExpressionStatement( | 2699 push(new ShadowExpressionStatement( |
| 2700 new KernelRethrow()..fileOffset = offsetForToken(rethrowToken))); | 2700 new ShadowRethrow()..fileOffset = offsetForToken(rethrowToken))); |
| 2701 } else { | 2701 } else { |
| 2702 push(deprecated_buildCompileTimeErrorStatement( | 2702 push(deprecated_buildCompileTimeErrorStatement( |
| 2703 "'rethrow' can only be used in catch clauses.", | 2703 "'rethrow' can only be used in catch clauses.", |
| 2704 rethrowToken.charOffset)); | 2704 rethrowToken.charOffset)); |
| 2705 } | 2705 } |
| 2706 } | 2706 } |
| 2707 | 2707 |
| 2708 @override | 2708 @override |
| 2709 void handleFinallyBlock(Token finallyKeyword) { | 2709 void handleFinallyBlock(Token finallyKeyword) { |
| 2710 debugEvent("FinallyBlock"); | 2710 debugEvent("FinallyBlock"); |
| 2711 // Do nothing, handled by [endTryStatement]. | 2711 // Do nothing, handled by [endTryStatement]. |
| 2712 } | 2712 } |
| 2713 | 2713 |
| 2714 @override | 2714 @override |
| 2715 void endWhileStatement(Token whileKeyword, Token endToken) { | 2715 void endWhileStatement(Token whileKeyword, Token endToken) { |
| 2716 debugEvent("WhileStatement"); | 2716 debugEvent("WhileStatement"); |
| 2717 Statement body = popStatement(); | 2717 Statement body = popStatement(); |
| 2718 Expression condition = popForValue(); | 2718 Expression condition = popForValue(); |
| 2719 JumpTarget continueTarget = exitContinueTarget(); | 2719 JumpTarget continueTarget = exitContinueTarget(); |
| 2720 JumpTarget breakTarget = exitBreakTarget(); | 2720 JumpTarget breakTarget = exitBreakTarget(); |
| 2721 if (continueTarget.hasUsers) { | 2721 if (continueTarget.hasUsers) { |
| 2722 body = new KernelLabeledStatement(body); | 2722 body = new ShadowLabeledStatement(body); |
| 2723 continueTarget.resolveContinues(body); | 2723 continueTarget.resolveContinues(body); |
| 2724 } | 2724 } |
| 2725 Statement result = new KernelWhileStatement(condition, body) | 2725 Statement result = new ShadowWhileStatement(condition, body) |
| 2726 ..fileOffset = whileKeyword.charOffset; | 2726 ..fileOffset = whileKeyword.charOffset; |
| 2727 if (breakTarget.hasUsers) { | 2727 if (breakTarget.hasUsers) { |
| 2728 result = new KernelLabeledStatement(result); | 2728 result = new ShadowLabeledStatement(result); |
| 2729 breakTarget.resolveBreaks(result); | 2729 breakTarget.resolveBreaks(result); |
| 2730 } | 2730 } |
| 2731 exitLoopOrSwitch(result); | 2731 exitLoopOrSwitch(result); |
| 2732 } | 2732 } |
| 2733 | 2733 |
| 2734 @override | 2734 @override |
| 2735 void handleEmptyStatement(Token token) { | 2735 void handleEmptyStatement(Token token) { |
| 2736 debugEvent("EmptyStatement"); | 2736 debugEvent("EmptyStatement"); |
| 2737 push(new EmptyStatement()); | 2737 push(new EmptyStatement()); |
| 2738 } | 2738 } |
| 2739 | 2739 |
| 2740 @override | 2740 @override |
| 2741 void beginAssert(Token assertKeyword, Assert kind) { | 2741 void beginAssert(Token assertKeyword, Assert kind) { |
| 2742 debugEvent("beginAssert"); | 2742 debugEvent("beginAssert"); |
| 2743 // If in an assert initializer, make sure [inInitializer] is false so we | 2743 // If in an assert initializer, make sure [inInitializer] is false so we |
| 2744 // use the formal parameter scope. If this is any other kind of assert, | 2744 // use the formal parameter scope. If this is any other kind of assert, |
| 2745 // inInitializer should be false anyway. | 2745 // inInitializer should be false anyway. |
| 2746 inInitializer = false; | 2746 inInitializer = false; |
| 2747 } | 2747 } |
| 2748 | 2748 |
| 2749 @override | 2749 @override |
| 2750 void endAssert(Token assertKeyword, Assert kind, Token leftParenthesis, | 2750 void endAssert(Token assertKeyword, Assert kind, Token leftParenthesis, |
| 2751 Token commaToken, Token rightParenthesis, Token semicolonToken) { | 2751 Token commaToken, Token rightParenthesis, Token semicolonToken) { |
| 2752 debugEvent("Assert"); | 2752 debugEvent("Assert"); |
| 2753 Expression message = popForValueIfNotNull(commaToken); | 2753 Expression message = popForValueIfNotNull(commaToken); |
| 2754 Expression condition = popForValue(); | 2754 Expression condition = popForValue(); |
| 2755 AssertStatement statement = new KernelAssertStatement(condition, | 2755 AssertStatement statement = new ShadowAssertStatement(condition, |
| 2756 conditionStartOffset: leftParenthesis.offset + 1, | 2756 conditionStartOffset: leftParenthesis.offset + 1, |
| 2757 conditionEndOffset: rightParenthesis.offset, | 2757 conditionEndOffset: rightParenthesis.offset, |
| 2758 message: message); | 2758 message: message); |
| 2759 switch (kind) { | 2759 switch (kind) { |
| 2760 case Assert.Statement: | 2760 case Assert.Statement: |
| 2761 push(statement); | 2761 push(statement); |
| 2762 break; | 2762 break; |
| 2763 | 2763 |
| 2764 case Assert.Expression: | 2764 case Assert.Expression: |
| 2765 push(deprecated_buildCompileTimeError( | 2765 push(deprecated_buildCompileTimeError( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2776 // Since kernel only has asserts in statment form, we convert it to an | 2776 // Since kernel only has asserts in statment form, we convert it to an |
| 2777 // expression by wrapping it in an anonymous function which we call | 2777 // expression by wrapping it in an anonymous function which we call |
| 2778 // immediately. | 2778 // immediately. |
| 2779 // | 2779 // |
| 2780 // Additionally, kernel has no initializer that evaluates an expression, | 2780 // Additionally, kernel has no initializer that evaluates an expression, |
| 2781 // but it does have `LocalInitializer` which requires a variable declartion. | 2781 // but it does have `LocalInitializer` which requires a variable declartion. |
| 2782 // | 2782 // |
| 2783 // So we produce an initializer like this: | 2783 // So we produce an initializer like this: |
| 2784 // | 2784 // |
| 2785 // var #t0 = (() { statement; }) () | 2785 // var #t0 = (() { statement; }) () |
| 2786 return new KernelAssertInitializer( | 2786 return new ShadowAssertInitializer( |
| 2787 new VariableDeclaration.forValue(buildMethodInvocation( | 2787 new VariableDeclaration.forValue(buildMethodInvocation( |
| 2788 new FunctionExpression(new FunctionNode(statement)), | 2788 new FunctionExpression(new FunctionNode(statement)), |
| 2789 callName, | 2789 callName, |
| 2790 new Arguments.empty(), | 2790 new Arguments.empty(), |
| 2791 statement.fileOffset, | 2791 statement.fileOffset, |
| 2792 isConstantExpression: true, | 2792 isConstantExpression: true, |
| 2793 isImplicitCall: true)), | 2793 isImplicitCall: true)), |
| 2794 statement); | 2794 statement); |
| 2795 } | 2795 } |
| 2796 | 2796 |
| 2797 @override | 2797 @override |
| 2798 void endYieldStatement(Token yieldToken, Token starToken, Token endToken) { | 2798 void endYieldStatement(Token yieldToken, Token starToken, Token endToken) { |
| 2799 debugEvent("YieldStatement"); | 2799 debugEvent("YieldStatement"); |
| 2800 push(new KernelYieldStatement(popForValue(), isYieldStar: starToken != null) | 2800 push(new ShadowYieldStatement(popForValue(), isYieldStar: starToken != null) |
| 2801 ..fileOffset = yieldToken.charOffset); | 2801 ..fileOffset = yieldToken.charOffset); |
| 2802 } | 2802 } |
| 2803 | 2803 |
| 2804 @override | 2804 @override |
| 2805 void beginSwitchBlock(Token token) { | 2805 void beginSwitchBlock(Token token) { |
| 2806 debugEvent("beginSwitchBlock"); | 2806 debugEvent("beginSwitchBlock"); |
| 2807 enterLocalScope("switch block"); | 2807 enterLocalScope("switch block"); |
| 2808 enterSwitchScope(); | 2808 enterSwitchScope(); |
| 2809 enterBreakTarget(token.charOffset); | 2809 enterBreakTarget(token.charOffset); |
| 2810 } | 2810 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2861 | 2861 |
| 2862 @override | 2862 @override |
| 2863 void endSwitchStatement(Token switchKeyword, Token endToken) { | 2863 void endSwitchStatement(Token switchKeyword, Token endToken) { |
| 2864 debugEvent("SwitchStatement"); | 2864 debugEvent("SwitchStatement"); |
| 2865 | 2865 |
| 2866 List<SwitchCase> cases = pop(); | 2866 List<SwitchCase> cases = pop(); |
| 2867 JumpTarget target = exitBreakTarget(); | 2867 JumpTarget target = exitBreakTarget(); |
| 2868 exitSwitchScope(); | 2868 exitSwitchScope(); |
| 2869 exitLocalScope(); | 2869 exitLocalScope(); |
| 2870 Expression expression = popForValue(); | 2870 Expression expression = popForValue(); |
| 2871 Statement result = new KernelSwitchStatement(expression, cases) | 2871 Statement result = new ShadowSwitchStatement(expression, cases) |
| 2872 ..fileOffset = switchKeyword.charOffset; | 2872 ..fileOffset = switchKeyword.charOffset; |
| 2873 if (target.hasUsers) { | 2873 if (target.hasUsers) { |
| 2874 result = new KernelLabeledStatement(result); | 2874 result = new ShadowLabeledStatement(result); |
| 2875 target.resolveBreaks(result); | 2875 target.resolveBreaks(result); |
| 2876 } | 2876 } |
| 2877 exitLoopOrSwitch(result); | 2877 exitLoopOrSwitch(result); |
| 2878 } | 2878 } |
| 2879 | 2879 |
| 2880 @override | 2880 @override |
| 2881 void endSwitchBlock(int caseCount, Token beginToken, Token endToken) { | 2881 void endSwitchBlock(int caseCount, Token beginToken, Token endToken) { |
| 2882 debugEvent("SwitchBlock"); | 2882 debugEvent("SwitchBlock"); |
| 2883 List<SwitchCase> cases = | 2883 List<SwitchCase> cases = |
| 2884 new List<SwitchCase>.filled(caseCount, null, growable: true); | 2884 new List<SwitchCase>.filled(caseCount, null, growable: true); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2955 !target.isBreakTarget) { | 2955 !target.isBreakTarget) { |
| 2956 push(compileTimeErrorInLoopOrSwitch = | 2956 push(compileTimeErrorInLoopOrSwitch = |
| 2957 deprecated_buildCompileTimeErrorStatement( | 2957 deprecated_buildCompileTimeErrorStatement( |
| 2958 "Can't break to '$name'.", breakKeyword.next.charOffset)); | 2958 "Can't break to '$name'.", breakKeyword.next.charOffset)); |
| 2959 } else if (target.functionNestingLevel != functionNestingLevel) { | 2959 } else if (target.functionNestingLevel != functionNestingLevel) { |
| 2960 push(compileTimeErrorInLoopOrSwitch = | 2960 push(compileTimeErrorInLoopOrSwitch = |
| 2961 deprecated_buildCompileTimeErrorStatement( | 2961 deprecated_buildCompileTimeErrorStatement( |
| 2962 "Can't break to '$name' in a different function.", | 2962 "Can't break to '$name' in a different function.", |
| 2963 breakKeyword.next.charOffset)); | 2963 breakKeyword.next.charOffset)); |
| 2964 } else { | 2964 } else { |
| 2965 BreakStatement statement = new KernelBreakStatement(null) | 2965 BreakStatement statement = new ShadowBreakStatement(null) |
| 2966 ..fileOffset = breakKeyword.charOffset; | 2966 ..fileOffset = breakKeyword.charOffset; |
| 2967 target.addBreak(statement); | 2967 target.addBreak(statement); |
| 2968 push(statement); | 2968 push(statement); |
| 2969 } | 2969 } |
| 2970 } | 2970 } |
| 2971 | 2971 |
| 2972 @override | 2972 @override |
| 2973 void handleContinueStatement( | 2973 void handleContinueStatement( |
| 2974 bool hasTarget, Token continueKeyword, Token endToken) { | 2974 bool hasTarget, Token continueKeyword, Token endToken) { |
| 2975 debugEvent("ContinueStatement"); | 2975 debugEvent("ContinueStatement"); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2991 push(deprecated_buildCompileTimeErrorStatement( | 2991 push(deprecated_buildCompileTimeErrorStatement( |
| 2992 "Can't find label '$name'.", continueKeyword.next.charOffset)); | 2992 "Can't find label '$name'.", continueKeyword.next.charOffset)); |
| 2993 return; | 2993 return; |
| 2994 } | 2994 } |
| 2995 switchScope.forwardDeclareLabel(identifier.name, | 2995 switchScope.forwardDeclareLabel(identifier.name, |
| 2996 target = createGotoTarget(offsetForToken(identifier.token))); | 2996 target = createGotoTarget(offsetForToken(identifier.token))); |
| 2997 } | 2997 } |
| 2998 if (target.isGotoTarget && | 2998 if (target.isGotoTarget && |
| 2999 target.functionNestingLevel == functionNestingLevel) { | 2999 target.functionNestingLevel == functionNestingLevel) { |
| 3000 ContinueSwitchStatement statement = | 3000 ContinueSwitchStatement statement = |
| 3001 new KernelContinueSwitchStatement(null) | 3001 new ShadowContinueSwitchStatement(null) |
| 3002 ..fileOffset = continueKeyword.charOffset; | 3002 ..fileOffset = continueKeyword.charOffset; |
| 3003 target.addGoto(statement); | 3003 target.addGoto(statement); |
| 3004 push(statement); | 3004 push(statement); |
| 3005 return; | 3005 return; |
| 3006 } | 3006 } |
| 3007 } | 3007 } |
| 3008 if (target == null) { | 3008 if (target == null) { |
| 3009 push(compileTimeErrorInLoopOrSwitch = | 3009 push(compileTimeErrorInLoopOrSwitch = |
| 3010 deprecated_buildCompileTimeErrorStatement( | 3010 deprecated_buildCompileTimeErrorStatement( |
| 3011 "No target of continue.", continueKeyword.charOffset)); | 3011 "No target of continue.", continueKeyword.charOffset)); |
| 3012 } else if (!target.isContinueTarget) { | 3012 } else if (!target.isContinueTarget) { |
| 3013 push(compileTimeErrorInLoopOrSwitch = | 3013 push(compileTimeErrorInLoopOrSwitch = |
| 3014 deprecated_buildCompileTimeErrorStatement( | 3014 deprecated_buildCompileTimeErrorStatement( |
| 3015 "Can't continue at '$name'.", continueKeyword.next.charOffset)); | 3015 "Can't continue at '$name'.", continueKeyword.next.charOffset)); |
| 3016 } else if (target.functionNestingLevel != functionNestingLevel) { | 3016 } else if (target.functionNestingLevel != functionNestingLevel) { |
| 3017 push(compileTimeErrorInLoopOrSwitch = | 3017 push(compileTimeErrorInLoopOrSwitch = |
| 3018 deprecated_buildCompileTimeErrorStatement( | 3018 deprecated_buildCompileTimeErrorStatement( |
| 3019 "Can't continue at '$name' in a different function.", | 3019 "Can't continue at '$name' in a different function.", |
| 3020 continueKeyword.next.charOffset)); | 3020 continueKeyword.next.charOffset)); |
| 3021 } else { | 3021 } else { |
| 3022 BreakStatement statement = new KernelBreakStatement(null) | 3022 BreakStatement statement = new ShadowBreakStatement(null) |
| 3023 ..fileOffset = continueKeyword.charOffset; | 3023 ..fileOffset = continueKeyword.charOffset; |
| 3024 target.addContinue(statement); | 3024 target.addContinue(statement); |
| 3025 push(statement); | 3025 push(statement); |
| 3026 } | 3026 } |
| 3027 } | 3027 } |
| 3028 | 3028 |
| 3029 @override | 3029 @override |
| 3030 void endTypeVariable(Token token, Token extendsOrSuper) { | 3030 void endTypeVariable(Token token, Token extendsOrSuper) { |
| 3031 debugEvent("TypeVariable"); | 3031 debugEvent("TypeVariable"); |
| 3032 DartType bound = pop(); | 3032 DartType bound = pop(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3109 fasta.templateUnspecified.withArguments(error), charOffset); | 3109 fasta.templateUnspecified.withArguments(error), charOffset); |
| 3110 } | 3110 } |
| 3111 | 3111 |
| 3112 @override | 3112 @override |
| 3113 Expression buildCompileTimeError(Message message, int charOffset) { | 3113 Expression buildCompileTimeError(Message message, int charOffset) { |
| 3114 // TODO(ahe): This method should be passed the erroneous expression, wrap | 3114 // TODO(ahe): This method should be passed the erroneous expression, wrap |
| 3115 // it in a class (TBD) from which the erroneous expression can be easily | 3115 // it in a class (TBD) from which the erroneous expression can be easily |
| 3116 // extracted. Similar for statements and initializers. See also [issue | 3116 // extracted. Similar for statements and initializers. See also [issue |
| 3117 // 29717](https://github.com/dart-lang/sdk/issues/29717) | 3117 // 29717](https://github.com/dart-lang/sdk/issues/29717) |
| 3118 library.addCompileTimeError(message, charOffset, uri, wasHandled: true); | 3118 library.addCompileTimeError(message, charOffset, uri, wasHandled: true); |
| 3119 return new KernelSyntheticExpression(library.loader | 3119 return new ShadowSyntheticExpression(library.loader |
| 3120 .throwCompileConstantError( | 3120 .throwCompileConstantError( |
| 3121 library.loader.buildCompileTimeError(message, charOffset, uri))); | 3121 library.loader.buildCompileTimeError(message, charOffset, uri))); |
| 3122 } | 3122 } |
| 3123 | 3123 |
| 3124 Expression wrapInCompileTimeError(Expression expression, Message message) { | 3124 Expression wrapInCompileTimeError(Expression expression, Message message) { |
| 3125 return new Let( | 3125 return new Let( |
| 3126 new VariableDeclaration.forValue(expression) | 3126 new VariableDeclaration.forValue(expression) |
| 3127 ..fileOffset = expression.fileOffset, | 3127 ..fileOffset = expression.fileOffset, |
| 3128 buildCompileTimeError(message, expression.fileOffset)) | 3128 buildCompileTimeError(message, expression.fileOffset)) |
| 3129 ..fileOffset = expression.fileOffset; | 3129 ..fileOffset = expression.fileOffset; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3142 ]), | 3142 ]), |
| 3143 charOffset: charOffset)); | 3143 charOffset: charOffset)); |
| 3144 } | 3144 } |
| 3145 | 3145 |
| 3146 Expression buildAbstractClassInstantiationError(String className, | 3146 Expression buildAbstractClassInstantiationError(String className, |
| 3147 [int charOffset = -1]) { | 3147 [int charOffset = -1]) { |
| 3148 warning(fasta.templateAbstractClassInstantiation.withArguments(className), | 3148 warning(fasta.templateAbstractClassInstantiation.withArguments(className), |
| 3149 charOffset); | 3149 charOffset); |
| 3150 Builder constructor = library.loader.getAbstractClassInstantiationError(); | 3150 Builder constructor = library.loader.getAbstractClassInstantiationError(); |
| 3151 return new Throw(buildStaticInvocation(constructor.target, | 3151 return new Throw(buildStaticInvocation(constructor.target, |
| 3152 new KernelArguments(<Expression>[new StringLiteral(className)]))); | 3152 new ShadowArguments(<Expression>[new StringLiteral(className)]))); |
| 3153 } | 3153 } |
| 3154 | 3154 |
| 3155 Statement deprecated_buildCompileTimeErrorStatement(error, | 3155 Statement deprecated_buildCompileTimeErrorStatement(error, |
| 3156 [int charOffset = -1]) { | 3156 [int charOffset = -1]) { |
| 3157 return new KernelExpressionStatement( | 3157 return new ShadowExpressionStatement( |
| 3158 deprecated_buildCompileTimeError(error, charOffset)); | 3158 deprecated_buildCompileTimeError(error, charOffset)); |
| 3159 } | 3159 } |
| 3160 | 3160 |
| 3161 @override | 3161 @override |
| 3162 Initializer buildInvalidInitializer(Expression expression, | 3162 Initializer buildInvalidInitializer(Expression expression, |
| 3163 [int charOffset = -1]) { | 3163 [int charOffset = -1]) { |
| 3164 needsImplicitSuperInitializer = false; | 3164 needsImplicitSuperInitializer = false; |
| 3165 return new KernelInvalidInitializer( | 3165 return new ShadowInvalidInitializer( |
| 3166 new VariableDeclaration.forValue(expression)) | 3166 new VariableDeclaration.forValue(expression)) |
| 3167 ..fileOffset = charOffset; | 3167 ..fileOffset = charOffset; |
| 3168 } | 3168 } |
| 3169 | 3169 |
| 3170 Initializer buildDuplicatedInitializer( | 3170 Initializer buildDuplicatedInitializer( |
| 3171 String name, int offset, int previousInitializerOffset) { | 3171 String name, int offset, int previousInitializerOffset) { |
| 3172 Initializer initializer = buildInvalidInitializer( | 3172 Initializer initializer = buildInvalidInitializer( |
| 3173 deprecated_buildCompileTimeError( | 3173 deprecated_buildCompileTimeError( |
| 3174 "'$name' has already been initialized.", offset), | 3174 "'$name' has already been initialized.", offset), |
| 3175 offset); | 3175 offset); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3201 .withArguments(name), | 3201 .withArguments(name), |
| 3202 builder.charOffset); | 3202 builder.charOffset); |
| 3203 Builder constructor = | 3203 Builder constructor = |
| 3204 library.loader.getDuplicatedFieldInitializerError(); | 3204 library.loader.getDuplicatedFieldInitializerError(); |
| 3205 return buildInvalidInitializer( | 3205 return buildInvalidInitializer( |
| 3206 new Throw(buildStaticInvocation(constructor.target, | 3206 new Throw(buildStaticInvocation(constructor.target, |
| 3207 new Arguments(<Expression>[new StringLiteral(name)]), | 3207 new Arguments(<Expression>[new StringLiteral(name)]), |
| 3208 charOffset: offset)), | 3208 charOffset: offset)), |
| 3209 offset); | 3209 offset); |
| 3210 } else { | 3210 } else { |
| 3211 return new KernelFieldInitializer(builder.field, expression) | 3211 return new ShadowFieldInitializer(builder.field, expression) |
| 3212 ..fileOffset = offset | 3212 ..fileOffset = offset |
| 3213 ..isSynthetic = isSynthetic; | 3213 ..isSynthetic = isSynthetic; |
| 3214 } | 3214 } |
| 3215 } else { | 3215 } else { |
| 3216 return buildInvalidInitializer( | 3216 return buildInvalidInitializer( |
| 3217 deprecated_buildCompileTimeError( | 3217 deprecated_buildCompileTimeError( |
| 3218 "'$name' isn't an instance field of this class.", offset), | 3218 "'$name' isn't an instance field of this class.", offset), |
| 3219 offset); | 3219 offset); |
| 3220 } | 3220 } |
| 3221 } | 3221 } |
| 3222 | 3222 |
| 3223 @override | 3223 @override |
| 3224 Initializer buildSuperInitializer( | 3224 Initializer buildSuperInitializer( |
| 3225 bool isSynthetic, Constructor constructor, Arguments arguments, | 3225 bool isSynthetic, Constructor constructor, Arguments arguments, |
| 3226 [int charOffset = -1]) { | 3226 [int charOffset = -1]) { |
| 3227 if (member.isConst && !constructor.isConst) { | 3227 if (member.isConst && !constructor.isConst) { |
| 3228 return buildInvalidInitializer( | 3228 return buildInvalidInitializer( |
| 3229 deprecated_buildCompileTimeError( | 3229 deprecated_buildCompileTimeError( |
| 3230 "Super constructor isn't const.", charOffset), | 3230 "Super constructor isn't const.", charOffset), |
| 3231 charOffset); | 3231 charOffset); |
| 3232 } | 3232 } |
| 3233 needsImplicitSuperInitializer = false; | 3233 needsImplicitSuperInitializer = false; |
| 3234 return new KernelSuperInitializer(constructor, arguments) | 3234 return new ShadowSuperInitializer(constructor, arguments) |
| 3235 ..fileOffset = charOffset | 3235 ..fileOffset = charOffset |
| 3236 ..isSynthetic = isSynthetic; | 3236 ..isSynthetic = isSynthetic; |
| 3237 } | 3237 } |
| 3238 | 3238 |
| 3239 @override | 3239 @override |
| 3240 Initializer buildRedirectingInitializer( | 3240 Initializer buildRedirectingInitializer( |
| 3241 Constructor constructor, Arguments arguments, | 3241 Constructor constructor, Arguments arguments, |
| 3242 [int charOffset = -1]) { | 3242 [int charOffset = -1]) { |
| 3243 needsImplicitSuperInitializer = false; | 3243 needsImplicitSuperInitializer = false; |
| 3244 return new KernelRedirectingInitializer(constructor, arguments) | 3244 return new ShadowRedirectingInitializer(constructor, arguments) |
| 3245 ..fileOffset = charOffset; | 3245 ..fileOffset = charOffset; |
| 3246 } | 3246 } |
| 3247 | 3247 |
| 3248 @override | 3248 @override |
| 3249 Expression buildProblemExpression(ProblemBuilder builder, int charOffset) { | 3249 Expression buildProblemExpression(ProblemBuilder builder, int charOffset) { |
| 3250 return buildCompileTimeError(builder.message, charOffset); | 3250 return buildCompileTimeError(builder.message, charOffset); |
| 3251 } | 3251 } |
| 3252 | 3252 |
| 3253 @override | 3253 @override |
| 3254 void handleOperator(Token token) { | 3254 void handleOperator(Token token) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3332 Expression receiver, Name name, Arguments arguments, int offset, | 3332 Expression receiver, Name name, Arguments arguments, int offset, |
| 3333 {bool isConstantExpression: false, | 3333 {bool isConstantExpression: false, |
| 3334 bool isNullAware: false, | 3334 bool isNullAware: false, |
| 3335 bool isImplicitCall: false}) { | 3335 bool isImplicitCall: false}) { |
| 3336 if (constantExpressionRequired && !isConstantExpression) { | 3336 if (constantExpressionRequired && !isConstantExpression) { |
| 3337 return deprecated_buildCompileTimeError( | 3337 return deprecated_buildCompileTimeError( |
| 3338 "Not a constant expression.", offset); | 3338 "Not a constant expression.", offset); |
| 3339 } | 3339 } |
| 3340 if (isNullAware) { | 3340 if (isNullAware) { |
| 3341 VariableDeclaration variable = new VariableDeclaration.forValue(receiver); | 3341 VariableDeclaration variable = new VariableDeclaration.forValue(receiver); |
| 3342 return new KernelNullAwareMethodInvocation( | 3342 return new ShadowNullAwareMethodInvocation( |
| 3343 variable, | 3343 variable, |
| 3344 new ConditionalExpression( | 3344 new ConditionalExpression( |
| 3345 buildIsNull(new VariableGet(variable), offset), | 3345 buildIsNull(new VariableGet(variable), offset), |
| 3346 new NullLiteral(), | 3346 new NullLiteral(), |
| 3347 new MethodInvocation(new VariableGet(variable), name, arguments) | 3347 new MethodInvocation(new VariableGet(variable), name, arguments) |
| 3348 ..fileOffset = offset, | 3348 ..fileOffset = offset, |
| 3349 null) | 3349 null) |
| 3350 ..fileOffset = offset) | 3350 ..fileOffset = offset) |
| 3351 ..fileOffset = offset; | 3351 ..fileOffset = offset; |
| 3352 } else { | 3352 } else { |
| 3353 return new KernelMethodInvocation(receiver, name, arguments, | 3353 return new ShadowMethodInvocation(receiver, name, arguments, |
| 3354 isImplicitCall: isImplicitCall) | 3354 isImplicitCall: isImplicitCall) |
| 3355 ..fileOffset = offset; | 3355 ..fileOffset = offset; |
| 3356 } | 3356 } |
| 3357 } | 3357 } |
| 3358 | 3358 |
| 3359 @override | 3359 @override |
| 3360 void addCompileTimeError(Message message, int charOffset) { | 3360 void addCompileTimeError(Message message, int charOffset) { |
| 3361 library.addCompileTimeError(message, charOffset, uri); | 3361 library.addCompileTimeError(message, charOffset, uri); |
| 3362 } | 3362 } |
| 3363 | 3363 |
| 3364 @override | 3364 @override |
| 3365 void debugEvent(String name) { | 3365 void debugEvent(String name) { |
| 3366 // printEvent('BodyBuilder: $name'); | 3366 // printEvent('BodyBuilder: $name'); |
| 3367 } | 3367 } |
| 3368 | 3368 |
| 3369 @override | 3369 @override |
| 3370 StaticGet makeStaticGet(Member readTarget, Token token) { | 3370 StaticGet makeStaticGet(Member readTarget, Token token) { |
| 3371 return new KernelStaticGet(readTarget)..fileOffset = offsetForToken(token); | 3371 return new ShadowStaticGet(readTarget)..fileOffset = offsetForToken(token); |
| 3372 } | 3372 } |
| 3373 } | 3373 } |
| 3374 | 3374 |
| 3375 class Identifier { | 3375 class Identifier { |
| 3376 final Token token; | 3376 final Token token; |
| 3377 String get name => token.lexeme; | 3377 String get name => token.lexeme; |
| 3378 | 3378 |
| 3379 Identifier(this.token); | 3379 Identifier(this.token); |
| 3380 | 3380 |
| 3381 Expression get initializer => null; | 3381 Expression get initializer => null; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3827 return AsyncMarker.Async; | 3827 return AsyncMarker.Async; |
| 3828 } else { | 3828 } else { |
| 3829 assert(identical(starToken.stringValue, "*")); | 3829 assert(identical(starToken.stringValue, "*")); |
| 3830 return AsyncMarker.AsyncStar; | 3830 return AsyncMarker.AsyncStar; |
| 3831 } | 3831 } |
| 3832 } else { | 3832 } else { |
| 3833 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", | 3833 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", |
| 3834 asyncToken.charOffset, null); | 3834 asyncToken.charOffset, null); |
| 3835 } | 3835 } |
| 3836 } | 3836 } |
| OLD | NEW |