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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 96873002: Fix ElementVisitor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library elements.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../../compiler.dart' as api; 8 import '../../compiler.dart' as api;
9 import '../tree/tree.dart'; 9 import '../tree/tree.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 get redirectionTarget => this; 352 get redirectionTarget => this;
353 353
354 getLibrary() => enclosingElement.getLibrary(); 354 getLibrary() => enclosingElement.getLibrary();
355 355
356 computeTargetType(InterfaceType newType) => unsupported(); 356 computeTargetType(InterfaceType newType) => unsupported();
357 357
358 String get message => '${messageKind.message(messageArguments)}'; 358 String get message => '${messageKind.message(messageArguments)}';
359 359
360 String toString() => '<$name: $message>'; 360 String toString() => '<$name: $message>';
361 361
362 accept(ElementVisitor visitor) => visitor.visitErroneousElementX(this); 362 accept(ElementVisitor visitor) => visitor.visitErroneousElement(this);
363 } 363 }
364 364
365 /// A message attached to a [WarnOnUseElementX]. 365 /// A message attached to a [WarnOnUseElementX].
366 class WrappedMessage { 366 class WrappedMessage {
367 /// The message position. If [:null:] the position of the reference to the 367 /// The message position. If [:null:] the position of the reference to the
368 /// [WarnOnUseElementX] is used. 368 /// [WarnOnUseElementX] is used.
369 final Spannable spannable; 369 final Spannable spannable;
370 370
371 /** 371 /**
372 * The message to report on resolving a wrapped element. 372 * The message to report on resolving a wrapped element.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (spannable == null) spannable = usageSpannable; 414 if (spannable == null) spannable = usageSpannable;
415 listener.reportInfo( 415 listener.reportInfo(
416 spannable, info.messageKind, info.messageArguments); 416 spannable, info.messageKind, info.messageArguments);
417 } 417 }
418 if (unwrapped.isWarnOnUse()) { 418 if (unwrapped.isWarnOnUse()) {
419 unwrapped = unwrapped.unwrap(listener, usageSpannable); 419 unwrapped = unwrapped.unwrap(listener, usageSpannable);
420 } 420 }
421 return unwrapped; 421 return unwrapped;
422 } 422 }
423 423
424 accept(ElementVisitor visitor) => visitor.visitWarnOnUseElementX(this); 424 accept(ElementVisitor visitor) => visitor.visitWarnOnUseElement(this);
425 } 425 }
426 426
427 /** 427 /**
428 * An ambiguous element represents multiple elements accessible by the same name . 428 * An ambiguous element represents multiple elements accessible by the same name .
429 * 429 *
430 * Ambiguous elements are created during handling of import/export scopes. If an 430 * Ambiguous elements are created during handling of import/export scopes. If an
431 * ambiguous element is encountered during resolution a warning/error should be 431 * ambiguous element is encountered during resolution a warning/error should be
432 * reported. 432 * reported.
433 */ 433 */
434 class AmbiguousElementX extends ElementX implements AmbiguousElement { 434 class AmbiguousElementX extends ElementX implements AmbiguousElement {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 Link<Import> importers = importer.importers.getImports(element); 483 Link<Import> importers = importer.importers.getImports(element);
484 listener.withCurrentElement(importer, () { 484 listener.withCurrentElement(importer, () {
485 for (; !importers.isEmpty; importers = importers.tail) { 485 for (; !importers.isEmpty; importers = importers.tail) {
486 listener.reportInfo( 486 listener.reportInfo(
487 importers.head, MessageKind.IMPORTED_HERE, arguments); 487 importers.head, MessageKind.IMPORTED_HERE, arguments);
488 } 488 }
489 }); 489 });
490 } 490 }
491 } 491 }
492 492
493 accept(ElementVisitor visitor) => visitor.visitAmbiguousElementX(this); 493 accept(ElementVisitor visitor) => visitor.visitAmbiguousElement(this);
494 } 494 }
495 495
496 class ScopeX { 496 class ScopeX {
497 final Map<String, Element> contents = new Map<String, Element>(); 497 final Map<String, Element> contents = new Map<String, Element>();
498 498
499 bool get isEmpty => contents.isEmpty; 499 bool get isEmpty => contents.isEmpty;
500 Iterable<Element> get values => contents.values; 500 Iterable<Element> get values => contents.values;
501 501
502 Element lookup(String name) { 502 Element lookup(String name) {
503 return contents[name]; 503 return contents[name];
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } else { 998 } else {
999 return 'library(${getLibraryOrScriptName()})'; 999 return 'library(${getLibraryOrScriptName()})';
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 int compareTo(LibraryElement other) { 1003 int compareTo(LibraryElement other) {
1004 if (this == other) return 0; 1004 if (this == other) return 0;
1005 return getLibraryOrScriptName().compareTo(other.getLibraryOrScriptName()); 1005 return getLibraryOrScriptName().compareTo(other.getLibraryOrScriptName());
1006 } 1006 }
1007 1007
1008 accept(ElementVisitor visitor) => visitor.visitLibraryElementX(this); 1008 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this);
1009 } 1009 }
1010 1010
1011 class PrefixElementX extends ElementX implements PrefixElement { 1011 class PrefixElementX extends ElementX implements PrefixElement {
1012 Token firstPosition; 1012 Token firstPosition;
1013 1013
1014 final ImportScope importScope = new ImportScope(); 1014 final ImportScope importScope = new ImportScope();
1015 1015
1016 PrefixElementX(String prefix, Element enclosing, this.firstPosition) 1016 PrefixElementX(String prefix, Element enclosing, this.firstPosition)
1017 : super(prefix, ElementKind.PREFIX, enclosing); 1017 : super(prefix, ElementKind.PREFIX, enclosing);
1018 1018
1019 Element lookupLocalMember(String memberName) => importScope[memberName]; 1019 Element lookupLocalMember(String memberName) => importScope[memberName];
1020 1020
1021 DartType computeType(Compiler compiler) => compiler.types.dynamicType; 1021 DartType computeType(Compiler compiler) => compiler.types.dynamicType;
1022 1022
1023 Token position() => firstPosition; 1023 Token position() => firstPosition;
1024 1024
1025 void addImport(Element element, Import import, DiagnosticListener listener) { 1025 void addImport(Element element, Import import, DiagnosticListener listener) {
1026 importScope.addImport(this, element, import, listener); 1026 importScope.addImport(this, element, import, listener);
1027 } 1027 }
1028 1028
1029 accept(ElementVisitor visitor) => visitor.visitPrefixElementX(this); 1029 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this);
1030 } 1030 }
1031 1031
1032 class TypedefElementX extends ElementX implements TypedefElement { 1032 class TypedefElementX extends ElementX implements TypedefElement {
1033 Typedef cachedNode; 1033 Typedef cachedNode;
1034 1034
1035 /** 1035 /**
1036 * The type of this typedef in which the type arguments are the type 1036 * The type of this typedef in which the type arguments are the type
1037 * variables. 1037 * variables.
1038 * 1038 *
1039 * This resembles the [ClassElement.thisType] though a typedef has no notion 1039 * This resembles the [ClassElement.thisType] though a typedef has no notion
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 return new TypeDeclarationScope(enclosingElement.buildScope(), this); 1104 return new TypeDeclarationScope(enclosingElement.buildScope(), this);
1105 } 1105 }
1106 1106
1107 void checkCyclicReference(Compiler compiler) { 1107 void checkCyclicReference(Compiler compiler) {
1108 if (hasBeenCheckedForCycles) return; 1108 if (hasBeenCheckedForCycles) return;
1109 var visitor = new TypedefCyclicVisitor(compiler, this); 1109 var visitor = new TypedefCyclicVisitor(compiler, this);
1110 computeType(compiler).accept(visitor, null); 1110 computeType(compiler).accept(visitor, null);
1111 hasBeenCheckedForCycles = true; 1111 hasBeenCheckedForCycles = true;
1112 } 1112 }
1113 1113
1114 accept(ElementVisitor visitor) => visitor.visitTypedefElementX(this); 1114 accept(ElementVisitor visitor) => visitor.visitTypedefElement(this);
1115 } 1115 }
1116 1116
1117 class VariableElementX extends ElementX implements VariableElement { 1117 class VariableElementX extends ElementX implements VariableElement {
1118 final VariableListElement variables; 1118 final VariableListElement variables;
1119 Expression cachedNode; // The send or the identifier in the variables list. 1119 Expression cachedNode; // The send or the identifier in the variables list.
1120 1120
1121 Modifiers get modifiers => variables.modifiers; 1121 Modifiers get modifiers => variables.modifiers;
1122 1122
1123 VariableElementX(String name, 1123 VariableElementX(String name,
1124 VariableListElement variables, 1124 VariableListElement variables,
(...skipping 29 matching lines...) Expand all
1154 DartType computeType(Compiler compiler) { 1154 DartType computeType(Compiler compiler) {
1155 return variables.computeType(compiler); 1155 return variables.computeType(compiler);
1156 } 1156 }
1157 1157
1158 bool isInstanceMember() => variables.isInstanceMember(); 1158 bool isInstanceMember() => variables.isInstanceMember();
1159 1159
1160 // Note: cachedNode.getBeginToken() will not be correct in all 1160 // Note: cachedNode.getBeginToken() will not be correct in all
1161 // cases, for example, for function typed parameters. 1161 // cases, for example, for function typed parameters.
1162 Token position() => findMyName(variables.position()); 1162 Token position() => findMyName(variables.position());
1163 1163
1164 accept(ElementVisitor visitor) => visitor.visitVariableElementX(this); 1164 accept(ElementVisitor visitor) => visitor.visitVariableElement(this);
1165 } 1165 }
1166 1166
1167 /** 1167 /**
1168 * Parameters in constructors that directly initialize fields. For example: 1168 * Parameters in constructors that directly initialize fields. For example:
1169 * [:A(this.field):]. 1169 * [:A(this.field):].
1170 */ 1170 */
1171 class FieldParameterElementX extends VariableElementX 1171 class FieldParameterElementX extends VariableElementX
1172 implements FieldParameterElement { 1172 implements FieldParameterElement {
1173 VariableElement fieldElement; 1173 VariableElement fieldElement;
1174 1174
1175 FieldParameterElementX(String name, 1175 FieldParameterElementX(String name,
1176 this.fieldElement, 1176 this.fieldElement,
1177 VariableListElement variables, 1177 VariableListElement variables,
1178 Node node) 1178 Node node)
1179 : super(name, variables, ElementKind.FIELD_PARAMETER, node); 1179 : super(name, variables, ElementKind.FIELD_PARAMETER, node);
1180 1180
1181 DartType computeType(Compiler compiler) { 1181 DartType computeType(Compiler compiler) {
1182 VariableDefinitions definitions = variables.parseNode(compiler); 1182 VariableDefinitions definitions = variables.parseNode(compiler);
1183 if (definitions.type == null) { 1183 if (definitions.type == null) {
1184 return fieldElement.computeType(compiler); 1184 return fieldElement.computeType(compiler);
1185 } 1185 }
1186 return super.computeType(compiler); 1186 return super.computeType(compiler);
1187 } 1187 }
1188 1188
1189 accept(ElementVisitor visitor) => visitor.visitFieldParameterElementX(this); 1189 accept(ElementVisitor visitor) => visitor.visitFieldParameterElement(this);
1190 } 1190 }
1191 1191
1192 // This element represents a list of variable or field declaration. 1192 // This element represents a list of variable or field declaration.
1193 // It contains the node, and the type. A [VariableElement] always 1193 // It contains the node, and the type. A [VariableElement] always
1194 // references its [VariableListElement]. It forwards its 1194 // references its [VariableListElement]. It forwards its
1195 // [computeType] and [parseNode] methods to this element. 1195 // [computeType] and [parseNode] methods to this element.
1196 class VariableListElementX extends ElementX implements VariableListElement { 1196 class VariableListElementX extends ElementX implements VariableListElement {
1197 VariableDefinitions cachedNode; 1197 VariableDefinitions cachedNode;
1198 DartType type; 1198 DartType type;
1199 final Modifiers modifiers; 1199 final Modifiers modifiers;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 assert(type != null); 1249 assert(type != null);
1250 return type; 1250 return type;
1251 } 1251 }
1252 1252
1253 Token position() => cachedNode.getBeginToken(); 1253 Token position() => cachedNode.getBeginToken();
1254 1254
1255 bool isInstanceMember() { 1255 bool isInstanceMember() {
1256 return isMember() && !modifiers.isStatic(); 1256 return isMember() && !modifiers.isStatic();
1257 } 1257 }
1258 1258
1259 accept(ElementVisitor visitor) => visitor.visitVariableListElementX(this); 1259 accept(ElementVisitor visitor) => visitor.visitVariableListElement(this);
1260 } 1260 }
1261 1261
1262 class AbstractFieldElementX extends ElementX implements AbstractFieldElement { 1262 class AbstractFieldElementX extends ElementX implements AbstractFieldElement {
1263 FunctionElement getter; 1263 FunctionElement getter;
1264 FunctionElement setter; 1264 FunctionElement setter;
1265 1265
1266 AbstractFieldElementX(String name, Element enclosing) 1266 AbstractFieldElementX(String name, Element enclosing)
1267 : super(name, ElementKind.ABSTRACT_FIELD, enclosing); 1267 : super(name, ElementKind.ABSTRACT_FIELD, enclosing);
1268 1268
1269 DartType computeType(Compiler compiler) { 1269 DartType computeType(Compiler compiler) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 return new Modifiers.withFlags( 1302 return new Modifiers.withFlags(
1303 setter.modifiers.nodes, 1303 setter.modifiers.nodes,
1304 setter.modifiers.flags | Modifiers.FLAG_ABSTRACT); 1304 setter.modifiers.flags | Modifiers.FLAG_ABSTRACT);
1305 } 1305 }
1306 } 1306 }
1307 1307
1308 bool isInstanceMember() { 1308 bool isInstanceMember() {
1309 return isMember() && !modifiers.isStatic(); 1309 return isMember() && !modifiers.isStatic();
1310 } 1310 }
1311 1311
1312 accept(ElementVisitor visitor) => visitor.visitAbstractFieldElementX(this); 1312 accept(ElementVisitor visitor) => visitor.visitAbstractFieldElement(this);
1313 } 1313 }
1314 1314
1315 // TODO(johnniwinther): [FunctionSignature] should be merged with 1315 // TODO(johnniwinther): [FunctionSignature] should be merged with
1316 // [FunctionType]. 1316 // [FunctionType].
1317 class FunctionSignatureX implements FunctionSignature { 1317 class FunctionSignatureX implements FunctionSignature {
1318 final Link<Element> requiredParameters; 1318 final Link<Element> requiredParameters;
1319 final Link<Element> optionalParameters; 1319 final Link<Element> optionalParameters;
1320 final DartType returnType; 1320 final DartType returnType;
1321 final int requiredParameterCount; 1321 final int requiredParameterCount;
1322 final int optionalParameterCount; 1322 final int optionalParameterCount;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 return super.toString(); 1571 return super.toString();
1572 } 1572 }
1573 } 1573 }
1574 1574
1575 bool get isAbstract { 1575 bool get isAbstract {
1576 return !modifiers.isExternal() && 1576 return !modifiers.isExternal() &&
1577 (isFunction() || isAccessor()) && 1577 (isFunction() || isAccessor()) &&
1578 _hasNoBody; 1578 _hasNoBody;
1579 } 1579 }
1580 1580
1581 accept(ElementVisitor visitor) => visitor.visitFunctionElementX(this); 1581 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
1582 } 1582 }
1583 1583
1584 class ConstructorBodyElementX extends FunctionElementX 1584 class ConstructorBodyElementX extends FunctionElementX
1585 implements ConstructorBodyElement { 1585 implements ConstructorBodyElement {
1586 FunctionElement constructor; 1586 FunctionElement constructor;
1587 1587
1588 ConstructorBodyElementX(FunctionElement constructor) 1588 ConstructorBodyElementX(FunctionElement constructor)
1589 : this.constructor = constructor, 1589 : this.constructor = constructor,
1590 super(constructor.name, 1590 super(constructor.name,
1591 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, 1591 ElementKind.GENERATIVE_CONSTRUCTOR_BODY,
(...skipping 10 matching lines...) Expand all
1602 1602
1603 Node parseNode(DiagnosticListener listener) { 1603 Node parseNode(DiagnosticListener listener) {
1604 if (cachedNode != null) return cachedNode; 1604 if (cachedNode != null) return cachedNode;
1605 cachedNode = constructor.parseNode(listener); 1605 cachedNode = constructor.parseNode(listener);
1606 assert(cachedNode != null); 1606 assert(cachedNode != null);
1607 return cachedNode; 1607 return cachedNode;
1608 } 1608 }
1609 1609
1610 Token position() => constructor.position(); 1610 Token position() => constructor.position();
1611 1611
1612 accept(ElementVisitor visitor) => visitor.visitConstructorBodyElementX(this); 1612 accept(ElementVisitor visitor) => visitor.visitConstructorBodyElement(this);
1613 } 1613 }
1614 1614
1615 /** 1615 /**
1616 * A constructor that is not defined in the source code but rather implied by 1616 * A constructor that is not defined in the source code but rather implied by
1617 * the language semantics. 1617 * the language semantics.
1618 * 1618 *
1619 * This class is used to represent default constructors and forwarding 1619 * This class is used to represent default constructors and forwarding
1620 * constructors for mixin applications. 1620 * constructors for mixin applications.
1621 */ 1621 */
1622 class SynthesizedConstructorElementX extends FunctionElementX { 1622 class SynthesizedConstructorElementX extends FunctionElementX {
(...skipping 30 matching lines...) Expand all
1653 .computeSignature(compiler); 1653 .computeSignature(compiler);
1654 } 1654 }
1655 return functionSignature = superMember.computeSignature(compiler); 1655 return functionSignature = superMember.computeSignature(compiler);
1656 } 1656 }
1657 1657
1658 get declaration => this; 1658 get declaration => this;
1659 get implementation => this; 1659 get implementation => this;
1660 get defaultImplementation => this; 1660 get defaultImplementation => this;
1661 1661
1662 accept(ElementVisitor visitor) { 1662 accept(ElementVisitor visitor) {
1663 visitor.visitSynthesizedConstructorElementX(this); 1663 return visitor.visitFunctionElement(this);
1664 } 1664 }
1665 } 1665 }
1666 1666
1667 class VoidElementX extends ElementX { 1667 class VoidElementX extends ElementX implements VoidElement {
1668 VoidElementX(Element enclosing) : super('void', ElementKind.VOID, enclosing); 1668 VoidElementX(Element enclosing) : super('void', ElementKind.VOID, enclosing);
1669 DartType computeType(compiler) => compiler.types.voidType; 1669 DartType computeType(compiler) => compiler.types.voidType;
1670 Node parseNode(_) { 1670 Node parseNode(_) {
1671 throw 'internal error: parseNode on void'; 1671 throw 'internal error: parseNode on void';
1672 } 1672 }
1673 bool impliesType() => true; 1673 bool impliesType() => true;
1674 1674
1675 accept(ElementVisitor visitor) => visitor.visitVoidElementX(this); 1675 accept(ElementVisitor visitor) => visitor.visitVoidElement(this);
1676 } 1676 }
1677 1677
1678 class TypeDeclarationElementX { 1678 class TypeDeclarationElementX {
1679 /** 1679 /**
1680 * Creates the type variables, their type and corresponding element, for the 1680 * Creates the type variables, their type and corresponding element, for the
1681 * type variables declared in [parameter] on [element]. The bounds of the type 1681 * type variables declared in [parameter] on [element]. The bounds of the type
1682 * variables are not set until [element] has been resolved. 1682 * variables are not set until [element] has been resolved.
1683 */ 1683 */
1684 static Link<DartType> createTypeVariables(TypeDeclarationElement element, 1684 static Link<DartType> createTypeVariables(TypeDeclarationElement element,
1685 NodeList parameters) { 1685 NodeList parameters) {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
2330 isContinueTarget = true; 2330 isContinueTarget = true;
2331 target.isContinueTarget = true; 2331 target.isContinueTarget = true;
2332 } 2332 }
2333 2333
2334 bool get isTarget => isBreakTarget || isContinueTarget; 2334 bool get isTarget => isBreakTarget || isContinueTarget;
2335 Node parseNode(DiagnosticListener l) => label; 2335 Node parseNode(DiagnosticListener l) => label;
2336 2336
2337 Token position() => label.getBeginToken(); 2337 Token position() => label.getBeginToken();
2338 String toString() => "${labelName}:"; 2338 String toString() => "${labelName}:";
2339 2339
2340 accept(ElementVisitor visitor) => visitor.visitLabelElementX(this); 2340 accept(ElementVisitor visitor) => visitor.visitLabelElement(this);
2341 } 2341 }
2342 2342
2343 // Represents a reference to a statement or switch-case, either by label or the 2343 // Represents a reference to a statement or switch-case, either by label or the
2344 // default target of a break or continue. 2344 // default target of a break or continue.
2345 class TargetElementX extends ElementX implements TargetElement { 2345 class TargetElementX extends ElementX implements TargetElement {
2346 final Node statement; 2346 final Node statement;
2347 final int nestingLevel; 2347 final int nestingLevel;
2348 Link<LabelElement> labels = const Link<LabelElement>(); 2348 Link<LabelElement> labels = const Link<LabelElement>();
2349 bool isBreakTarget = false; 2349 bool isBreakTarget = false;
2350 bool isContinueTarget = false; 2350 bool isContinueTarget = false;
2351 2351
2352 TargetElementX(this.statement, this.nestingLevel, Element enclosingElement) 2352 TargetElementX(this.statement, this.nestingLevel, Element enclosingElement)
2353 : super("target", ElementKind.STATEMENT, enclosingElement); 2353 : super("target", ElementKind.STATEMENT, enclosingElement);
2354 bool get isTarget => isBreakTarget || isContinueTarget; 2354 bool get isTarget => isBreakTarget || isContinueTarget;
2355 2355
2356 LabelElement addLabel(Label label, String labelName) { 2356 LabelElement addLabel(Label label, String labelName) {
2357 LabelElement result = new LabelElementX(label, labelName, this, 2357 LabelElement result = new LabelElementX(label, labelName, this,
2358 enclosingElement); 2358 enclosingElement);
2359 labels = labels.prepend(result); 2359 labels = labels.prepend(result);
2360 return result; 2360 return result;
2361 } 2361 }
2362 2362
2363 Node parseNode(DiagnosticListener l) => statement; 2363 Node parseNode(DiagnosticListener l) => statement;
2364 2364
2365 bool get isSwitch => statement is SwitchStatement; 2365 bool get isSwitch => statement is SwitchStatement;
2366 2366
2367 Token position() => statement.getBeginToken(); 2367 Token position() => statement.getBeginToken();
2368 String toString() => statement.toString(); 2368 String toString() => statement.toString();
2369 2369
2370 accept(ElementVisitor visitor) => visitor.visitTargetElementX(this); 2370 accept(ElementVisitor visitor) => visitor.visitTargetElement(this);
2371 } 2371 }
2372 2372
2373 class TypeVariableElementX extends ElementX implements TypeVariableElement { 2373 class TypeVariableElementX extends ElementX implements TypeVariableElement {
2374 final Node cachedNode; 2374 final Node cachedNode;
2375 TypeVariableType type; 2375 TypeVariableType type;
2376 DartType bound; 2376 DartType bound;
2377 2377
2378 TypeVariableElementX(name, Element enclosing, this.cachedNode, 2378 TypeVariableElementX(name, Element enclosing, this.cachedNode,
2379 [this.type, this.bound]) 2379 [this.type, this.bound])
2380 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 2380 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
2381 2381
2382 TypeVariableType computeType(compiler) => type; 2382 TypeVariableType computeType(compiler) => type;
2383 2383
2384 Node parseNode(compiler) => cachedNode; 2384 Node parseNode(compiler) => cachedNode;
2385 2385
2386 String toString() => "${enclosingElement.toString()}.${name}"; 2386 String toString() => "${enclosingElement.toString()}.${name}";
2387 2387
2388 Token position() => cachedNode.getBeginToken(); 2388 Token position() => cachedNode.getBeginToken();
2389 2389
2390 accept(ElementVisitor visitor) => visitor.visitTypeVariableElementX(this); 2390 accept(ElementVisitor visitor) => visitor.visitTypeVariableElement(this);
2391 } 2391 }
2392 2392
2393 /** 2393 /**
2394 * A single metadata annotation. 2394 * A single metadata annotation.
2395 * 2395 *
2396 * For example, consider: 2396 * For example, consider:
2397 * 2397 *
2398 * class Data { 2398 * class Data {
2399 * const Data(); 2399 * const Data();
2400 * } 2400 * }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 2432
2433 MetadataAnnotation ensureResolved(Compiler compiler) { 2433 MetadataAnnotation ensureResolved(Compiler compiler) {
2434 if (resolutionState == STATE_NOT_STARTED) { 2434 if (resolutionState == STATE_NOT_STARTED) {
2435 compiler.resolver.resolveMetadataAnnotation(this); 2435 compiler.resolver.resolveMetadataAnnotation(this);
2436 } 2436 }
2437 return this; 2437 return this;
2438 } 2438 }
2439 2439
2440 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2440 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2441 } 2441 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698