| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart' show | 8 import '../common/resolution.dart' show |
| 9 Resolution, | 9 Resolution, |
| 10 Parsing; | 10 Parsing; |
| (...skipping 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2874 Node definition, | 2874 Node definition, |
| 2875 [Expression initializer]) | 2875 [Expression initializer]) |
| 2876 : super(name, enumClass, variableList) { | 2876 : super(name, enumClass, variableList) { |
| 2877 definitionsCache = new VariableDefinitions(null, | 2877 definitionsCache = new VariableDefinitions(null, |
| 2878 variableList.modifiers, new NodeList.singleton(definition)); | 2878 variableList.modifiers, new NodeList.singleton(definition)); |
| 2879 initializerCache = initializer; | 2879 initializerCache = initializer; |
| 2880 } | 2880 } |
| 2881 } | 2881 } |
| 2882 | 2882 |
| 2883 abstract class MixinApplicationElementX extends BaseClassElementX | 2883 abstract class MixinApplicationElementX extends BaseClassElementX |
| 2884 with MixinApplicationElementCommon |
| 2884 implements MixinApplicationElement { | 2885 implements MixinApplicationElement { |
| 2885 | |
| 2886 Link<ConstructorElement> constructors = new Link<ConstructorElement>(); | 2886 Link<ConstructorElement> constructors = new Link<ConstructorElement>(); |
| 2887 | 2887 |
| 2888 InterfaceType mixinType; | 2888 InterfaceType mixinType; |
| 2889 | 2889 |
| 2890 MixinApplicationElementX(String name, Element enclosing, int id) | 2890 MixinApplicationElementX(String name, Element enclosing, int id) |
| 2891 : super(name, enclosing, id, STATE_NOT_STARTED); | 2891 : super(name, enclosing, id, STATE_NOT_STARTED); |
| 2892 | 2892 |
| 2893 ClassElement get mixin => mixinType != null ? mixinType.element : null; | 2893 ClassElement get mixin => mixinType != null ? mixinType.element : null; |
| 2894 | 2894 |
| 2895 bool get isMixinApplication => true; | 2895 bool get isMixinApplication => true; |
| 2896 bool get isUnnamedMixinApplication => node is! NamedMixinApplication; | 2896 bool get isUnnamedMixinApplication => node is! NamedMixinApplication; |
| 2897 bool get hasConstructor => !constructors.isEmpty; | 2897 bool get hasConstructor => !constructors.isEmpty; |
| 2898 bool get hasLocalScopeMembers => !constructors.isEmpty; | 2898 bool get hasLocalScopeMembers => !constructors.isEmpty; |
| 2899 | 2899 |
| 2900 get patch => null; | 2900 get patch => null; |
| 2901 get origin => null; | 2901 get origin => null; |
| 2902 | 2902 |
| 2903 bool get hasNode => true; | 2903 bool get hasNode => true; |
| 2904 | 2904 |
| 2905 Token get position => node.getBeginToken(); | 2905 Token get position => node.getBeginToken(); |
| 2906 | 2906 |
| 2907 Node parseNode(Parsing parsing) => node; | 2907 Node parseNode(Parsing parsing) => node; |
| 2908 | 2908 |
| 2909 FunctionElement lookupLocalConstructor(String name) { | |
| 2910 for (Link<Element> link = constructors; | |
| 2911 !link.isEmpty; | |
| 2912 link = link.tail) { | |
| 2913 if (link.head.name == name) return link.head; | |
| 2914 } | |
| 2915 return null; | |
| 2916 } | |
| 2917 | |
| 2918 Element localLookup(String name) { | |
| 2919 Element constructor = lookupLocalConstructor(name); | |
| 2920 if (constructor != null) return constructor; | |
| 2921 if (mixin == null) return null; | |
| 2922 Element mixedInElement = mixin.localLookup(name); | |
| 2923 if (mixedInElement == null) return null; | |
| 2924 return mixedInElement.isInstanceMember ? mixedInElement : null; | |
| 2925 } | |
| 2926 | |
| 2927 void forEachLocalMember(void f(Element member)) { | |
| 2928 constructors.forEach(f); | |
| 2929 if (mixin != null) mixin.forEachLocalMember((Element mixedInElement) { | |
| 2930 if (mixedInElement.isInstanceMember) f(mixedInElement); | |
| 2931 }); | |
| 2932 } | |
| 2933 | |
| 2934 void addMember(Element element, DiagnosticReporter reporter) { | 2909 void addMember(Element element, DiagnosticReporter reporter) { |
| 2935 throw new UnsupportedError("Cannot add member to $this."); | 2910 throw new UnsupportedError("Cannot add member to $this."); |
| 2936 } | 2911 } |
| 2937 | 2912 |
| 2938 void addToScope(Element element, DiagnosticReporter reporter) { | 2913 void addToScope(Element element, DiagnosticReporter reporter) { |
| 2939 reporter.internalError(this, 'Cannot add to scope of $this.'); | 2914 reporter.internalError(this, 'Cannot add to scope of $this.'); |
| 2940 } | 2915 } |
| 2941 | 2916 |
| 2942 void addConstructor(FunctionElement constructor) { | 2917 void addConstructor(FunctionElement constructor) { |
| 2943 constructors = constructors.prepend(constructor); | 2918 constructors = constructors.prepend(constructor); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 AstElement get definingElement; | 3184 AstElement get definingElement; |
| 3210 | 3185 |
| 3211 bool get hasResolvedAst => definingElement.hasTreeElements; | 3186 bool get hasResolvedAst => definingElement.hasTreeElements; |
| 3212 | 3187 |
| 3213 ResolvedAst get resolvedAst { | 3188 ResolvedAst get resolvedAst { |
| 3214 return new ResolvedAst(declaration, | 3189 return new ResolvedAst(declaration, |
| 3215 definingElement.node, definingElement.treeElements); | 3190 definingElement.node, definingElement.treeElements); |
| 3216 } | 3191 } |
| 3217 | 3192 |
| 3218 } | 3193 } |
| OLD | NEW |