| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 FunctionType, | 22 FunctionType, |
| 23 Selector, | 23 Selector, |
| 24 Constant, | 24 Constant, |
| 25 Compiler, | 25 Compiler, |
| 26 isPrivateName; | 26 isPrivateName; |
| 27 | 27 |
| 28 import '../dart_types.dart'; | 28 import '../dart_types.dart'; |
| 29 | 29 |
| 30 import '../scanner/scannerlib.dart' show Token, EOF_TOKEN; | 30 import '../scanner/scannerlib.dart' show Token, EOF_TOKEN; |
| 31 | 31 |
| 32 import '../ir/ir_nodes.dart' show IrNode, IrFunction; |
| 32 | 33 |
| 33 class ElementX implements Element { | 34 class ElementX implements Element { |
| 34 static int elementHashCode = 0; | 35 static int elementHashCode = 0; |
| 35 | 36 |
| 36 final String name; | 37 final String name; |
| 37 final ElementKind kind; | 38 final ElementKind kind; |
| 38 final Element enclosingElement; | 39 final Element enclosingElement; |
| 39 final int hashCode = ++elementHashCode; | 40 final int hashCode = ++elementHashCode; |
| 40 Link<MetadataAnnotation> metadata = const Link<MetadataAnnotation>(); | 41 Link<MetadataAnnotation> metadata = const Link<MetadataAnnotation>(); |
| 41 | 42 |
| 42 ElementX(this.name, this.kind, this.enclosingElement) { | 43 ElementX(this.name, this.kind, this.enclosingElement) { |
| 43 assert(isErroneous() || getImplementationLibrary() != null); | 44 assert(isErroneous() || getImplementationLibrary() != null); |
| 44 } | 45 } |
| 45 | 46 |
| 46 Modifiers get modifiers => Modifiers.EMPTY; | 47 Modifiers get modifiers => Modifiers.EMPTY; |
| 47 | 48 |
| 48 Node parseNode(DiagnosticListener listener) { | 49 Node parseNode(DiagnosticListener listener) { |
| 49 listener.internalErrorOnElement(this, 'not implemented'); | 50 listener.internalErrorOnElement(this, 'not implemented'); |
| 50 } | 51 } |
| 51 | 52 |
| 52 DartType computeType(Compiler compiler) { | 53 DartType computeType(Compiler compiler) { |
| 53 compiler.internalError("$this.computeType.", token: position()); | 54 compiler.internalError("$this.computeType.", token: position()); |
| 54 } | 55 } |
| 55 | 56 |
| 57 bool hasIrNode(Compiler compiler) => false; |
| 58 |
| 59 IrNode irNode(Compiler compiler) { |
| 60 compiler.internalError("$this.irNode.", token: position()); |
| 61 } |
| 62 |
| 56 void addMetadata(MetadataAnnotation annotation) { | 63 void addMetadata(MetadataAnnotation annotation) { |
| 57 assert(annotation.annotatedElement == null); | 64 assert(annotation.annotatedElement == null); |
| 58 annotation.annotatedElement = this; | 65 annotation.annotatedElement = this; |
| 59 metadata = metadata.prepend(annotation); | 66 metadata = metadata.prepend(annotation); |
| 60 } | 67 } |
| 61 | 68 |
| 62 bool isFunction() => identical(kind, ElementKind.FUNCTION); | 69 bool isFunction() => identical(kind, ElementKind.FUNCTION); |
| 63 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor(); | 70 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor(); |
| 64 bool isClosure() => false; | 71 bool isClosure() => false; |
| 65 bool isMember() { | 72 bool isMember() { |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 _hasNoBody = hasNoBody { | 1448 _hasNoBody = hasNoBody { |
| 1442 assert(modifiers != null); | 1449 assert(modifiers != null); |
| 1443 defaultImplementation = this; | 1450 defaultImplementation = this; |
| 1444 } | 1451 } |
| 1445 | 1452 |
| 1446 bool get isPatched => patch != null; | 1453 bool get isPatched => patch != null; |
| 1447 bool get isPatch => origin != null; | 1454 bool get isPatch => origin != null; |
| 1448 | 1455 |
| 1449 bool get isRedirectingFactory => defaultImplementation != this; | 1456 bool get isRedirectingFactory => defaultImplementation != this; |
| 1450 | 1457 |
| 1458 bool hasIrNode(Compiler compiler) { |
| 1459 return compiler.irBuilder.nodes.containsKey(this); |
| 1460 } |
| 1461 |
| 1462 IrNode irNode(Compiler compiler) => compiler.irBuilder.nodes[this]; |
| 1463 |
| 1451 /// This field is set by the post process queue when checking for cycles. | 1464 /// This field is set by the post process queue when checking for cycles. |
| 1452 FunctionElement internalRedirectionTarget; | 1465 FunctionElement internalRedirectionTarget; |
| 1453 DartType redirectionTargetType; | 1466 DartType redirectionTargetType; |
| 1454 | 1467 |
| 1455 set redirectionTarget(FunctionElement constructor) { | 1468 set redirectionTarget(FunctionElement constructor) { |
| 1456 assert(constructor != null && internalRedirectionTarget == null); | 1469 assert(constructor != null && internalRedirectionTarget == null); |
| 1457 internalRedirectionTarget = constructor; | 1470 internalRedirectionTarget = constructor; |
| 1458 } | 1471 } |
| 1459 | 1472 |
| 1460 FunctionElement get redirectionTarget { | 1473 FunctionElement get redirectionTarget { |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 | 2394 |
| 2382 MetadataAnnotation ensureResolved(Compiler compiler) { | 2395 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2383 if (resolutionState == STATE_NOT_STARTED) { | 2396 if (resolutionState == STATE_NOT_STARTED) { |
| 2384 compiler.resolver.resolveMetadataAnnotation(this); | 2397 compiler.resolver.resolveMetadataAnnotation(this); |
| 2385 } | 2398 } |
| 2386 return this; | 2399 return this; |
| 2387 } | 2400 } |
| 2388 | 2401 |
| 2389 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2402 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2390 } | 2403 } |
| OLD | NEW |