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

Side by Side Diff: pkg/analyzer-experimental/lib/src/generated/element.dart

Issue 12543003: Use limited JavaStringBuilder implementation instead of Dart StringBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.element; 4 library engine.element;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'java_core.dart'; 7 import 'java_core.dart';
8 import 'java_engine.dart'; 8 import 'java_engine.dart';
9 import 'source.dart'; 9 import 'source.dart';
10 import 'scanner.dart' show Keyword; 10 import 'scanner.dart' show Keyword;
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 setModifier(Modifier.MIXIN, isValidMixin); 1409 setModifier(Modifier.MIXIN, isValidMixin);
1410 } 1410 }
1411 void visitChildren(ElementVisitor<Object> visitor) { 1411 void visitChildren(ElementVisitor<Object> visitor) {
1412 super.visitChildren(visitor); 1412 super.visitChildren(visitor);
1413 safelyVisitChildren(_accessors, visitor); 1413 safelyVisitChildren(_accessors, visitor);
1414 safelyVisitChildren(_constructors, visitor); 1414 safelyVisitChildren(_constructors, visitor);
1415 safelyVisitChildren(_fields, visitor); 1415 safelyVisitChildren(_fields, visitor);
1416 safelyVisitChildren(_methods, visitor); 1416 safelyVisitChildren(_methods, visitor);
1417 safelyVisitChildren(_typeVariables, visitor); 1417 safelyVisitChildren(_typeVariables, visitor);
1418 } 1418 }
1419 void appendTo(StringBuffer builder) { 1419 void appendTo(JavaStringBuilder builder) {
1420 String name11 = name; 1420 String name11 = name;
1421 if (name11 == null) { 1421 if (name11 == null) {
1422 builder.write("{unnamed class}"); 1422 builder.append("{unnamed class}");
1423 } else { 1423 } else {
1424 builder.write(name11); 1424 builder.append(name11);
1425 } 1425 }
1426 int variableCount = _typeVariables.length; 1426 int variableCount = _typeVariables.length;
1427 if (variableCount > 0) { 1427 if (variableCount > 0) {
1428 builder.write("<"); 1428 builder.append("<");
1429 for (int i = 0; i < variableCount; i++) { 1429 for (int i = 0; i < variableCount; i++) {
1430 if (i > 0) { 1430 if (i > 0) {
1431 builder.write(", "); 1431 builder.append(", ");
1432 } 1432 }
1433 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); 1433 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
1434 } 1434 }
1435 builder.write(">"); 1435 builder.append(">");
1436 } 1436 }
1437 } 1437 }
1438 void collectAllSupertypes(Collection<InterfaceType> list) { 1438 void collectAllSupertypes(Collection<InterfaceType> list) {
1439 if (_supertype == null || list.contains(_supertype)) { 1439 if (_supertype == null || list.contains(_supertype)) {
1440 return; 1440 return;
1441 } 1441 }
1442 list.add(_supertype); 1442 list.add(_supertype);
1443 ((_supertype.element as ClassElementImpl)).collectAllSupertypes(list); 1443 ((_supertype.element as ClassElementImpl)).collectAllSupertypes(list);
1444 for (InterfaceType type in interfaces) { 1444 for (InterfaceType type in interfaces) {
1445 if (!list.contains(type)) { 1445 if (!list.contains(type)) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 this._types = types2; 1634 this._types = types2;
1635 } 1635 }
1636 void visitChildren(ElementVisitor<Object> visitor) { 1636 void visitChildren(ElementVisitor<Object> visitor) {
1637 super.visitChildren(visitor); 1637 super.visitChildren(visitor);
1638 safelyVisitChildren(_accessors, visitor); 1638 safelyVisitChildren(_accessors, visitor);
1639 safelyVisitChildren(_functions, visitor); 1639 safelyVisitChildren(_functions, visitor);
1640 safelyVisitChildren(_typeAliases, visitor); 1640 safelyVisitChildren(_typeAliases, visitor);
1641 safelyVisitChildren(_types, visitor); 1641 safelyVisitChildren(_types, visitor);
1642 safelyVisitChildren(_variables, visitor); 1642 safelyVisitChildren(_variables, visitor);
1643 } 1643 }
1644 void appendTo(StringBuffer builder) { 1644 void appendTo(JavaStringBuilder builder) {
1645 if (_source == null) { 1645 if (_source == null) {
1646 builder.write("{compilation unit}"); 1646 builder.append("{compilation unit}");
1647 } else { 1647 } else {
1648 builder.write(_source.fullName); 1648 builder.append(_source.fullName);
1649 } 1649 }
1650 } 1650 }
1651 } 1651 }
1652 /** 1652 /**
1653 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons tructorElement}. 1653 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons tructorElement}.
1654 */ 1654 */
1655 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement { 1655 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement {
1656 /** 1656 /**
1657 * An empty array of constructor elements. 1657 * An empty array of constructor elements.
1658 */ 1658 */
(...skipping 10 matching lines...) Expand all
1669 bool isConst() => hasModifier(Modifier.CONST); 1669 bool isConst() => hasModifier(Modifier.CONST);
1670 bool isFactory() => hasModifier(Modifier.FACTORY); 1670 bool isFactory() => hasModifier(Modifier.FACTORY);
1671 bool isStatic() => false; 1671 bool isStatic() => false;
1672 /** 1672 /**
1673 * Set whether this constructor represents a factory method to the given value . 1673 * Set whether this constructor represents a factory method to the given value .
1674 * @param isFactory {@code true} if this constructor represents a factory meth od 1674 * @param isFactory {@code true} if this constructor represents a factory meth od
1675 */ 1675 */
1676 void set factory(bool isFactory) { 1676 void set factory(bool isFactory) {
1677 setModifier(Modifier.FACTORY, isFactory); 1677 setModifier(Modifier.FACTORY, isFactory);
1678 } 1678 }
1679 void appendTo(StringBuffer builder) { 1679 void appendTo(JavaStringBuilder builder) {
1680 builder.write(enclosingElement.name); 1680 builder.append(enclosingElement.name);
1681 String name12 = name; 1681 String name12 = name;
1682 if (name12 != null && !name12.isEmpty) { 1682 if (name12 != null && !name12.isEmpty) {
1683 builder.write("."); 1683 builder.append(".");
1684 builder.write(name12); 1684 builder.append(name12);
1685 } 1685 }
1686 super.appendTo(builder); 1686 super.appendTo(builder);
1687 } 1687 }
1688 } 1688 }
1689 /** 1689 /**
1690 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele ment representing 1690 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele ment representing
1691 * the declaration of the type {@code dynamic}. 1691 * the declaration of the type {@code dynamic}.
1692 */ 1692 */
1693 class DynamicElementImpl extends ElementImpl { 1693 class DynamicElementImpl extends ElementImpl {
1694 /** 1694 /**
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 this._metadata = metadata2; 1822 this._metadata = metadata2;
1823 } 1823 }
1824 /** 1824 /**
1825 * Set whether this element is synthetic to correspond to the given value. 1825 * Set whether this element is synthetic to correspond to the given value.
1826 * @param isSynthetic {@code true} if the element is synthetic 1826 * @param isSynthetic {@code true} if the element is synthetic
1827 */ 1827 */
1828 void set synthetic(bool isSynthetic) { 1828 void set synthetic(bool isSynthetic) {
1829 setModifier(Modifier.SYNTHETIC, isSynthetic); 1829 setModifier(Modifier.SYNTHETIC, isSynthetic);
1830 } 1830 }
1831 String toString() { 1831 String toString() {
1832 StringBuffer builder = new StringBuffer(); 1832 JavaStringBuilder builder = new JavaStringBuilder();
1833 appendTo(builder); 1833 appendTo(builder);
1834 return builder.toString(); 1834 return builder.toString();
1835 } 1835 }
1836 void visitChildren(ElementVisitor<Object> visitor) { 1836 void visitChildren(ElementVisitor<Object> visitor) {
1837 } 1837 }
1838 /** 1838 /**
1839 * Append a textual representation of this type to the given builder. 1839 * Append a textual representation of this type to the given builder.
1840 * @param builder the builder to which the text is to be appended 1840 * @param builder the builder to which the text is to be appended
1841 */ 1841 */
1842 void appendTo(StringBuffer builder) { 1842 void appendTo(JavaStringBuilder builder) {
1843 if (_name == null) { 1843 if (_name == null) {
1844 builder.write("<unnamed "); 1844 builder.append("<unnamed ");
1845 builder.write(runtimeType.toString()); 1845 builder.append(runtimeType.toString());
1846 builder.write(">"); 1846 builder.append(">");
1847 } else { 1847 } else {
1848 builder.write(_name); 1848 builder.append(_name);
1849 } 1849 }
1850 } 1850 }
1851 /** 1851 /**
1852 * Return an identifier that uniquely identifies this element among the childr en of this element's 1852 * Return an identifier that uniquely identifies this element among the childr en of this element's
1853 * parent. 1853 * parent.
1854 * @return an identifier that uniquely identifies this element relative to its parent 1854 * @return an identifier that uniquely identifies this element relative to its parent
1855 */ 1855 */
1856 String get identifier => name; 1856 String get identifier => name;
1857 /** 1857 /**
1858 * Return {@code true} if this element has the given modifier associated with it. 1858 * Return {@code true} if this element has the given modifier associated with it.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 } 1947 }
1948 ElementLocationImpl location = object as ElementLocationImpl; 1948 ElementLocationImpl location = object as ElementLocationImpl;
1949 return JavaArrays.equals(_components, location._components); 1949 return JavaArrays.equals(_components, location._components);
1950 } 1950 }
1951 /** 1951 /**
1952 * Return the path to the element whose location is represented by this object . 1952 * Return the path to the element whose location is represented by this object .
1953 * @return the path to the element whose location is represented by this objec t 1953 * @return the path to the element whose location is represented by this objec t
1954 */ 1954 */
1955 List<String> get components => _components; 1955 List<String> get components => _components;
1956 String get encoding { 1956 String get encoding {
1957 StringBuffer builder = new StringBuffer(); 1957 JavaStringBuilder builder = new JavaStringBuilder();
1958 int length2 = _components.length; 1958 int length2 = _components.length;
1959 for (int i = 0; i < length2; i++) { 1959 for (int i = 0; i < length2; i++) {
1960 if (i > 0) { 1960 if (i > 0) {
1961 builder.writeCharCode(_SEPARATOR_CHAR); 1961 builder.appendChar(_SEPARATOR_CHAR);
1962 } 1962 }
1963 encode(builder, _components[i]); 1963 encode(builder, _components[i]);
1964 } 1964 }
1965 return builder.toString(); 1965 return builder.toString();
1966 } 1966 }
1967 int get hashCode => JavaArrays.makeHashCode(_components); 1967 int get hashCode => JavaArrays.makeHashCode(_components);
1968 String toString() => encoding; 1968 String toString() => encoding;
1969 /** 1969 /**
1970 * Decode the encoded form of a location into an array of components. 1970 * Decode the encoded form of a location into an array of components.
1971 * @param encoding the encoded form of a location 1971 * @param encoding the encoded form of a location
1972 * @return the components that were encoded 1972 * @return the components that were encoded
1973 */ 1973 */
1974 List<String> decode(String encoding) { 1974 List<String> decode(String encoding) {
1975 List<String> components = new List<String>(); 1975 List<String> components = new List<String>();
1976 StringBuffer builder = new StringBuffer(); 1976 JavaStringBuilder builder = new JavaStringBuilder();
1977 int index = 0; 1977 int index = 0;
1978 int length3 = encoding.length; 1978 int length3 = encoding.length;
1979 while (index < length3) { 1979 while (index < length3) {
1980 int currentChar = encoding.codeUnitAt(index); 1980 int currentChar = encoding.codeUnitAt(index);
1981 if (currentChar == _SEPARATOR_CHAR) { 1981 if (currentChar == _SEPARATOR_CHAR) {
1982 if (index + 1 < length3 && encoding.codeUnitAt(index + 1) == _SEPARATOR_ CHAR) { 1982 if (index + 1 < length3 && encoding.codeUnitAt(index + 1) == _SEPARATOR_ CHAR) {
1983 builder.writeCharCode(_SEPARATOR_CHAR); 1983 builder.appendChar(_SEPARATOR_CHAR);
1984 index += 2; 1984 index += 2;
1985 } else { 1985 } else {
1986 components.add(builder.toString()); 1986 components.add(builder.toString());
1987 builder.clear(); 1987 builder.length = 0;
1988 index++; 1988 index++;
1989 } 1989 }
1990 } else { 1990 } else {
1991 builder.writeCharCode(currentChar); 1991 builder.appendChar(currentChar);
1992 index++; 1992 index++;
1993 } 1993 }
1994 } 1994 }
1995 if (builder.length > 0) { 1995 if (builder.length > 0) {
1996 components.add(builder.toString()); 1996 components.add(builder.toString());
1997 } 1997 }
1998 return new List.from(components); 1998 return new List.from(components);
1999 } 1999 }
2000 /** 2000 /**
2001 * Append an encoded form of the given component to the given builder. 2001 * Append an encoded form of the given component to the given builder.
2002 * @param builder the builder to which the encoded component is to be appended 2002 * @param builder the builder to which the encoded component is to be appended
2003 * @param component the component to be appended to the builder 2003 * @param component the component to be appended to the builder
2004 */ 2004 */
2005 void encode(StringBuffer builder, String component) { 2005 void encode(JavaStringBuilder builder, String component) {
2006 int length4 = component.length; 2006 int length4 = component.length;
2007 for (int i = 0; i < length4; i++) { 2007 for (int i = 0; i < length4; i++) {
2008 int currentChar = component.codeUnitAt(i); 2008 int currentChar = component.codeUnitAt(i);
2009 if (currentChar == _SEPARATOR_CHAR) { 2009 if (currentChar == _SEPARATOR_CHAR) {
2010 builder.writeCharCode(_SEPARATOR_CHAR); 2010 builder.appendChar(_SEPARATOR_CHAR);
2011 } 2011 }
2012 builder.writeCharCode(currentChar); 2012 builder.appendChar(currentChar);
2013 } 2013 }
2014 } 2014 }
2015 } 2015 }
2016 /** 2016 /**
2017 * The abstract class {@code ExecutableElementImpl} implements the behavior comm on to{@code ExecutableElement}s. 2017 * The abstract class {@code ExecutableElementImpl} implements the behavior comm on to{@code ExecutableElement}s.
2018 */ 2018 */
2019 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement { 2019 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement {
2020 /** 2020 /**
2021 * An array containing all of the functions defined within this executable ele ment. 2021 * An array containing all of the functions defined within this executable ele ment.
2022 */ 2022 */
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 void set type(FunctionType type7) { 2136 void set type(FunctionType type7) {
2137 this._type = type7; 2137 this._type = type7;
2138 } 2138 }
2139 void visitChildren(ElementVisitor<Object> visitor) { 2139 void visitChildren(ElementVisitor<Object> visitor) {
2140 super.visitChildren(visitor); 2140 super.visitChildren(visitor);
2141 safelyVisitChildren(_functions, visitor); 2141 safelyVisitChildren(_functions, visitor);
2142 safelyVisitChildren(_labels, visitor); 2142 safelyVisitChildren(_labels, visitor);
2143 safelyVisitChildren(_localVariables, visitor); 2143 safelyVisitChildren(_localVariables, visitor);
2144 safelyVisitChildren(_parameters, visitor); 2144 safelyVisitChildren(_parameters, visitor);
2145 } 2145 }
2146 void appendTo(StringBuffer builder) { 2146 void appendTo(JavaStringBuilder builder) {
2147 builder.write("("); 2147 builder.append("(");
2148 int parameterCount = _parameters.length; 2148 int parameterCount = _parameters.length;
2149 for (int i = 0; i < parameterCount; i++) { 2149 for (int i = 0; i < parameterCount; i++) {
2150 if (i > 0) { 2150 if (i > 0) {
2151 builder.write(", "); 2151 builder.append(", ");
2152 } 2152 }
2153 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); 2153 ((_parameters[i] as ParameterElementImpl)).appendTo(builder);
2154 } 2154 }
2155 builder.write(")"); 2155 builder.append(")");
2156 if (_type != null) { 2156 if (_type != null) {
2157 builder.write(" -> "); 2157 builder.append(" -> ");
2158 builder.write(_type.returnType); 2158 builder.append(_type.returnType);
2159 } 2159 }
2160 } 2160 }
2161 } 2161 }
2162 /** 2162 /**
2163 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl ement}. 2163 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl ement}.
2164 */ 2164 */
2165 class ExportElementImpl extends ElementImpl implements ExportElement { 2165 class ExportElementImpl extends ElementImpl implements ExportElement {
2166 /** 2166 /**
2167 * The library that is exported from this library by this export directive. 2167 * The library that is exported from this library by this export directive.
2168 */ 2168 */
(...skipping 21 matching lines...) Expand all
2190 this._combinators = combinators2; 2190 this._combinators = combinators2;
2191 } 2191 }
2192 /** 2192 /**
2193 * Set the library that is exported from this library by this import directive to the given 2193 * Set the library that is exported from this library by this import directive to the given
2194 * library. 2194 * library.
2195 * @param exportedLibrary the library that is exported from this library 2195 * @param exportedLibrary the library that is exported from this library
2196 */ 2196 */
2197 void set exportedLibrary(LibraryElement exportedLibrary2) { 2197 void set exportedLibrary(LibraryElement exportedLibrary2) {
2198 this._exportedLibrary = exportedLibrary2; 2198 this._exportedLibrary = exportedLibrary2;
2199 } 2199 }
2200 void appendTo(StringBuffer builder) { 2200 void appendTo(JavaStringBuilder builder) {
2201 builder.write("export "); 2201 builder.append("export ");
2202 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder); 2202 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder);
2203 } 2203 }
2204 } 2204 }
2205 /** 2205 /**
2206 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme nt}. 2206 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme nt}.
2207 */ 2207 */
2208 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme nt { 2208 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme nt {
2209 /** 2209 /**
2210 * An empty array of field elements. 2210 * An empty array of field elements.
2211 */ 2211 */
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 * Set the visible range for this element to the range starting at the given o ffset with the given 2289 * Set the visible range for this element to the range starting at the given o ffset with the given
2290 * length. 2290 * length.
2291 * @param offset the offset to the beginning of the visible range for this ele ment 2291 * @param offset the offset to the beginning of the visible range for this ele ment
2292 * @param length the length of the visible range for this element, or {@code - 1} if this element 2292 * @param length the length of the visible range for this element, or {@code - 1} if this element
2293 * does not have a visible range 2293 * does not have a visible range
2294 */ 2294 */
2295 void setVisibleRange(int offset, int length) { 2295 void setVisibleRange(int offset, int length) {
2296 _visibleRangeOffset = offset; 2296 _visibleRangeOffset = offset;
2297 _visibleRangeLength = length; 2297 _visibleRangeLength = length;
2298 } 2298 }
2299 void appendTo(StringBuffer builder) { 2299 void appendTo(JavaStringBuilder builder) {
2300 String name13 = name; 2300 String name13 = name;
2301 if (name13 != null) { 2301 if (name13 != null) {
2302 builder.write(name13); 2302 builder.append(name13);
2303 } 2303 }
2304 super.appendTo(builder); 2304 super.appendTo(builder);
2305 } 2305 }
2306 } 2306 }
2307 /** 2307 /**
2308 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}. 2308 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}.
2309 */ 2309 */
2310 class HideCombinatorImpl implements HideCombinator { 2310 class HideCombinatorImpl implements HideCombinator {
2311 /** 2311 /**
2312 * The names that are not to be made visible in the importing library even if they are defined in 2312 * The names that are not to be made visible in the importing library even if they are defined in
2313 * the imported library. 2313 * the imported library.
2314 */ 2314 */
2315 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; 2315 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY;
2316 /** 2316 /**
2317 * Initialize a newly created combinator. 2317 * Initialize a newly created combinator.
2318 */ 2318 */
2319 HideCombinatorImpl() : super() { 2319 HideCombinatorImpl() : super() {
2320 } 2320 }
2321 List<String> get hiddenNames => _hiddenNames; 2321 List<String> get hiddenNames => _hiddenNames;
2322 /** 2322 /**
2323 * Set the names that are not to be made visible in the importing library even if they are defined 2323 * Set the names that are not to be made visible in the importing library even if they are defined
2324 * in the imported library to the given names. 2324 * in the imported library to the given names.
2325 * @param hiddenNames the names that are not to be made visible in the importi ng library 2325 * @param hiddenNames the names that are not to be made visible in the importi ng library
2326 */ 2326 */
2327 void set hiddenNames(List<String> hiddenNames2) { 2327 void set hiddenNames(List<String> hiddenNames2) {
2328 this._hiddenNames = hiddenNames2; 2328 this._hiddenNames = hiddenNames2;
2329 } 2329 }
2330 String toString() { 2330 String toString() {
2331 StringBuffer builder = new StringBuffer(); 2331 JavaStringBuilder builder = new JavaStringBuilder();
2332 builder.write("show "); 2332 builder.append("show ");
2333 int count = _hiddenNames.length; 2333 int count = _hiddenNames.length;
2334 for (int i = 0; i < count; i++) { 2334 for (int i = 0; i < count; i++) {
2335 if (i > 0) { 2335 if (i > 0) {
2336 builder.write(", "); 2336 builder.append(", ");
2337 } 2337 }
2338 builder.write(_hiddenNames[i]); 2338 builder.append(_hiddenNames[i]);
2339 } 2339 }
2340 return builder.toString(); 2340 return builder.toString();
2341 } 2341 }
2342 } 2342 }
2343 /** 2343 /**
2344 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen t}. 2344 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen t}.
2345 */ 2345 */
2346 class HtmlElementImpl extends ElementImpl implements HtmlElement { 2346 class HtmlElementImpl extends ElementImpl implements HtmlElement {
2347 /** 2347 /**
2348 * An empty array of HTML file elements. 2348 * An empty array of HTML file elements.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 * Set the source that corresponds to this HTML file to the given source. 2387 * Set the source that corresponds to this HTML file to the given source.
2388 * @param source the source that corresponds to this HTML file 2388 * @param source the source that corresponds to this HTML file
2389 */ 2389 */
2390 void set source(Source source6) { 2390 void set source(Source source6) {
2391 this._source = source6; 2391 this._source = source6;
2392 } 2392 }
2393 void visitChildren(ElementVisitor<Object> visitor) { 2393 void visitChildren(ElementVisitor<Object> visitor) {
2394 super.visitChildren(visitor); 2394 super.visitChildren(visitor);
2395 safelyVisitChildren(_libraries, visitor); 2395 safelyVisitChildren(_libraries, visitor);
2396 } 2396 }
2397 void appendTo(StringBuffer builder) { 2397 void appendTo(JavaStringBuilder builder) {
2398 if (_source == null) { 2398 if (_source == null) {
2399 builder.write("{HTML file}"); 2399 builder.append("{HTML file}");
2400 } else { 2400 } else {
2401 builder.write(_source.fullName); 2401 builder.append(_source.fullName);
2402 } 2402 }
2403 } 2403 }
2404 } 2404 }
2405 /** 2405 /**
2406 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl ement}. 2406 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl ement}.
2407 */ 2407 */
2408 class ImportElementImpl extends ElementImpl implements ImportElement { 2408 class ImportElementImpl extends ElementImpl implements ImportElement {
2409 /** 2409 /**
2410 * The library that is imported into this library by this import directive. 2410 * The library that is imported into this library by this import directive.
2411 */ 2411 */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 * Set the prefix that was specified as part of the import directive to the gi ven prefix. 2450 * Set the prefix that was specified as part of the import directive to the gi ven prefix.
2451 * @param prefix the prefix that was specified as part of the import directive 2451 * @param prefix the prefix that was specified as part of the import directive
2452 */ 2452 */
2453 void set prefix(PrefixElement prefix3) { 2453 void set prefix(PrefixElement prefix3) {
2454 this._prefix = prefix3; 2454 this._prefix = prefix3;
2455 } 2455 }
2456 void visitChildren(ElementVisitor<Object> visitor) { 2456 void visitChildren(ElementVisitor<Object> visitor) {
2457 super.visitChildren(visitor); 2457 super.visitChildren(visitor);
2458 safelyVisitChild(_prefix, visitor); 2458 safelyVisitChild(_prefix, visitor);
2459 } 2459 }
2460 void appendTo(StringBuffer builder) { 2460 void appendTo(JavaStringBuilder builder) {
2461 builder.write("import "); 2461 builder.append("import ");
2462 ((_importedLibrary as LibraryElementImpl)).appendTo(builder); 2462 ((_importedLibrary as LibraryElementImpl)).appendTo(builder);
2463 } 2463 }
2464 } 2464 }
2465 /** 2465 /**
2466 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme nt}. 2466 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme nt}.
2467 */ 2467 */
2468 class LabelElementImpl extends ElementImpl implements LabelElement { 2468 class LabelElementImpl extends ElementImpl implements LabelElement {
2469 /** 2469 /**
2470 * A flag indicating whether this label is associated with a {@code switch} st atement. 2470 * A flag indicating whether this label is associated with a {@code switch} st atement.
2471 */ 2471 */
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 * Set the visible range for this element to the range starting at the given o ffset with the given 2711 * Set the visible range for this element to the range starting at the given o ffset with the given
2712 * length. 2712 * length.
2713 * @param offset the offset to the beginning of the visible range for this ele ment 2713 * @param offset the offset to the beginning of the visible range for this ele ment
2714 * @param length the length of the visible range for this element, or {@code - 1} if this element 2714 * @param length the length of the visible range for this element, or {@code - 1} if this element
2715 * does not have a visible range 2715 * does not have a visible range
2716 */ 2716 */
2717 void setVisibleRange(int offset, int length) { 2717 void setVisibleRange(int offset, int length) {
2718 _visibleRangeOffset = offset; 2718 _visibleRangeOffset = offset;
2719 _visibleRangeLength = length; 2719 _visibleRangeLength = length;
2720 } 2720 }
2721 void appendTo(StringBuffer builder) { 2721 void appendTo(JavaStringBuilder builder) {
2722 builder.write(type); 2722 builder.append(type);
2723 builder.write(" "); 2723 builder.append(" ");
2724 builder.write(name); 2724 builder.append(name);
2725 } 2725 }
2726 } 2726 }
2727 /** 2727 /**
2728 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle ment}. 2728 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle ment}.
2729 */ 2729 */
2730 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { 2730 class MethodElementImpl extends ExecutableElementImpl implements MethodElement {
2731 /** 2731 /**
2732 * An empty array of method elements. 2732 * An empty array of method elements.
2733 */ 2733 */
2734 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); 2734 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0);
(...skipping 29 matching lines...) Expand all
2764 void set abstract(bool isAbstract) { 2764 void set abstract(bool isAbstract) {
2765 setModifier(Modifier.ABSTRACT, isAbstract); 2765 setModifier(Modifier.ABSTRACT, isAbstract);
2766 } 2766 }
2767 /** 2767 /**
2768 * Set whether this method is static to correspond to the given value. 2768 * Set whether this method is static to correspond to the given value.
2769 * @param isStatic {@code true} if the method is static 2769 * @param isStatic {@code true} if the method is static
2770 */ 2770 */
2771 void set static(bool isStatic) { 2771 void set static(bool isStatic) {
2772 setModifier(Modifier.STATIC, isStatic); 2772 setModifier(Modifier.STATIC, isStatic);
2773 } 2773 }
2774 void appendTo(StringBuffer builder) { 2774 void appendTo(JavaStringBuilder builder) {
2775 builder.write(enclosingElement.name); 2775 builder.append(enclosingElement.name);
2776 builder.write("."); 2776 builder.append(".");
2777 builder.write(name); 2777 builder.append(name);
2778 super.appendTo(builder); 2778 super.appendTo(builder);
2779 } 2779 }
2780 } 2780 }
2781 /** 2781 /**
2782 * The enumeration {@code Modifier} defines constants for all of the modifiers d efined by the Dart 2782 * The enumeration {@code Modifier} defines constants for all of the modifiers d efined by the Dart
2783 * language and for a few additional flags that are useful. 2783 * language and for a few additional flags that are useful.
2784 */ 2784 */
2785 class Modifier { 2785 class Modifier {
2786 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); 2786 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0);
2787 static final Modifier CONST = new Modifier('CONST', 1); 2787 static final Modifier CONST = new Modifier('CONST', 1);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 bool isAccessibleIn(LibraryElement library) { 2843 bool isAccessibleIn(LibraryElement library) {
2844 for (Element element in _conflictingElements) { 2844 for (Element element in _conflictingElements) {
2845 if (element.isAccessibleIn(library)) { 2845 if (element.isAccessibleIn(library)) {
2846 return true; 2846 return true;
2847 } 2847 }
2848 } 2848 }
2849 return false; 2849 return false;
2850 } 2850 }
2851 bool isSynthetic() => true; 2851 bool isSynthetic() => true;
2852 String toString() { 2852 String toString() {
2853 StringBuffer builder = new StringBuffer(); 2853 JavaStringBuilder builder = new JavaStringBuilder();
2854 builder.write("["); 2854 builder.append("[");
2855 int count = _conflictingElements.length; 2855 int count = _conflictingElements.length;
2856 for (int i = 0; i < count; i++) { 2856 for (int i = 0; i < count; i++) {
2857 if (i > 0) { 2857 if (i > 0) {
2858 builder.write(", "); 2858 builder.append(", ");
2859 } 2859 }
2860 ((_conflictingElements[i] as ElementImpl)).appendTo(builder); 2860 ((_conflictingElements[i] as ElementImpl)).appendTo(builder);
2861 } 2861 }
2862 builder.write("]"); 2862 builder.append("]");
2863 return builder.toString(); 2863 return builder.toString();
2864 } 2864 }
2865 void visitChildren(ElementVisitor<Object> visitor) { 2865 void visitChildren(ElementVisitor<Object> visitor) {
2866 } 2866 }
2867 /** 2867 /**
2868 * Add the given element to the list of elements. If the element is a multiply -defined element, 2868 * Add the given element to the list of elements. If the element is a multiply -defined element,
2869 * add all of the conflicting elements that it represents. 2869 * add all of the conflicting elements that it represents.
2870 * @param elements the list to which the element(s) are to be added 2870 * @param elements the list to which the element(s) are to be added
2871 * @param element the element(s) to be added 2871 * @param element the element(s) to be added
2872 */ 2872 */
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 * Set the visible range for this element to the range starting at the given o ffset with the given 2949 * Set the visible range for this element to the range starting at the given o ffset with the given
2950 * length. 2950 * length.
2951 * @param offset the offset to the beginning of the visible range for this ele ment 2951 * @param offset the offset to the beginning of the visible range for this ele ment
2952 * @param length the length of the visible range for this element, or {@code - 1} if this element 2952 * @param length the length of the visible range for this element, or {@code - 1} if this element
2953 * does not have a visible range 2953 * does not have a visible range
2954 */ 2954 */
2955 void setVisibleRange(int offset, int length) { 2955 void setVisibleRange(int offset, int length) {
2956 _visibleRangeOffset = offset; 2956 _visibleRangeOffset = offset;
2957 _visibleRangeLength = length; 2957 _visibleRangeLength = length;
2958 } 2958 }
2959 void appendTo(StringBuffer builder) { 2959 void appendTo(JavaStringBuilder builder) {
2960 builder.write(type); 2960 builder.append(type);
2961 builder.write(" "); 2961 builder.append(" ");
2962 builder.write(name); 2962 builder.append(name);
2963 builder.write(" ("); 2963 builder.append(" (");
2964 builder.write(kind); 2964 builder.append(kind);
2965 builder.write(")"); 2965 builder.append(")");
2966 } 2966 }
2967 } 2967 }
2968 /** 2968 /**
2969 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle ment}. 2969 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle ment}.
2970 */ 2970 */
2971 class PrefixElementImpl extends ElementImpl implements PrefixElement { 2971 class PrefixElementImpl extends ElementImpl implements PrefixElement {
2972 /** 2972 /**
2973 * An array containing all of the libraries that are imported using this prefi x. 2973 * An array containing all of the libraries that are imported using this prefi x.
2974 */ 2974 */
2975 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; 2975 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY;
(...skipping 14 matching lines...) Expand all
2990 /** 2990 /**
2991 * Set the libraries that are imported using this prefix to the given librarie s. 2991 * Set the libraries that are imported using this prefix to the given librarie s.
2992 * @param importedLibraries the libraries that are imported using this prefix 2992 * @param importedLibraries the libraries that are imported using this prefix
2993 */ 2993 */
2994 void set importedLibraries(List<LibraryElement> importedLibraries2) { 2994 void set importedLibraries(List<LibraryElement> importedLibraries2) {
2995 for (LibraryElement library in importedLibraries2) { 2995 for (LibraryElement library in importedLibraries2) {
2996 ((library as LibraryElementImpl)).enclosingElement = this; 2996 ((library as LibraryElementImpl)).enclosingElement = this;
2997 } 2997 }
2998 this._importedLibraries = importedLibraries2; 2998 this._importedLibraries = importedLibraries2;
2999 } 2999 }
3000 void appendTo(StringBuffer builder) { 3000 void appendTo(JavaStringBuilder builder) {
3001 builder.write("as "); 3001 builder.append("as ");
3002 super.appendTo(builder); 3002 super.appendTo(builder);
3003 } 3003 }
3004 } 3004 }
3005 /** 3005 /**
3006 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code PropertyAccessorElement}. 3006 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code PropertyAccessorElement}.
3007 */ 3007 */
3008 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement { 3008 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement {
3009 /** 3009 /**
3010 * The variable associated with this accessor. 3010 * The variable associated with this accessor.
3011 */ 3011 */
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 void set setter(bool isSetter) { 3061 void set setter(bool isSetter) {
3062 setModifier(Modifier.SETTER, isSetter); 3062 setModifier(Modifier.SETTER, isSetter);
3063 } 3063 }
3064 /** 3064 /**
3065 * Set the variable associated with this accessor to the given variable. 3065 * Set the variable associated with this accessor to the given variable.
3066 * @param variable the variable associated with this accessor 3066 * @param variable the variable associated with this accessor
3067 */ 3067 */
3068 void set variable(PropertyInducingElement variable3) { 3068 void set variable(PropertyInducingElement variable3) {
3069 this._variable = variable3; 3069 this._variable = variable3;
3070 } 3070 }
3071 void appendTo(StringBuffer builder) { 3071 void appendTo(JavaStringBuilder builder) {
3072 builder.write(isGetter() ? "get " : "set "); 3072 builder.append(isGetter() ? "get " : "set ");
3073 builder.write(variable.name); 3073 builder.append(variable.name);
3074 super.appendTo(builder); 3074 super.appendTo(builder);
3075 } 3075 }
3076 } 3076 }
3077 /** 3077 /**
3078 * Instances of the class {@code PropertyInducingElementImpl} implement a{@code PropertyInducingElement}. 3078 * Instances of the class {@code PropertyInducingElementImpl} implement a{@code PropertyInducingElement}.
3079 */ 3079 */
3080 abstract class PropertyInducingElementImpl extends VariableElementImpl implement s PropertyInducingElement { 3080 abstract class PropertyInducingElementImpl extends VariableElementImpl implement s PropertyInducingElement {
3081 /** 3081 /**
3082 * The getter associated with this element. 3082 * The getter associated with this element.
3083 */ 3083 */
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3143 List<String> get shownNames => _shownNames; 3143 List<String> get shownNames => _shownNames;
3144 /** 3144 /**
3145 * Set the names that are to be made visible in the importing library if they are defined in the 3145 * Set the names that are to be made visible in the importing library if they are defined in the
3146 * imported library to the given names. 3146 * imported library to the given names.
3147 * @param shownNames the names that are to be made visible in the importing li brary 3147 * @param shownNames the names that are to be made visible in the importing li brary
3148 */ 3148 */
3149 void set shownNames(List<String> shownNames2) { 3149 void set shownNames(List<String> shownNames2) {
3150 this._shownNames = shownNames2; 3150 this._shownNames = shownNames2;
3151 } 3151 }
3152 String toString() { 3152 String toString() {
3153 StringBuffer builder = new StringBuffer(); 3153 JavaStringBuilder builder = new JavaStringBuilder();
3154 builder.write("show "); 3154 builder.append("show ");
3155 int count = _shownNames.length; 3155 int count = _shownNames.length;
3156 for (int i = 0; i < count; i++) { 3156 for (int i = 0; i < count; i++) {
3157 if (i > 0) { 3157 if (i > 0) {
3158 builder.write(", "); 3158 builder.append(", ");
3159 } 3159 }
3160 builder.write(_shownNames[i]); 3160 builder.append(_shownNames[i]);
3161 } 3161 }
3162 return builder.toString(); 3162 return builder.toString();
3163 } 3163 }
3164 } 3164 }
3165 /** 3165 /**
3166 * Instances of the class {@code TopLevelVariableElementImpl} implement a{@code TopLevelVariableElement}. 3166 * Instances of the class {@code TopLevelVariableElementImpl} implement a{@code TopLevelVariableElement}.
3167 */ 3167 */
3168 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement { 3168 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement {
3169 /** 3169 /**
3170 * An empty array of top-level variable elements. 3170 * An empty array of top-level variable elements.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3264 for (TypeVariableElement variable in typeVariables3) { 3264 for (TypeVariableElement variable in typeVariables3) {
3265 ((variable as TypeVariableElementImpl)).enclosingElement = this; 3265 ((variable as TypeVariableElementImpl)).enclosingElement = this;
3266 } 3266 }
3267 this._typeVariables = typeVariables3; 3267 this._typeVariables = typeVariables3;
3268 } 3268 }
3269 void visitChildren(ElementVisitor<Object> visitor) { 3269 void visitChildren(ElementVisitor<Object> visitor) {
3270 super.visitChildren(visitor); 3270 super.visitChildren(visitor);
3271 safelyVisitChildren(_parameters, visitor); 3271 safelyVisitChildren(_parameters, visitor);
3272 safelyVisitChildren(_typeVariables, visitor); 3272 safelyVisitChildren(_typeVariables, visitor);
3273 } 3273 }
3274 void appendTo(StringBuffer builder) { 3274 void appendTo(JavaStringBuilder builder) {
3275 builder.write("typedef "); 3275 builder.append("typedef ");
3276 builder.write(name); 3276 builder.append(name);
3277 int variableCount = _typeVariables.length; 3277 int variableCount = _typeVariables.length;
3278 if (variableCount > 0) { 3278 if (variableCount > 0) {
3279 builder.write("<"); 3279 builder.append("<");
3280 for (int i = 0; i < variableCount; i++) { 3280 for (int i = 0; i < variableCount; i++) {
3281 if (i > 0) { 3281 if (i > 0) {
3282 builder.write(", "); 3282 builder.append(", ");
3283 } 3283 }
3284 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); 3284 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
3285 } 3285 }
3286 builder.write(">"); 3286 builder.append(">");
3287 } 3287 }
3288 builder.write("("); 3288 builder.append("(");
3289 int parameterCount = _parameters.length; 3289 int parameterCount = _parameters.length;
3290 for (int i = 0; i < parameterCount; i++) { 3290 for (int i = 0; i < parameterCount; i++) {
3291 if (i > 0) { 3291 if (i > 0) {
3292 builder.write(", "); 3292 builder.append(", ");
3293 } 3293 }
3294 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); 3294 ((_parameters[i] as ParameterElementImpl)).appendTo(builder);
3295 } 3295 }
3296 builder.write(")"); 3296 builder.append(")");
3297 if (_type != null) { 3297 if (_type != null) {
3298 builder.write(" -> "); 3298 builder.append(" -> ");
3299 builder.write(_type.returnType); 3299 builder.append(_type.returnType);
3300 } 3300 }
3301 } 3301 }
3302 } 3302 }
3303 /** 3303 /**
3304 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ eVariableElement}. 3304 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ eVariableElement}.
3305 */ 3305 */
3306 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement { 3306 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement {
3307 /** 3307 /**
3308 * The type defined by this type variable. 3308 * The type defined by this type variable.
3309 */ 3309 */
(...skipping 24 matching lines...) Expand all
3334 void set bound(Type2 bound2) { 3334 void set bound(Type2 bound2) {
3335 this._bound = bound2; 3335 this._bound = bound2;
3336 } 3336 }
3337 /** 3337 /**
3338 * Set the type defined by this type variable to the given type 3338 * Set the type defined by this type variable to the given type
3339 * @param type the type defined by this type variable 3339 * @param type the type defined by this type variable
3340 */ 3340 */
3341 void set type(TypeVariableType type9) { 3341 void set type(TypeVariableType type9) {
3342 this._type = type9; 3342 this._type = type9;
3343 } 3343 }
3344 void appendTo(StringBuffer builder) { 3344 void appendTo(JavaStringBuilder builder) {
3345 builder.write(name); 3345 builder.append(name);
3346 if (_bound != null) { 3346 if (_bound != null) {
3347 builder.write(" extends "); 3347 builder.append(" extends ");
3348 builder.write(_bound); 3348 builder.append(_bound);
3349 } 3349 }
3350 } 3350 }
3351 } 3351 }
3352 /** 3352 /**
3353 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl eElement}. 3353 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl eElement}.
3354 */ 3354 */
3355 abstract class VariableElementImpl extends ElementImpl implements VariableElemen t { 3355 abstract class VariableElementImpl extends ElementImpl implements VariableElemen t {
3356 /** 3356 /**
3357 * The declared type of this variable. 3357 * The declared type of this variable.
3358 */ 3358 */
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 * Set the declared type of this variable to the given type. 3418 * Set the declared type of this variable to the given type.
3419 * @param type the declared type of this variable 3419 * @param type the declared type of this variable
3420 */ 3420 */
3421 void set type(Type2 type10) { 3421 void set type(Type2 type10) {
3422 this._type = type10; 3422 this._type = type10;
3423 } 3423 }
3424 void visitChildren(ElementVisitor<Object> visitor) { 3424 void visitChildren(ElementVisitor<Object> visitor) {
3425 super.visitChildren(visitor); 3425 super.visitChildren(visitor);
3426 safelyVisitChild(_initializer, visitor); 3426 safelyVisitChild(_initializer, visitor);
3427 } 3427 }
3428 void appendTo(StringBuffer builder) { 3428 void appendTo(JavaStringBuilder builder) {
3429 builder.write(type); 3429 builder.append(type);
3430 builder.write(" "); 3430 builder.append(" ");
3431 builder.write(name); 3431 builder.append(name);
3432 } 3432 }
3433 } 3433 }
3434 /** 3434 /**
3435 * The unique instance of the class {@code BottomTypeImpl} implements the type { @code bottom}. 3435 * The unique instance of the class {@code BottomTypeImpl} implements the type { @code bottom}.
3436 */ 3436 */
3437 class BottomTypeImpl extends TypeImpl { 3437 class BottomTypeImpl extends TypeImpl {
3438 /** 3438 /**
3439 * The unique instance of this class. 3439 * The unique instance of this class.
3440 */ 3440 */
3441 static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); 3441 static BottomTypeImpl _INSTANCE = new BottomTypeImpl();
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
3702 return this; 3702 return this;
3703 } 3703 }
3704 Element element38 = element; 3704 Element element38 = element;
3705 FunctionTypeImpl newType = (element38 is ExecutableElement) ? new FunctionTy peImpl.con1((element38 as ExecutableElement)) : new FunctionTypeImpl.con2((eleme nt38 as TypeAliasElement)); 3705 FunctionTypeImpl newType = (element38 is ExecutableElement) ? new FunctionTy peImpl.con1((element38 as ExecutableElement)) : new FunctionTypeImpl.con2((eleme nt38 as TypeAliasElement));
3706 newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes); 3706 newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes);
3707 newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, ar gumentTypes, parameterTypes); 3707 newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, ar gumentTypes, parameterTypes);
3708 newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes , argumentTypes, parameterTypes); 3708 newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes , argumentTypes, parameterTypes);
3709 newType._namedParameterTypes = substitute3(_namedParameterTypes, argumentTyp es, parameterTypes); 3709 newType._namedParameterTypes = substitute3(_namedParameterTypes, argumentTyp es, parameterTypes);
3710 return newType; 3710 return newType;
3711 } 3711 }
3712 void appendTo(StringBuffer builder) { 3712 void appendTo(JavaStringBuilder builder) {
3713 builder.write("("); 3713 builder.append("(");
3714 bool needsComma = false; 3714 bool needsComma = false;
3715 if (_normalParameterTypes.length > 0) { 3715 if (_normalParameterTypes.length > 0) {
3716 for (Type2 type in _normalParameterTypes) { 3716 for (Type2 type in _normalParameterTypes) {
3717 if (needsComma) { 3717 if (needsComma) {
3718 builder.write(", "); 3718 builder.append(", ");
3719 } else { 3719 } else {
3720 needsComma = true; 3720 needsComma = true;
3721 } 3721 }
3722 ((type as TypeImpl)).appendTo(builder); 3722 ((type as TypeImpl)).appendTo(builder);
3723 } 3723 }
3724 } 3724 }
3725 if (_optionalParameterTypes.length > 0) { 3725 if (_optionalParameterTypes.length > 0) {
3726 if (needsComma) { 3726 if (needsComma) {
3727 builder.write(", "); 3727 builder.append(", ");
3728 needsComma = false; 3728 needsComma = false;
3729 } 3729 }
3730 builder.write("["); 3730 builder.append("[");
3731 for (Type2 type in _optionalParameterTypes) { 3731 for (Type2 type in _optionalParameterTypes) {
3732 if (needsComma) { 3732 if (needsComma) {
3733 builder.write(", "); 3733 builder.append(", ");
3734 } else { 3734 } else {
3735 needsComma = true; 3735 needsComma = true;
3736 } 3736 }
3737 ((type as TypeImpl)).appendTo(builder); 3737 ((type as TypeImpl)).appendTo(builder);
3738 } 3738 }
3739 builder.write("]"); 3739 builder.append("]");
3740 needsComma = true; 3740 needsComma = true;
3741 } 3741 }
3742 if (_namedParameterTypes.length > 0) { 3742 if (_namedParameterTypes.length > 0) {
3743 if (needsComma) { 3743 if (needsComma) {
3744 builder.write(", "); 3744 builder.append(", ");
3745 needsComma = false; 3745 needsComma = false;
3746 } 3746 }
3747 builder.write("{"); 3747 builder.append("{");
3748 for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes) ) { 3748 for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes) ) {
3749 if (needsComma) { 3749 if (needsComma) {
3750 builder.write(", "); 3750 builder.append(", ");
3751 } else { 3751 } else {
3752 needsComma = true; 3752 needsComma = true;
3753 } 3753 }
3754 builder.write(entry.getKey()); 3754 builder.append(entry.getKey());
3755 builder.write(": "); 3755 builder.append(": ");
3756 ((entry.getValue() as TypeImpl)).appendTo(builder); 3756 ((entry.getValue() as TypeImpl)).appendTo(builder);
3757 } 3757 }
3758 builder.write("}"); 3758 builder.append("}");
3759 needsComma = true; 3759 needsComma = true;
3760 } 3760 }
3761 builder.write(") -> "); 3761 builder.append(") -> ");
3762 if (_returnType == null) { 3762 if (_returnType == null) {
3763 builder.write("null"); 3763 builder.append("null");
3764 } else { 3764 } else {
3765 ((_returnType as TypeImpl)).appendTo(builder); 3765 ((_returnType as TypeImpl)).appendTo(builder);
3766 } 3766 }
3767 } 3767 }
3768 } 3768 }
3769 /** 3769 /**
3770 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common to objects 3770 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common to objects
3771 * representing the type introduced by either a class or an interface, or a refe rence to such a 3771 * representing the type introduced by either a class or an interface, or a refe rence to such a
3772 * type. 3772 * type.
3773 */ 3773 */
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4058 if (argumentTypes.length != parameterTypes.length) { 4058 if (argumentTypes.length != parameterTypes.length) {
4059 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})"); 4059 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})");
4060 } 4060 }
4061 if (argumentTypes.length == 0) { 4061 if (argumentTypes.length == 0) {
4062 return this; 4062 return this;
4063 } 4063 }
4064 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element); 4064 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element);
4065 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p arameterTypes); 4065 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p arameterTypes);
4066 return newType; 4066 return newType;
4067 } 4067 }
4068 void appendTo(StringBuffer builder) { 4068 void appendTo(JavaStringBuilder builder) {
4069 builder.write(name); 4069 builder.append(name);
4070 int argumentCount = _typeArguments.length; 4070 int argumentCount = _typeArguments.length;
4071 if (argumentCount > 0) { 4071 if (argumentCount > 0) {
4072 builder.write("<"); 4072 builder.append("<");
4073 for (int i = 0; i < argumentCount; i++) { 4073 for (int i = 0; i < argumentCount; i++) {
4074 if (i > 0) { 4074 if (i > 0) {
4075 builder.write(", "); 4075 builder.append(", ");
4076 } 4076 }
4077 ((_typeArguments[i] as TypeImpl)).appendTo(builder); 4077 ((_typeArguments[i] as TypeImpl)).appendTo(builder);
4078 } 4078 }
4079 builder.write(">"); 4079 builder.append(">");
4080 } 4080 }
4081 } 4081 }
4082 } 4082 }
4083 /** 4083 /**
4084 * The abstract class {@code TypeImpl} implements the behavior common to objects representing the 4084 * The abstract class {@code TypeImpl} implements the behavior common to objects representing the
4085 * declared type of elements in the element model. 4085 * declared type of elements in the element model.
4086 */ 4086 */
4087 abstract class TypeImpl implements Type2 { 4087 abstract class TypeImpl implements Type2 {
4088 /** 4088 /**
4089 * Return an array containing the results of using the given argument types an d parameter types to 4089 * Return an array containing the results of using the given argument types an d parameter types to
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 Element get element => _element; 4129 Element get element => _element;
4130 Type2 getLeastUpperBound(Type2 type) => null; 4130 Type2 getLeastUpperBound(Type2 type) => null;
4131 String get name => _name; 4131 String get name => _name;
4132 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this); 4132 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this);
4133 bool isDartCoreFunction() => false; 4133 bool isDartCoreFunction() => false;
4134 bool isDynamic() => false; 4134 bool isDynamic() => false;
4135 bool isMoreSpecificThan(Type2 type) => false; 4135 bool isMoreSpecificThan(Type2 type) => false;
4136 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); 4136 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this);
4137 bool isVoid() => false; 4137 bool isVoid() => false;
4138 String toString() { 4138 String toString() {
4139 StringBuffer builder = new StringBuffer(); 4139 JavaStringBuilder builder = new JavaStringBuilder();
4140 appendTo(builder); 4140 appendTo(builder);
4141 return builder.toString(); 4141 return builder.toString();
4142 } 4142 }
4143 /** 4143 /**
4144 * Append a textual representation of this type to the given builder. 4144 * Append a textual representation of this type to the given builder.
4145 * @param builder the builder to which the text is to be appended 4145 * @param builder the builder to which the text is to be appended
4146 */ 4146 */
4147 void appendTo(StringBuffer builder) { 4147 void appendTo(JavaStringBuilder builder) {
4148 if (_name == null) { 4148 if (_name == null) {
4149 builder.write("<unnamed type>"); 4149 builder.append("<unnamed type>");
4150 } else { 4150 } else {
4151 builder.write(_name); 4151 builder.append(_name);
4152 } 4152 }
4153 } 4153 }
4154 } 4154 }
4155 /** 4155 /**
4156 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o bjects representing 4156 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o bjects representing
4157 * the type introduced by a type variable. 4157 * the type introduced by a type variable.
4158 */ 4158 */
4159 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { 4159 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType {
4160 /** 4160 /**
4161 * Return an array containing the type variable types defined by the given arr ay of type variable 4161 * Return an array containing the type variable types defined by the given arr ay of type variable
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
4523 */ 4523 */
4524 abstract class TypeVariableType implements Type2 { 4524 abstract class TypeVariableType implements Type2 {
4525 TypeVariableElement get element; 4525 TypeVariableElement get element;
4526 } 4526 }
4527 /** 4527 /**
4528 * The interface {@code VoidType} defines the behavior of the unique object repr esenting the type{@code void}. 4528 * The interface {@code VoidType} defines the behavior of the unique object repr esenting the type{@code void}.
4529 */ 4529 */
4530 abstract class VoidType implements Type2 { 4530 abstract class VoidType implements Type2 {
4531 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); 4531 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
4532 } 4532 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698