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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 1811173003: Support per-library serialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/ordered_typeset.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 '../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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/ordered_typeset.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698