Chromium Code Reviews| 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 /// ----------------------------------------------------------------------- | 5 /// ----------------------------------------------------------------------- |
| 6 /// ERROR HANDLING | 6 /// ERROR HANDLING |
| 7 /// ----------------------------------------------------------------------- | 7 /// ----------------------------------------------------------------------- |
| 8 /// | 8 /// |
| 9 /// As a rule of thumb, errors that can be detected statically are handled by | 9 /// As a rule of thumb, errors that can be detected statically are handled by |
| 10 /// the frontend, typically by translating the erroneous code into a 'throw' or | 10 /// the frontend, typically by translating the erroneous code into a 'throw' or |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 } | 1687 } |
| 1688 return const DynamicType(); | 1688 return const DynamicType(); |
| 1689 } | 1689 } |
| 1690 | 1690 |
| 1691 accept(ExpressionVisitor v) => v.visitPropertyGet(this); | 1691 accept(ExpressionVisitor v) => v.visitPropertyGet(this); |
| 1692 accept1(ExpressionVisitor1 v, arg) => v.visitPropertyGet(this, arg); | 1692 accept1(ExpressionVisitor1 v, arg) => v.visitPropertyGet(this, arg); |
| 1693 | 1693 |
| 1694 visitChildren(Visitor v) { | 1694 visitChildren(Visitor v) { |
| 1695 receiver?.accept(v); | 1695 receiver?.accept(v); |
| 1696 name?.accept(v); | 1696 name?.accept(v); |
| 1697 v.visitInterfaceTargetReference(interfaceTargetReference); | |
|
Kevin Millikin (Google)
2017/05/30 15:11:33
We don't usually structure visitors based on the s
scheglov
2017/05/30 17:45:50
Hm... There is no method acceptReference in Refere
| |
| 1697 } | 1698 } |
| 1698 | 1699 |
| 1699 transformChildren(Transformer v) { | 1700 transformChildren(Transformer v) { |
| 1700 if (receiver != null) { | 1701 if (receiver != null) { |
| 1701 receiver = receiver.accept(v); | 1702 receiver = receiver.accept(v); |
| 1702 receiver?.parent = this; | 1703 receiver?.parent = this; |
| 1703 } | 1704 } |
| 1704 } | 1705 } |
| 1705 } | 1706 } |
| 1706 | 1707 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1734 } | 1735 } |
| 1735 | 1736 |
| 1736 DartType getStaticType(TypeEnvironment types) => value.getStaticType(types); | 1737 DartType getStaticType(TypeEnvironment types) => value.getStaticType(types); |
| 1737 | 1738 |
| 1738 accept(ExpressionVisitor v) => v.visitPropertySet(this); | 1739 accept(ExpressionVisitor v) => v.visitPropertySet(this); |
| 1739 accept1(ExpressionVisitor1 v, arg) => v.visitPropertySet(this, arg); | 1740 accept1(ExpressionVisitor1 v, arg) => v.visitPropertySet(this, arg); |
| 1740 | 1741 |
| 1741 visitChildren(Visitor v) { | 1742 visitChildren(Visitor v) { |
| 1742 receiver?.accept(v); | 1743 receiver?.accept(v); |
| 1743 name?.accept(v); | 1744 name?.accept(v); |
| 1745 v.visitInterfaceTargetReference(interfaceTargetReference); | |
| 1744 value?.accept(v); | 1746 value?.accept(v); |
| 1745 } | 1747 } |
| 1746 | 1748 |
| 1747 transformChildren(Transformer v) { | 1749 transformChildren(Transformer v) { |
| 1748 if (receiver != null) { | 1750 if (receiver != null) { |
| 1749 receiver = receiver.accept(v); | 1751 receiver = receiver.accept(v); |
| 1750 receiver?.parent = this; | 1752 receiver?.parent = this; |
| 1751 } | 1753 } |
| 1752 if (value != null) { | 1754 if (value != null) { |
| 1753 value = value.accept(v); | 1755 value = value.accept(v); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1933 return Substitution | 1935 return Substitution |
| 1934 .fromInterfaceType(receiver) | 1936 .fromInterfaceType(receiver) |
| 1935 .substituteType(interfaceTarget.getterType); | 1937 .substituteType(interfaceTarget.getterType); |
| 1936 } | 1938 } |
| 1937 | 1939 |
| 1938 accept(ExpressionVisitor v) => v.visitSuperPropertyGet(this); | 1940 accept(ExpressionVisitor v) => v.visitSuperPropertyGet(this); |
| 1939 accept1(ExpressionVisitor1 v, arg) => v.visitSuperPropertyGet(this, arg); | 1941 accept1(ExpressionVisitor1 v, arg) => v.visitSuperPropertyGet(this, arg); |
| 1940 | 1942 |
| 1941 visitChildren(Visitor v) { | 1943 visitChildren(Visitor v) { |
| 1942 name?.accept(v); | 1944 name?.accept(v); |
| 1945 v.visitInterfaceTargetReference(interfaceTargetReference); | |
| 1943 } | 1946 } |
| 1944 | 1947 |
| 1945 transformChildren(Transformer v) {} | 1948 transformChildren(Transformer v) {} |
| 1946 } | 1949 } |
| 1947 | 1950 |
| 1948 /// Expression of form `super.field = value`. | 1951 /// Expression of form `super.field = value`. |
| 1949 /// | 1952 /// |
| 1950 /// This may invoke a setter or assign a field. | 1953 /// This may invoke a setter or assign a field. |
| 1951 /// | 1954 /// |
| 1952 /// Evaluates to the value of [value]. | 1955 /// Evaluates to the value of [value]. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1969 interfaceTargetReference = getMemberReference(member); | 1972 interfaceTargetReference = getMemberReference(member); |
| 1970 } | 1973 } |
| 1971 | 1974 |
| 1972 DartType getStaticType(TypeEnvironment types) => value.getStaticType(types); | 1975 DartType getStaticType(TypeEnvironment types) => value.getStaticType(types); |
| 1973 | 1976 |
| 1974 accept(ExpressionVisitor v) => v.visitSuperPropertySet(this); | 1977 accept(ExpressionVisitor v) => v.visitSuperPropertySet(this); |
| 1975 accept1(ExpressionVisitor1 v, arg) => v.visitSuperPropertySet(this, arg); | 1978 accept1(ExpressionVisitor1 v, arg) => v.visitSuperPropertySet(this, arg); |
| 1976 | 1979 |
| 1977 visitChildren(Visitor v) { | 1980 visitChildren(Visitor v) { |
| 1978 name?.accept(v); | 1981 name?.accept(v); |
| 1982 v.visitInterfaceTargetReference(interfaceTargetReference); | |
| 1979 value?.accept(v); | 1983 value?.accept(v); |
| 1980 } | 1984 } |
| 1981 | 1985 |
| 1982 transformChildren(Transformer v) { | 1986 transformChildren(Transformer v) { |
| 1983 if (value != null) { | 1987 if (value != null) { |
| 1984 value = value.accept(v); | 1988 value = value.accept(v); |
| 1985 value?.parent = this; | 1989 value?.parent = this; |
| 1986 } | 1990 } |
| 1987 } | 1991 } |
| 1988 } | 1992 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2181 } | 2185 } |
| 2182 return const DynamicType(); | 2186 return const DynamicType(); |
| 2183 } | 2187 } |
| 2184 | 2188 |
| 2185 accept(ExpressionVisitor v) => v.visitMethodInvocation(this); | 2189 accept(ExpressionVisitor v) => v.visitMethodInvocation(this); |
| 2186 accept1(ExpressionVisitor1 v, arg) => v.visitMethodInvocation(this, arg); | 2190 accept1(ExpressionVisitor1 v, arg) => v.visitMethodInvocation(this, arg); |
| 2187 | 2191 |
| 2188 visitChildren(Visitor v) { | 2192 visitChildren(Visitor v) { |
| 2189 receiver?.accept(v); | 2193 receiver?.accept(v); |
| 2190 name?.accept(v); | 2194 name?.accept(v); |
| 2195 v.visitInterfaceTargetReference(interfaceTargetReference); | |
| 2191 arguments?.accept(v); | 2196 arguments?.accept(v); |
| 2192 } | 2197 } |
| 2193 | 2198 |
| 2194 transformChildren(Transformer v) { | 2199 transformChildren(Transformer v) { |
| 2195 if (receiver != null) { | 2200 if (receiver != null) { |
| 2196 receiver = receiver.accept(v); | 2201 receiver = receiver.accept(v); |
| 2197 receiver?.parent = this; | 2202 receiver?.parent = this; |
| 2198 } | 2203 } |
| 2199 if (arguments != null) { | 2204 if (arguments != null) { |
| 2200 arguments = arguments.accept(v); | 2205 arguments = arguments.accept(v); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2238 return Substitution | 2243 return Substitution |
| 2239 .fromPairs(interfaceTarget.function.typeParameters, arguments.types) | 2244 .fromPairs(interfaceTarget.function.typeParameters, arguments.types) |
| 2240 .substituteType(returnType); | 2245 .substituteType(returnType); |
| 2241 } | 2246 } |
| 2242 | 2247 |
| 2243 accept(ExpressionVisitor v) => v.visitSuperMethodInvocation(this); | 2248 accept(ExpressionVisitor v) => v.visitSuperMethodInvocation(this); |
| 2244 accept1(ExpressionVisitor1 v, arg) => v.visitSuperMethodInvocation(this, arg); | 2249 accept1(ExpressionVisitor1 v, arg) => v.visitSuperMethodInvocation(this, arg); |
| 2245 | 2250 |
| 2246 visitChildren(Visitor v) { | 2251 visitChildren(Visitor v) { |
| 2247 name?.accept(v); | 2252 name?.accept(v); |
| 2253 v.visitInterfaceTargetReference(interfaceTargetReference); | |
| 2248 arguments?.accept(v); | 2254 arguments?.accept(v); |
| 2249 } | 2255 } |
| 2250 | 2256 |
| 2251 transformChildren(Transformer v) { | 2257 transformChildren(Transformer v) { |
| 2252 if (arguments != null) { | 2258 if (arguments != null) { |
| 2253 arguments = arguments.accept(v); | 2259 arguments = arguments.accept(v); |
| 2254 arguments?.parent = this; | 2260 arguments?.parent = this; |
| 2255 } | 2261 } |
| 2256 } | 2262 } |
| 2257 } | 2263 } |
| (...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4604 /// typedef has not been assigned a canonical name yet. | 4610 /// typedef has not been assigned a canonical name yet. |
| 4605 /// | 4611 /// |
| 4606 /// Returns `null` if the typedef is `null`. | 4612 /// Returns `null` if the typedef is `null`. |
| 4607 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { | 4613 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { |
| 4608 if (typedef_ == null) return null; | 4614 if (typedef_ == null) return null; |
| 4609 if (typedef_.canonicalName == null) { | 4615 if (typedef_.canonicalName == null) { |
| 4610 throw '$typedef_ has no canonical name'; | 4616 throw '$typedef_ has no canonical name'; |
| 4611 } | 4617 } |
| 4612 return typedef_.canonicalName; | 4618 return typedef_.canonicalName; |
| 4613 } | 4619 } |
| OLD | NEW |