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 '../helpers/helpers.dart'; | 8 import '../helpers/helpers.dart'; |
9 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
10 import '../util/util.dart'; | 10 import '../util/util.dart'; |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 | 994 |
995 // Only needed for deferred imports. | 995 // Only needed for deferred imports. |
996 Import _deferredImport; | 996 Import _deferredImport; |
997 Import get deferredImport => _deferredImport; | 997 Import get deferredImport => _deferredImport; |
998 | 998 |
999 PrefixElementX(String prefix, Element enclosing, this.firstPosition) | 999 PrefixElementX(String prefix, Element enclosing, this.firstPosition) |
1000 : super(prefix, ElementKind.PREFIX, enclosing); | 1000 : super(prefix, ElementKind.PREFIX, enclosing); |
1001 | 1001 |
1002 Element lookupLocalMember(String memberName) => importScope[memberName]; | 1002 Element lookupLocalMember(String memberName) => importScope[memberName]; |
1003 | 1003 |
1004 DartType computeType(Compiler compiler) => compiler.types.dynamicType; | 1004 DartType computeType(Compiler compiler) => const DynamicType(); |
1005 | 1005 |
1006 Token get position => firstPosition; | 1006 Token get position => firstPosition; |
1007 | 1007 |
1008 void addImport(Element element, Import import, DiagnosticListener listener) { | 1008 void addImport(Element element, Import import, DiagnosticListener listener) { |
1009 importScope.addImport(this, element, import, listener); | 1009 importScope.addImport(this, element, import, listener); |
1010 } | 1010 } |
1011 | 1011 |
1012 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this); | 1012 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this); |
1013 | 1013 |
1014 void markAsDeferred(Import deferredImport) { | 1014 void markAsDeferred(Import deferredImport) { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 DeferredLoaderGetterElementX(PrefixElement prefix) | 1616 DeferredLoaderGetterElementX(PrefixElement prefix) |
1617 : this.prefix = prefix, | 1617 : this.prefix = prefix, |
1618 super("loadLibrary", | 1618 super("loadLibrary", |
1619 ElementKind.FUNCTION, | 1619 ElementKind.FUNCTION, |
1620 Modifiers.EMPTY, | 1620 Modifiers.EMPTY, |
1621 prefix, true); | 1621 prefix, true); |
1622 | 1622 |
1623 FunctionSignature computeSignature(Compiler compiler) { | 1623 FunctionSignature computeSignature(Compiler compiler) { |
1624 if (functionSignatureCache != null) return functionSignature; | 1624 if (functionSignatureCache != null) return functionSignature; |
1625 compiler.withCurrentElement(this, () { | 1625 compiler.withCurrentElement(this, () { |
1626 DartType inner = new FunctionType(this, compiler.types.dynamicType); | 1626 DartType inner = new FunctionType(this); |
1627 functionSignatureCache = new FunctionSignatureX(const Link(), | 1627 functionSignatureCache = new FunctionSignatureX(const Link(), |
1628 const Link(), 0, 0, false, [], inner); | 1628 const Link(), 0, 0, false, [], inner); |
1629 }); | 1629 }); |
1630 return functionSignatureCache; | 1630 return functionSignatureCache; |
1631 } | 1631 } |
1632 | 1632 |
1633 bool get isMember => false; | 1633 bool get isMember => false; |
1634 | 1634 |
1635 bool isForeign(Compiler compiler) => true; | 1635 bool isForeign(Compiler compiler) => true; |
1636 | 1636 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 message: "This type has already been set on $this.")); | 1788 message: "This type has already been set on $this.")); |
1789 assert(invariant(this, rawTypeCache == null, | 1789 assert(invariant(this, rawTypeCache == null, |
1790 message: "Raw type has already been set on $this.")); | 1790 message: "Raw type has already been set on $this.")); |
1791 thisTypeCache = createType(typeParameters); | 1791 thisTypeCache = createType(typeParameters); |
1792 if (typeParameters.isEmpty) { | 1792 if (typeParameters.isEmpty) { |
1793 rawTypeCache = thisTypeCache; | 1793 rawTypeCache = thisTypeCache; |
1794 } else { | 1794 } else { |
1795 Link<DartType> dynamicParameters = const Link<DartType>(); | 1795 Link<DartType> dynamicParameters = const Link<DartType>(); |
1796 typeParameters.forEach((_) { | 1796 typeParameters.forEach((_) { |
1797 dynamicParameters = | 1797 dynamicParameters = |
1798 dynamicParameters.prepend(compiler.types.dynamicType); | 1798 dynamicParameters.prepend(const DynamicType()); |
1799 }); | 1799 }); |
1800 rawTypeCache = createType(dynamicParameters); | 1800 rawTypeCache = createType(dynamicParameters); |
1801 } | 1801 } |
1802 } | 1802 } |
1803 | 1803 |
1804 Link<DartType> get typeVariables => thisType.typeArguments; | 1804 Link<DartType> get typeVariables => thisType.typeArguments; |
1805 | 1805 |
1806 /** | 1806 /** |
1807 * Creates the type variables, their type and corresponding element, for the | 1807 * Creates the type variables, their type and corresponding element, for the |
1808 * type variables declared in [parameter] on [element]. The bounds of the type | 1808 * type variables declared in [parameter] on [element]. The bounds of the type |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 assert(invariant(this, this.origin == null, | 2562 assert(invariant(this, this.origin == null, |
2563 message: "Origin element is a patch.")); | 2563 message: "Origin element is a patch.")); |
2564 assert(invariant(patch, patch.origin == null, | 2564 assert(invariant(patch, patch.origin == null, |
2565 message: "Element is patched twice.")); | 2565 message: "Element is patched twice.")); |
2566 assert(invariant(patch, patch.patch == null, | 2566 assert(invariant(patch, patch.patch == null, |
2567 message: "Patch element is patched.")); | 2567 message: "Patch element is patched.")); |
2568 this.patch = patch; | 2568 this.patch = patch; |
2569 patch.origin = this; | 2569 patch.origin = this; |
2570 } | 2570 } |
2571 } | 2571 } |
OLD | NEW |