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

Side by Side Diff: lib/kernel_visitor.dart

Issue 2080783002: Reduce usage of buildUnsupported. (Closed) Base URL: git@github.com:dart-lang/rasta.git@status
Patch Set: Remove normally. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/error.dart ('k') | test/kernel/regression/bad_default_constructor.dart.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library rasta.kernel_visitor; 5 library rasta.kernel_visitor;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 8
9 import 'package:kernel/accessors.dart' show 9 import 'package:kernel/accessors.dart' show
10 Accessor, 10 Accessor,
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 return new ir.InvalidExpression(); 356 return new ir.InvalidExpression();
357 } 357 }
358 } 358 }
359 359
360 @override 360 @override
361 ir.InvalidExpression handleUnresolved(Node node) { 361 ir.InvalidExpression handleUnresolved(Node node) {
362 return new ir.InvalidExpression(); 362 return new ir.InvalidExpression();
363 } 363 }
364 364
365 @override 365 @override
366 ir.Throw handleError(Node node) { 366 ir.Expression handleError(Node node) => new ir.InvalidExpression();
367 return buildUnsupported(node, "handleError");
368 }
369 367
370 @override 368 @override
371 void apply(Node node, _) { 369 void apply(Node node, _) {
372 throw new Unsupported("Not implemented yet."); 370 throw new Unsupported("Not implemented yet.");
373 } 371 }
374 372
375 @override 373 @override
376 void previsitDeferredAccess(Send node, PrefixElement prefix, _) { 374 void previsitDeferredAccess(Send node, PrefixElement prefix, _) {
377 } 375 }
378 376
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 assert(startLength == cascadeReceivers.length); 698 assert(startLength == cascadeReceivers.length);
701 return new ir.Let(receiverVariable, result); 699 return new ir.Let(receiverVariable, result);
702 } 700 }
703 701
704 @override 702 @override
705 ir.VariableGet visitCascadeReceiver(CascadeReceiver node) { 703 ir.VariableGet visitCascadeReceiver(CascadeReceiver node) {
706 return cascadeReceivers.remove(node); 704 return cascadeReceivers.remove(node);
707 } 705 }
708 706
709 @override 707 @override
710 ir.Throw visitCaseMatch(CaseMatch node) { 708 visitCaseMatch(CaseMatch node) {
711 return buildUnsupported(node, "CaseMatch"); 709 // Shouldn't be called. Handled by [visitSwitchCase].
710 return internalError(node, "CaseMatch");
712 } 711 }
713 712
714 @override 713 @override
715 ir.Catch visitCatchBlock(CatchBlock node) { 714 ir.Catch visitCatchBlock(CatchBlock node) {
716 ir.VariableDeclaration exception = 715 ir.VariableDeclaration exception =
717 (node.exception == null) ? null : getLocal(elements[node.exception]); 716 (node.exception == null) ? null : getLocal(elements[node.exception]);
718 ir.VariableDeclaration trace = 717 ir.VariableDeclaration trace =
719 (node.trace == null) ? null : getLocal(elements[node.trace]); 718 (node.trace == null) ? null : getLocal(elements[node.trace]);
720 ir.DartType guard = computeType(node.type); 719 ir.DartType guard = computeType(node.type);
721 return new ir.Catch( 720 return new ir.Catch(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 ir.Statement visitIf(If node) { 818 ir.Statement visitIf(If node) {
820 return buildContinueAndBreakTarget( 819 return buildContinueAndBreakTarget(
821 new ir.IfStatement( 820 new ir.IfStatement(
822 visitForValue(node.condition), 821 visitForValue(node.condition),
823 buildStatementInBlock(node.thenPart), 822 buildStatementInBlock(node.thenPart),
824 buildStatementInBlock(node.elsePart)), 823 buildStatementInBlock(node.elsePart)),
825 node, elements.getTargetDefinition(node)); 824 node, elements.getTargetDefinition(node));
826 } 825 }
827 826
828 @override 827 @override
829 ir.Throw visitLabel(Label node) { 828 visitLabel(Label node) {
830 return buildUnsupported(node, "Label"); 829 // Shouldn't be called. Handled by visitLabeledStatement and
830 // visitSwitchCase.
831 return internalError(node, "Label");
831 } 832 }
832 833
833 @override 834 @override
834 ir.Statement visitLabeledStatement(LabeledStatement node) { 835 ir.Statement visitLabeledStatement(LabeledStatement node) {
835 Statement statement = node.statement; 836 Statement statement = node.statement;
836 ir.Statement result = (statement is Block) 837 ir.Statement result = (statement is Block)
837 // If [statement] is a Block, we need to ensure that we don't bypass 838 // If [statement] is a Block, we need to ensure that we don't bypass
838 // its visit method (so it can build break targets correctly). 839 // its visit method (so it can build break targets correctly).
839 ? statement.accept(this) 840 ? statement.accept(this)
840 : buildStatementInBlock(statement); 841 : buildStatementInBlock(statement);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 902 }
902 List<ir.DartType> typeArguments = 903 List<ir.DartType> typeArguments =
903 computeTypesFromTypes(node.typeArguments, expected: 2); 904 computeTypesFromTypes(node.typeArguments, expected: 2);
904 return new ir.MapLiteral( 905 return new ir.MapLiteral(
905 entries, keyType: typeArguments.first, valueType: typeArguments.last, 906 entries, keyType: typeArguments.first, valueType: typeArguments.last,
906 // TODO(ahe): Should Constness be validated? 907 // TODO(ahe): Should Constness be validated?
907 isConst: node.isConst); 908 isConst: node.isConst);
908 } 909 }
909 910
910 @override 911 @override
911 ir.Throw visitLiteralMapEntry(LiteralMapEntry node) { 912 visitLiteralMapEntry(LiteralMapEntry node) {
912 return buildUnsupported(node, "LiteralMapEntry"); 913 // Shouldn't be called. Handled by [visitLiteralMap].
914 return internalError(node, "LiteralMapEntry");
913 } 915 }
914 916
915 @override 917 @override
916 ir.NullLiteral visitLiteralNull(LiteralNull node) { 918 ir.NullLiteral visitLiteralNull(LiteralNull node) {
917 return new ir.NullLiteral(); 919 return new ir.NullLiteral();
918 } 920 }
919 921
920 @override 922 @override
921 ir.Expression visitLiteralString(LiteralString node) { 923 ir.Expression visitLiteralString(LiteralString node) {
922 if (node.dartString == null) return new ir.InvalidExpression(); 924 if (node.dartString == null) return new ir.InvalidExpression();
923 return new ir.StringLiteral(node.dartString.slowToString()); 925 return new ir.StringLiteral(node.dartString.slowToString());
924 } 926 }
925 927
926 @override 928 @override
927 ir.SymbolLiteral visitLiteralSymbol(LiteralSymbol node) { 929 ir.SymbolLiteral visitLiteralSymbol(LiteralSymbol node) {
928 return new ir.SymbolLiteral(node.slowNameString); 930 return new ir.SymbolLiteral(node.slowNameString);
929 } 931 }
930 932
931 @override 933 @override
932 ir.Throw visitMetadata(Metadata node) { 934 visitMetadata(Metadata node) {
933 return buildUnsupported(node, "Metadata"); 935 // Shouldn't be called. Metadata should already have been analyzed and
936 // converted to a constant expression in the resolver.
937 return internalError(node, "Metadata not handled as constant.");
934 } 938 }
935 939
936 @override 940 @override
937 ir.NamedExpression visitNamedArgument(NamedArgument node) { 941 ir.NamedExpression visitNamedArgument(NamedArgument node) {
938 return new ir.NamedExpression( 942 return new ir.NamedExpression(
939 node.name.source, visitForValue(node.expression)); 943 node.name.source, visitForValue(node.expression));
940 } 944 }
941 945
942 @override 946 @override
943 ir.Throw visitOperator(Operator node) { 947 visitOperator(Operator node) {
944 return buildUnsupported(node, "Operator"); 948 // This is a special subclass of [Identifier], and we should never see that
949 // in the semantic visitor.
950 return internalError(node, "Operator");
945 } 951 }
946 952
947 @override 953 @override
948 ir.Expression visitParenthesizedExpression(ParenthesizedExpression node) { 954 ir.Expression visitParenthesizedExpression(ParenthesizedExpression node) {
949 return visitWithCurrentContext(node.expression); 955 return visitWithCurrentContext(node.expression);
950 } 956 }
951 957
952 @override 958 @override
953 ir.Throw visitRedirectingFactoryBody(RedirectingFactoryBody node) { 959 visitRedirectingFactoryBody(RedirectingFactoryBody node) {
954 return buildUnsupported(node, "RedirectingFactoryBody"); 960 // Not implemented yet.
961 return internalError(node, "RedirectingFactoryBody");
955 } 962 }
956 963
957 @override 964 @override
958 ir.ExpressionStatement visitRethrow(Rethrow node) { 965 ir.ExpressionStatement visitRethrow(Rethrow node) {
959 return new ir.ExpressionStatement(new ir.Rethrow()); 966 return new ir.ExpressionStatement(new ir.Rethrow());
960 } 967 }
961 968
962 @override 969 @override
963 ir.ReturnStatement visitReturn(Return node) { 970 ir.ReturnStatement visitReturn(Return node) {
964 return new ir.ReturnStatement(visitForValue(node.expression)); 971 return new ir.ReturnStatement(visitForValue(node.expression));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 } 1069 }
1063 if (node.finallyBlock != null) { 1070 if (node.finallyBlock != null) {
1064 result = 1071 result =
1065 new ir.TryFinally(result, buildStatementInBlock(node.finallyBlock)); 1072 new ir.TryFinally(result, buildStatementInBlock(node.finallyBlock));
1066 } 1073 }
1067 return buildContinueAndBreakTarget( 1074 return buildContinueAndBreakTarget(
1068 result, node, elements.getTargetDefinition(node)); 1075 result, node, elements.getTargetDefinition(node));
1069 } 1076 }
1070 1077
1071 @override 1078 @override
1072 ir.Throw visitTypeAnnotation(TypeAnnotation node) { 1079 visitTypeAnnotation(TypeAnnotation node) {
1073 return buildUnsupported(node, "TypeAnnotation"); 1080 // Shouldn't be called, as the resolver have already resolved types and
1081 // created [DartType] objects.
1082 return internalError(node, "TypeAnnotation");
1074 } 1083 }
1075 1084
1076 @override 1085 @override
1077 ir.Throw visitTypeVariable(TypeVariable node) { 1086 visitTypeVariable(TypeVariable node) {
1078 return buildUnsupported(node, "TypeVariable"); 1087 // Shouldn't be called, as the resolver have already resolved types and
1088 // created [DartType] objects.
1089 return internalError(node, "TypeVariable");
1079 } 1090 }
1080 1091
1081 @override 1092 @override
1082 ir.Statement visitWhile(While node) { 1093 ir.Statement visitWhile(While node) {
1083 ir.Expression condition = visitForValue(node.condition); 1094 ir.Expression condition = visitForValue(node.condition);
1084 JumpTarget jumpTarget = elements.getTargetDefinition(node); 1095 JumpTarget jumpTarget = elements.getTargetDefinition(node);
1085 ir.Statement body = buildContinueTarget( 1096 ir.Statement body = buildContinueTarget(
1086 buildStatementInBlock(node.body), node, jumpTarget); 1097 buildStatementInBlock(node.body), node, jumpTarget);
1087 return buildBreakTarget( 1098 return buildBreakTarget(
1088 new ir.WhileStatement(condition, body), node, jumpTarget); 1099 new ir.WhileStatement(condition, body), node, jumpTarget);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 SendSet node, 1613 SendSet node,
1603 Node receiver, 1614 Node receiver,
1604 Name name, 1615 Name name,
1605 Node rhs, 1616 Node rhs,
1606 _) { 1617 _) {
1607 return buildNullAwarePropertyAccessor(receiver, name).buildAssignment( 1618 return buildNullAwarePropertyAccessor(receiver, name).buildAssignment(
1608 visitForValue(rhs), voidContext: isVoidContext); 1619 visitForValue(rhs), voidContext: isVoidContext);
1609 } 1620 }
1610 1621
1611 @override 1622 @override
1612 ir.Throw visitIfNotNullDynamicPropertySetIfNull( 1623 ir.Expression visitIfNotNullDynamicPropertySetIfNull(
1613 Send node, 1624 Send node,
1614 Node receiver, 1625 Node receiver,
1615 Name name, 1626 Name name,
1616 Node rhs, 1627 Node rhs,
1617 _) { 1628 _) {
1618 return buildNullAwarePropertyAccessor(receiver, name) 1629 return buildNullAwarePropertyAccessor(receiver, name)
1619 .buildNullAwareAssignment( 1630 .buildNullAwareAssignment(
1620 visitForValue(rhs), voidContext: isVoidContext); 1631 visitForValue(rhs), voidContext: isVoidContext);
1621 } 1632 }
1622 1633
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 ir.Initializer visitInitializingFormalDeclaration( 1722 ir.Initializer visitInitializingFormalDeclaration(
1712 VariableDefinitions node, 1723 VariableDefinitions node,
1713 Node definition, 1724 Node definition,
1714 InitializingFormalElement parameter, 1725 InitializingFormalElement parameter,
1715 int index, 1726 int index,
1716 _) { 1727 _) {
1717 return buildInitializingFormal(parameter); 1728 return buildInitializingFormal(parameter);
1718 } 1729 }
1719 1730
1720 @override 1731 @override
1721 ir.Throw visitInstanceFieldDeclaration( 1732 visitInstanceFieldDeclaration(
1722 VariableDefinitions node, 1733 VariableDefinitions node,
1723 Node definition, 1734 Node definition,
1724 FieldElement field, 1735 FieldElement field,
1725 Node initializer, 1736 Node initializer,
1726 _) { 1737 _) {
1727 return buildUnsupported(node, "InstanceFieldDeclaration"); 1738 // Shouldn't be called, handled by fieldToIr.
1739 return internalError(node, "InstanceFieldDeclaration");
1728 } 1740 }
1729 1741
1730 @override 1742 @override
1731 IrFunction visitInstanceGetterDeclaration( 1743 IrFunction visitInstanceGetterDeclaration(
1732 FunctionExpression node, 1744 FunctionExpression node,
1733 MethodElement getter, 1745 MethodElement getter,
1734 Node body, 1746 Node body,
1735 _) { 1747 _) {
1736 return buildIrFunction(ir.ProcedureKind.Getter, getter, body); 1748 return buildIrFunction(ir.ProcedureKind.Getter, getter, body);
1737 } 1749 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 ir.Initializer visitNamedInitializingFormalDeclaration( 1898 ir.Initializer visitNamedInitializingFormalDeclaration(
1887 VariableDefinitions node, 1899 VariableDefinitions node,
1888 Node definition, 1900 Node definition,
1889 InitializingFormalElement parameter, 1901 InitializingFormalElement parameter,
1890 ConstantExpression defaultValue, 1902 ConstantExpression defaultValue,
1891 _) { 1903 _) {
1892 return buildInitializingFormal(parameter); 1904 return buildInitializingFormal(parameter);
1893 } 1905 }
1894 1906
1895 @override 1907 @override
1896 ir.Throw visitNamedParameterDeclaration( 1908 visitNamedParameterDeclaration(
1897 VariableDefinitions node, 1909 VariableDefinitions node,
1898 Node definition, 1910 Node definition,
1899 ParameterElement parameter, 1911 ParameterElement parameter,
1900 ConstantExpression defaultValue, 1912 ConstantExpression defaultValue,
1901 _) { 1913 _) {
1902 return buildUnsupported(node, "NamedParameterDeclaration"); 1914 // Shouldn't be called, we handle parameters via [FunctionSignture].
1915 return internalError(node, "NamedParameterDeclaration");
1903 } 1916 }
1904 1917
1905 @override 1918 @override
1906 ir.Not visitNot(Send node, Node expression, _) { 1919 ir.Not visitNot(Send node, Node expression, _) {
1907 return new ir.Not(visitForValue(expression)); 1920 return new ir.Not(visitForValue(expression));
1908 } 1921 }
1909 1922
1910 @override 1923 @override
1911 ir.Not visitNotEquals(Send node, Node left, Node right, _) { 1924 ir.Not visitNotEquals(Send node, Node left, Node right, _) {
1912 return new ir.Not(buildBinaryOperator(left, '==', right)); 1925 return new ir.Not(buildBinaryOperator(left, '==', right));
1913 } 1926 }
1914 1927
1915 @override 1928 @override
1916 ir.Initializer visitOptionalInitializingFormalDeclaration( 1929 ir.Initializer visitOptionalInitializingFormalDeclaration(
1917 VariableDefinitions node, 1930 VariableDefinitions node,
1918 Node definition, 1931 Node definition,
1919 InitializingFormalElement parameter, 1932 InitializingFormalElement parameter,
1920 ConstantExpression defaultValue, 1933 ConstantExpression defaultValue,
1921 int index, 1934 int index,
1922 _) { 1935 _) {
1923 return buildInitializingFormal(parameter); 1936 return buildInitializingFormal(parameter);
1924 } 1937 }
1925 1938
1926 @override 1939 @override
1927 ir.Throw visitOptionalParameterDeclaration( 1940 visitOptionalParameterDeclaration(
1928 VariableDefinitions node, 1941 VariableDefinitions node,
1929 Node definition, 1942 Node definition,
1930 ParameterElement parameter, 1943 ParameterElement parameter,
1931 ConstantExpression defaultValue, 1944 ConstantExpression defaultValue,
1932 int index, 1945 int index,
1933 _) { 1946 _) {
1934 return buildUnsupported(node, "OptionalParameterDeclaration"); 1947 // Shouldn't be called, we handle parameters via [FunctionSignture].
1948 return internalError(node, "OptionalParameterDeclaration");
1935 } 1949 }
1936 1950
1937 @override 1951 @override
1938 ir.Throw visitParameterDeclaration( 1952 visitParameterDeclaration(
1939 VariableDefinitions node, 1953 VariableDefinitions node,
1940 Node definition, 1954 Node definition,
1941 ParameterElement parameter, 1955 ParameterElement parameter,
1942 int index, 1956 int index,
1943 _) { 1957 _) {
1944 return buildUnsupported(node, "ParameterDeclaration"); 1958 // Shouldn't be called, we handle parameters via [FunctionSignture].
1959 return internalError(node, "ParameterDeclaration");
1945 } 1960 }
1946 1961
1947 @override 1962 @override
1948 ir.MethodInvocation handleLocalInvoke( 1963 ir.MethodInvocation handleLocalInvoke(
1949 Send node, 1964 Send node,
1950 LocalElement element, 1965 LocalElement element,
1951 NodeList arguments, 1966 NodeList arguments,
1952 CallStructure callStructure, 1967 CallStructure callStructure,
1953 _) { 1968 _) {
1954 return buildCall(buildLocalGet(element), callStructure, arguments); 1969 return buildCall(buildLocalGet(element), callStructure, arguments);
(...skipping 27 matching lines...) Expand all
1982 <ir.Initializer>[new ir.InvalidInitializer()]); 1997 <ir.Initializer>[new ir.InvalidInitializer()]);
1983 } 1998 }
1984 ir.Statement body = null; 1999 ir.Statement body = null;
1985 if (kernel.isSyntheticError(redirectionTarget)) { 2000 if (kernel.isSyntheticError(redirectionTarget)) {
1986 body = new ir.InvalidStatement(); 2001 body = new ir.InvalidStatement();
1987 } else { 2002 } else {
1988 // TODO(ahe): This should be implemented, but doesn't matter much unless 2003 // TODO(ahe): This should be implemented, but doesn't matter much unless
1989 // we support reflection. At the call-site, we bypass this factory and 2004 // we support reflection. At the call-site, we bypass this factory and
1990 // call its effective target directly. So this factory is only necessary 2005 // call its effective target directly. So this factory is only necessary
1991 // for reflection. 2006 // for reflection.
1992 body = new ir.ExpressionStatement( 2007 body = new ir.InvalidStatement();
1993 buildUnsupported(node, "redirecting factory constructor body."));
1994 } 2008 }
1995 IrFunction function = 2009 IrFunction function =
1996 buildIrFunction(ir.ProcedureKind.Factory, constructor, null); 2010 buildIrFunction(ir.ProcedureKind.Factory, constructor, null);
1997 function.node.body = body..parent = function.node; 2011 function.node.body = body..parent = function.node;
1998 return function; 2012 return function;
1999 } 2013 }
2000 2014
2001 @override 2015 @override
2002 ir.Expression visitRedirectingFactoryConstructorInvoke( 2016 ir.Expression visitRedirectingFactoryConstructorInvoke(
2003 NewExpression node, 2017 NewExpression node,
(...skipping 29 matching lines...) Expand all
2033 ConstructorElement constructor, 2047 ConstructorElement constructor,
2034 InterfaceType type, 2048 InterfaceType type,
2035 NodeList arguments, 2049 NodeList arguments,
2036 CallStructure callStructure, 2050 CallStructure callStructure,
2037 _) { 2051 _) {
2038 return buildGenerativeConstructorInvoke( 2052 return buildGenerativeConstructorInvoke(
2039 constructor, arguments, isConst: false); 2053 constructor, arguments, isConst: false);
2040 } 2054 }
2041 2055
2042 @override 2056 @override
2043 ir.Throw visitStaticConstantDeclaration( 2057 visitStaticConstantDeclaration(
2044 VariableDefinitions node, 2058 VariableDefinitions node,
2045 Node definition, 2059 Node definition,
2046 FieldElement field, 2060 FieldElement field,
2047 ConstantExpression constant, 2061 ConstantExpression constant,
2048 _) { 2062 _) {
2049 // Should not normally be called, handled by fieldToIr. 2063 // Shouldn't be called, handled by fieldToIr.
2050 return internalError(node, "StaticConstantDeclaration"); 2064 return internalError(node, "StaticConstantDeclaration");
2051 } 2065 }
2052 2066
2053 @override 2067 @override
2054 ir.Throw visitStaticFieldDeclaration( 2068 visitStaticFieldDeclaration(
2055 VariableDefinitions node, 2069 VariableDefinitions node,
2056 Node definition, 2070 Node definition,
2057 FieldElement field, 2071 FieldElement field,
2058 Node initializer, 2072 Node initializer,
2059 _) { 2073 _) {
2060 // Should not normally be called, handled by fieldToIr. 2074 // Shouldn't be called, handled by fieldToIr.
2061 return internalError(node, "StaticFieldDeclaration"); 2075 return internalError(node, "StaticFieldDeclaration");
2062 } 2076 }
2063 2077
2064 ir.Expression buildStaticGet(Element element) { 2078 ir.Expression buildStaticGet(Element element) {
2065 return buildStaticAccessor(element).buildSimpleRead(); 2079 return buildStaticAccessor(element).buildSimpleRead();
2066 } 2080 }
2067 2081
2068 @override 2082 @override
2069 ir.Expression handleStaticFieldGet(Send node, FieldElement field, _) { 2083 ir.Expression handleStaticFieldGet(Send node, FieldElement field, _) {
2070 return buildStaticGet(field); 2084 return buildStaticGet(field);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 _) { 2290 _) {
2277 return buildIrFunction(ir.ProcedureKind.Getter, getter, body); 2291 return buildIrFunction(ir.ProcedureKind.Getter, getter, body);
2278 } 2292 }
2279 2293
2280 @override 2294 @override
2281 ir.Expression handleStaticGetterGet( 2295 ir.Expression handleStaticGetterGet(
2282 Send node, 2296 Send node,
2283 FunctionElement getter, 2297 FunctionElement getter,
2284 _) { 2298 _) {
2285 if (getter.isDeferredLoaderGetter) { 2299 if (getter.isDeferredLoaderGetter) {
2286 return buildUnsupported(node, "deferred access"); 2300 // TODO(ahe): Support deferred load.
2301 return new ir.InvalidExpression();
2287 } 2302 }
2288 return buildStaticGet(getter); 2303 return buildStaticGet(getter);
2289 } 2304 }
2290 2305
2291 @override 2306 @override
2292 ir.Expression handleStaticGetterInvoke( 2307 ir.Expression handleStaticGetterInvoke(
2293 Send node, 2308 Send node,
2294 FunctionElement getter, 2309 FunctionElement getter,
2295 NodeList arguments, 2310 NodeList arguments,
2296 CallStructure callStructure, 2311 CallStructure callStructure,
2297 _) { 2312 _) {
2298 if (getter.isDeferredLoaderGetter) { 2313 if (getter.isDeferredLoaderGetter) {
2299 return buildUnsupported(node, "deferred access"); 2314 // TODO(ahe): Support deferred load.
2315 return new ir.InvalidExpression();
2300 } 2316 }
2301 return buildCall(buildStaticGet(getter), callStructure, arguments); 2317 return buildCall(buildStaticGet(getter), callStructure, arguments);
2302 } 2318 }
2303 2319
2304 @override 2320 @override
2305 ir.Expression handleStaticGetterSet( 2321 ir.Expression handleStaticGetterSet(
2306 SendSet node, 2322 SendSet node,
2307 FunctionElement getter, 2323 FunctionElement getter,
2308 Node rhs, 2324 Node rhs,
2309 _) { 2325 _) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 new ir.ThisExpression(), selector, buildArguments(arguments)); 2749 new ir.ThisExpression(), selector, buildArguments(arguments));
2734 } 2750 }
2735 2751
2736 @override 2752 @override
2737 ir.Expression visitThisPropertySet(SendSet node, Name name, Node rhs, _) { 2753 ir.Expression visitThisPropertySet(SendSet node, Name name, Node rhs, _) {
2738 return buildThisPropertyAccessor(name) 2754 return buildThisPropertyAccessor(name)
2739 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); 2755 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext);
2740 } 2756 }
2741 2757
2742 @override 2758 @override
2743 ir.Throw visitTopLevelConstantDeclaration( 2759 ir.Expression visitTopLevelConstantDeclaration(
2744 VariableDefinitions node, 2760 VariableDefinitions node,
2745 Node definition, 2761 Node definition,
2746 FieldElement field, 2762 FieldElement field,
2747 ConstantExpression constant, 2763 ConstantExpression constant,
2748 _) { 2764 _) {
2749 return buildUnsupported(node, "TopLevelConstantDeclaration"); 2765 // Shouldn't be called, handled by fieldToIr.
2766 return internalError(node, "TopLevelFieldDeclaration");
2750 } 2767 }
2751 2768
2752 @override 2769 @override
2753 ir.Throw visitTopLevelFieldDeclaration( 2770 ir.Expression visitTopLevelFieldDeclaration(
2754 VariableDefinitions node, 2771 VariableDefinitions node,
2755 Node definition, 2772 Node definition,
2756 FieldElement field, 2773 FieldElement field,
2757 Node initializer, 2774 Node initializer,
2758 _) { 2775 _) {
2759 return buildUnsupported(node, "TopLevelFieldDeclaration"); 2776 // Shouldn't be called, handled by fieldToIr.
2777 return internalError(node, "TopLevelFieldDeclaration");
2760 } 2778 }
2761 2779
2762 @override 2780 @override
2763 IrFunction visitTopLevelFunctionDeclaration( 2781 IrFunction visitTopLevelFunctionDeclaration(
2764 FunctionExpression node, 2782 FunctionExpression node,
2765 MethodElement function, 2783 MethodElement function,
2766 NodeList parameters, 2784 NodeList parameters,
2767 Node body, 2785 Node body,
2768 _) { 2786 _) {
2769 return buildIrFunction(ir.ProcedureKind.Method, function, body); 2787 return buildIrFunction(ir.ProcedureKind.Method, function, body);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2884 Send node, 2902 Send node,
2885 UnaryOperator operator, 2903 UnaryOperator operator,
2886 Node expression, _) { 2904 Node expression, _) {
2887 return new ir.MethodInvocation( 2905 return new ir.MethodInvocation(
2888 visitForValue(expression), 2906 visitForValue(expression),
2889 kernel.irName(operator.selectorName, currentElement), 2907 kernel.irName(operator.selectorName, currentElement),
2890 new ir.Arguments.empty()); 2908 new ir.Arguments.empty());
2891 } 2909 }
2892 2910
2893 @override 2911 @override
2894 ir.Throw visitConditionalUri(ConditionalUri node) { 2912 visitConditionalUri(ConditionalUri node) {
2895 return buildUnsupported(node, "ConditionalUri"); 2913 // Shouldn't be called, handled by library loader.
2914 return internalError(node, "ConditionalUri");
2896 } 2915 }
2897 2916
2898 @override 2917 @override
2899 ir.Throw visitDottedName(DottedName node) { 2918 visitDottedName(DottedName node) {
2900 return buildUnsupported(node, "DottedName"); 2919 // Shouldn't be called, handled by library loader.
2920 return internalError(node, "DottedName");
2901 } 2921 }
2902 2922
2903 @override 2923 @override
2904 ir.Throw visitForIn(ForIn node) { 2924 visitForIn(ForIn node) {
2905 return internalError( 2925 // Shouldn't be called, handled by [visitAsyncForIn] or [visitSyncForIn].
2906 node, "Should have been caught by visitAsyncForIn or visitSyncForIn"); 2926 return internalError(node, "ForIn");
2907 } 2927 }
2908 2928
2909 @override 2929 @override
2910 ir.Expression visitIndexSetIfNull( 2930 ir.Expression visitIndexSetIfNull(
2911 SendSet node, Node receiver, Node index, Node rhs, _) { 2931 SendSet node, Node receiver, Node index, Node rhs, _) {
2912 return buildIndexAccessor(receiver, index) 2932 return buildIndexAccessor(receiver, index)
2913 .buildNullAwareAssignment( 2933 .buildNullAwareAssignment(
2914 visitForValue(rhs), voidContext: isVoidContext); 2934 visitForValue(rhs), voidContext: isVoidContext);
2915 } 2935 }
2916 2936
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 : this(null, true, node, initializers); 3045 : this(null, true, node, initializers);
3026 3046
3027 accept(ir.Visitor v) => throw "unsupported"; 3047 accept(ir.Visitor v) => throw "unsupported";
3028 3048
3029 visitChildren(ir.Visitor v) => throw "unsupported"; 3049 visitChildren(ir.Visitor v) => throw "unsupported";
3030 3050
3031 String toString() { 3051 String toString() {
3032 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 3052 return "IrFunction($kind, $isConstructor, $node, $initializers)";
3033 } 3053 }
3034 } 3054 }
OLDNEW
« no previous file with comments | « lib/error.dart ('k') | test/kernel/regression/bad_default_constructor.dart.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698