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

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: 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 normally be called. Handled by [visitSwitchCase].
kasperl 2016/06/20 20:10:18 What does normally mean in this context? That it m
ahe 2016/06/21 10:51:05 Done.
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 normally 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 normally 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 normally be called. Metadata should already have been analyzed
936 // and 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 // Should not normally 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 normally, we handle parameters via
1915 // [FunctionSignture].
1916 return internalError(node, "NamedParameterDeclaration");
1903 } 1917 }
1904 1918
1905 @override 1919 @override
1906 ir.Not visitNot(Send node, Node expression, _) { 1920 ir.Not visitNot(Send node, Node expression, _) {
1907 return new ir.Not(visitForValue(expression)); 1921 return new ir.Not(visitForValue(expression));
1908 } 1922 }
1909 1923
1910 @override 1924 @override
1911 ir.Not visitNotEquals(Send node, Node left, Node right, _) { 1925 ir.Not visitNotEquals(Send node, Node left, Node right, _) {
1912 return new ir.Not(buildBinaryOperator(left, '==', right)); 1926 return new ir.Not(buildBinaryOperator(left, '==', right));
1913 } 1927 }
1914 1928
1915 @override 1929 @override
1916 ir.Initializer visitOptionalInitializingFormalDeclaration( 1930 ir.Initializer visitOptionalInitializingFormalDeclaration(
1917 VariableDefinitions node, 1931 VariableDefinitions node,
1918 Node definition, 1932 Node definition,
1919 InitializingFormalElement parameter, 1933 InitializingFormalElement parameter,
1920 ConstantExpression defaultValue, 1934 ConstantExpression defaultValue,
1921 int index, 1935 int index,
1922 _) { 1936 _) {
1923 return buildInitializingFormal(parameter); 1937 return buildInitializingFormal(parameter);
1924 } 1938 }
1925 1939
1926 @override 1940 @override
1927 ir.Throw visitOptionalParameterDeclaration( 1941 visitOptionalParameterDeclaration(
1928 VariableDefinitions node, 1942 VariableDefinitions node,
1929 Node definition, 1943 Node definition,
1930 ParameterElement parameter, 1944 ParameterElement parameter,
1931 ConstantExpression defaultValue, 1945 ConstantExpression defaultValue,
1932 int index, 1946 int index,
1933 _) { 1947 _) {
1934 return buildUnsupported(node, "OptionalParameterDeclaration"); 1948 // Shouldn't be called normally, we handle parameters via
1949 // [FunctionSignture].
1950 return internalError(node, "OptionalParameterDeclaration");
1935 } 1951 }
1936 1952
1937 @override 1953 @override
1938 ir.Throw visitParameterDeclaration( 1954 visitParameterDeclaration(
1939 VariableDefinitions node, 1955 VariableDefinitions node,
1940 Node definition, 1956 Node definition,
1941 ParameterElement parameter, 1957 ParameterElement parameter,
1942 int index, 1958 int index,
1943 _) { 1959 _) {
1944 return buildUnsupported(node, "ParameterDeclaration"); 1960 // Shouldn't be called normally, we handle parameters via
1961 // [FunctionSignture].
1962 return internalError(node, "ParameterDeclaration");
1945 } 1963 }
1946 1964
1947 @override 1965 @override
1948 ir.MethodInvocation handleLocalInvoke( 1966 ir.MethodInvocation handleLocalInvoke(
1949 Send node, 1967 Send node,
1950 LocalElement element, 1968 LocalElement element,
1951 NodeList arguments, 1969 NodeList arguments,
1952 CallStructure callStructure, 1970 CallStructure callStructure,
1953 _) { 1971 _) {
1954 return buildCall(buildLocalGet(element), callStructure, arguments); 1972 return buildCall(buildLocalGet(element), callStructure, arguments);
(...skipping 27 matching lines...) Expand all
1982 <ir.Initializer>[new ir.InvalidInitializer()]); 2000 <ir.Initializer>[new ir.InvalidInitializer()]);
1983 } 2001 }
1984 ir.Statement body = null; 2002 ir.Statement body = null;
1985 if (kernel.isSyntheticError(redirectionTarget)) { 2003 if (kernel.isSyntheticError(redirectionTarget)) {
1986 body = new ir.InvalidStatement(); 2004 body = new ir.InvalidStatement();
1987 } else { 2005 } else {
1988 // TODO(ahe): This should be implemented, but doesn't matter much unless 2006 // 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 2007 // we support reflection. At the call-site, we bypass this factory and
1990 // call its effective target directly. So this factory is only necessary 2008 // call its effective target directly. So this factory is only necessary
1991 // for reflection. 2009 // for reflection.
1992 body = new ir.ExpressionStatement( 2010 body = new ir.InvalidStatement();
1993 buildUnsupported(node, "redirecting factory constructor body."));
1994 } 2011 }
1995 IrFunction function = 2012 IrFunction function =
1996 buildIrFunction(ir.ProcedureKind.Factory, constructor, null); 2013 buildIrFunction(ir.ProcedureKind.Factory, constructor, null);
1997 function.node.body = body..parent = function.node; 2014 function.node.body = body..parent = function.node;
1998 return function; 2015 return function;
1999 } 2016 }
2000 2017
2001 @override 2018 @override
2002 ir.Expression visitRedirectingFactoryConstructorInvoke( 2019 ir.Expression visitRedirectingFactoryConstructorInvoke(
2003 NewExpression node, 2020 NewExpression node,
(...skipping 29 matching lines...) Expand all
2033 ConstructorElement constructor, 2050 ConstructorElement constructor,
2034 InterfaceType type, 2051 InterfaceType type,
2035 NodeList arguments, 2052 NodeList arguments,
2036 CallStructure callStructure, 2053 CallStructure callStructure,
2037 _) { 2054 _) {
2038 return buildGenerativeConstructorInvoke( 2055 return buildGenerativeConstructorInvoke(
2039 constructor, arguments, isConst: false); 2056 constructor, arguments, isConst: false);
2040 } 2057 }
2041 2058
2042 @override 2059 @override
2043 ir.Throw visitStaticConstantDeclaration( 2060 visitStaticConstantDeclaration(
2044 VariableDefinitions node, 2061 VariableDefinitions node,
2045 Node definition, 2062 Node definition,
2046 FieldElement field, 2063 FieldElement field,
2047 ConstantExpression constant, 2064 ConstantExpression constant,
2048 _) { 2065 _) {
2049 // Should not normally be called, handled by fieldToIr. 2066 // Should not normally be called, handled by fieldToIr.
2050 return internalError(node, "StaticConstantDeclaration"); 2067 return internalError(node, "StaticConstantDeclaration");
2051 } 2068 }
2052 2069
2053 @override 2070 @override
2054 ir.Throw visitStaticFieldDeclaration( 2071 visitStaticFieldDeclaration(
2055 VariableDefinitions node, 2072 VariableDefinitions node,
2056 Node definition, 2073 Node definition,
2057 FieldElement field, 2074 FieldElement field,
2058 Node initializer, 2075 Node initializer,
2059 _) { 2076 _) {
2060 // Should not normally be called, handled by fieldToIr. 2077 // Should not normally be called, handled by fieldToIr.
2061 return internalError(node, "StaticFieldDeclaration"); 2078 return internalError(node, "StaticFieldDeclaration");
2062 } 2079 }
2063 2080
2064 ir.Expression buildStaticGet(Element element) { 2081 ir.Expression buildStaticGet(Element element) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 _) { 2293 _) {
2277 return buildIrFunction(ir.ProcedureKind.Getter, getter, body); 2294 return buildIrFunction(ir.ProcedureKind.Getter, getter, body);
2278 } 2295 }
2279 2296
2280 @override 2297 @override
2281 ir.Expression handleStaticGetterGet( 2298 ir.Expression handleStaticGetterGet(
2282 Send node, 2299 Send node,
2283 FunctionElement getter, 2300 FunctionElement getter,
2284 _) { 2301 _) {
2285 if (getter.isDeferredLoaderGetter) { 2302 if (getter.isDeferredLoaderGetter) {
2286 return buildUnsupported(node, "deferred access"); 2303 // TODO(ahe): Support deferred load.
2304 return new ir.InvalidExpression();
2287 } 2305 }
2288 return buildStaticGet(getter); 2306 return buildStaticGet(getter);
2289 } 2307 }
2290 2308
2291 @override 2309 @override
2292 ir.Expression handleStaticGetterInvoke( 2310 ir.Expression handleStaticGetterInvoke(
2293 Send node, 2311 Send node,
2294 FunctionElement getter, 2312 FunctionElement getter,
2295 NodeList arguments, 2313 NodeList arguments,
2296 CallStructure callStructure, 2314 CallStructure callStructure,
2297 _) { 2315 _) {
2298 if (getter.isDeferredLoaderGetter) { 2316 if (getter.isDeferredLoaderGetter) {
2299 return buildUnsupported(node, "deferred access"); 2317 // TODO(ahe): Support deferred load.
2318 return new ir.InvalidExpression();
2300 } 2319 }
2301 return buildCall(buildStaticGet(getter), callStructure, arguments); 2320 return buildCall(buildStaticGet(getter), callStructure, arguments);
2302 } 2321 }
2303 2322
2304 @override 2323 @override
2305 ir.Expression handleStaticGetterSet( 2324 ir.Expression handleStaticGetterSet(
2306 SendSet node, 2325 SendSet node,
2307 FunctionElement getter, 2326 FunctionElement getter,
2308 Node rhs, 2327 Node rhs,
2309 _) { 2328 _) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 new ir.ThisExpression(), selector, buildArguments(arguments)); 2752 new ir.ThisExpression(), selector, buildArguments(arguments));
2734 } 2753 }
2735 2754
2736 @override 2755 @override
2737 ir.Expression visitThisPropertySet(SendSet node, Name name, Node rhs, _) { 2756 ir.Expression visitThisPropertySet(SendSet node, Name name, Node rhs, _) {
2738 return buildThisPropertyAccessor(name) 2757 return buildThisPropertyAccessor(name)
2739 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); 2758 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext);
2740 } 2759 }
2741 2760
2742 @override 2761 @override
2743 ir.Throw visitTopLevelConstantDeclaration( 2762 ir.Expression visitTopLevelConstantDeclaration(
2744 VariableDefinitions node, 2763 VariableDefinitions node,
2745 Node definition, 2764 Node definition,
2746 FieldElement field, 2765 FieldElement field,
2747 ConstantExpression constant, 2766 ConstantExpression constant,
2748 _) { 2767 _) {
2749 return buildUnsupported(node, "TopLevelConstantDeclaration"); 2768 // Should not normally be called, handled by fieldToIr.
2769 return internalError(node, "TopLevelFieldDeclaration");
2750 } 2770 }
2751 2771
2752 @override 2772 @override
2753 ir.Throw visitTopLevelFieldDeclaration( 2773 ir.Expression visitTopLevelFieldDeclaration(
2754 VariableDefinitions node, 2774 VariableDefinitions node,
2755 Node definition, 2775 Node definition,
2756 FieldElement field, 2776 FieldElement field,
2757 Node initializer, 2777 Node initializer,
2758 _) { 2778 _) {
2759 return buildUnsupported(node, "TopLevelFieldDeclaration"); 2779 // Should not normally be called, handled by fieldToIr.
2780 return internalError(node, "TopLevelFieldDeclaration");
2760 } 2781 }
2761 2782
2762 @override 2783 @override
2763 IrFunction visitTopLevelFunctionDeclaration( 2784 IrFunction visitTopLevelFunctionDeclaration(
2764 FunctionExpression node, 2785 FunctionExpression node,
2765 MethodElement function, 2786 MethodElement function,
2766 NodeList parameters, 2787 NodeList parameters,
2767 Node body, 2788 Node body,
2768 _) { 2789 _) {
2769 return buildIrFunction(ir.ProcedureKind.Method, function, body); 2790 return buildIrFunction(ir.ProcedureKind.Method, function, body);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2884 Send node, 2905 Send node,
2885 UnaryOperator operator, 2906 UnaryOperator operator,
2886 Node expression, _) { 2907 Node expression, _) {
2887 return new ir.MethodInvocation( 2908 return new ir.MethodInvocation(
2888 visitForValue(expression), 2909 visitForValue(expression),
2889 kernel.irName(operator.selectorName, currentElement), 2910 kernel.irName(operator.selectorName, currentElement),
2890 new ir.Arguments.empty()); 2911 new ir.Arguments.empty());
2891 } 2912 }
2892 2913
2893 @override 2914 @override
2894 ir.Throw visitConditionalUri(ConditionalUri node) { 2915 visitConditionalUri(ConditionalUri node) {
2895 return buildUnsupported(node, "ConditionalUri"); 2916 // Shouldn't be called normally, handled by library loader.
2917 return internalError(node, "ConditionalUri");
2896 } 2918 }
2897 2919
2898 @override 2920 @override
2899 ir.Throw visitDottedName(DottedName node) { 2921 visitDottedName(DottedName node) {
2900 return buildUnsupported(node, "DottedName"); 2922 // Shouldn't be called normally, handled by library loader.
2923 return internalError(node, "DottedName");
2901 } 2924 }
2902 2925
2903 @override 2926 @override
2904 ir.Throw visitForIn(ForIn node) { 2927 visitForIn(ForIn node) {
2905 return internalError( 2928 // Shouldn't be called normally, handled by [visitAsyncForIn] or
2906 node, "Should have been caught by visitAsyncForIn or visitSyncForIn"); 2929 // [visitSyncForIn].
2930 return internalError(node, "ForIn");
2907 } 2931 }
2908 2932
2909 @override 2933 @override
2910 ir.Expression visitIndexSetIfNull( 2934 ir.Expression visitIndexSetIfNull(
2911 SendSet node, Node receiver, Node index, Node rhs, _) { 2935 SendSet node, Node receiver, Node index, Node rhs, _) {
2912 return buildIndexAccessor(receiver, index) 2936 return buildIndexAccessor(receiver, index)
2913 .buildNullAwareAssignment( 2937 .buildNullAwareAssignment(
2914 visitForValue(rhs), voidContext: isVoidContext); 2938 visitForValue(rhs), voidContext: isVoidContext);
2915 } 2939 }
2916 2940
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 : this(null, true, node, initializers); 3049 : this(null, true, node, initializers);
3026 3050
3027 accept(ir.Visitor v) => throw "unsupported"; 3051 accept(ir.Visitor v) => throw "unsupported";
3028 3052
3029 visitChildren(ir.Visitor v) => throw "unsupported"; 3053 visitChildren(ir.Visitor v) => throw "unsupported";
3030 3054
3031 String toString() { 3055 String toString() {
3032 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 3056 return "IrFunction($kind, $isConstructor, $node, $initializers)";
3033 } 3057 }
3034 } 3058 }
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