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

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

Issue 2110323003: Support serialization of loadLibrary (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: dartfmt Created 4 years, 5 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
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/names.dart' show Identifiers;
8 import '../common/resolution.dart' show Resolution, ParsingContext; 9 import '../common/resolution.dart' show Resolution, ParsingContext;
9 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
10 import '../constants/constant_constructors.dart'; 11 import '../constants/constant_constructors.dart';
11 import '../constants/constructors.dart'; 12 import '../constants/constructors.dart';
12 import '../constants/expressions.dart'; 13 import '../constants/expressions.dart';
13 import '../dart_types.dart'; 14 import '../dart_types.dart';
14 import '../diagnostics/messages.dart' show MessageTemplate; 15 import '../diagnostics/messages.dart' show MessageTemplate;
15 import '../ordered_typeset.dart' show OrderedTypeSet; 16 import '../ordered_typeset.dart' show OrderedTypeSet;
16 import '../resolution/class_members.dart' show ClassMemberMixin; 17 import '../resolution/class_members.dart' show ClassMemberMixin;
17 import '../resolution/scope.dart' 18 import '../resolution/scope.dart'
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 1253
1253 void addImport( 1254 void addImport(
1254 Element element, ImportElement import, DiagnosticReporter reporter) { 1255 Element element, ImportElement import, DiagnosticReporter reporter) {
1255 importScope.addImport(this, element, import, reporter); 1256 importScope.addImport(this, element, import, reporter);
1256 } 1257 }
1257 1258
1258 accept(ElementVisitor visitor, arg) { 1259 accept(ElementVisitor visitor, arg) {
1259 return visitor.visitPrefixElement(this, arg); 1260 return visitor.visitPrefixElement(this, arg);
1260 } 1261 }
1261 1262
1263 @override
1264 GetterElement get loadLibrary {
1265 return isDeferred ? lookupLocalMember(Identifiers.loadLibrary) : null;
1266 }
1267
1262 String toString() => '$kind($name)'; 1268 String toString() => '$kind($name)';
1263 } 1269 }
1264 1270
1265 class TypedefElementX extends ElementX 1271 class TypedefElementX extends ElementX
1266 with 1272 with
1267 AstElementMixin, 1273 AstElementMixin,
1268 AnalyzableElementX, 1274 AnalyzableElementX,
1269 TypeDeclarationElementX<TypedefType> 1275 TypeDeclarationElementX<TypedefType>
1270 implements TypedefElement { 1276 implements TypedefElement {
1271 Typedef cachedNode; 1277 Typedef cachedNode;
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 2253
2248 ClassElement get enclosingClass => enclosingElement; 2254 ClassElement get enclosingClass => enclosingElement;
2249 } 2255 }
2250 2256
2251 class DeferredLoaderGetterElementX extends GetterElementX 2257 class DeferredLoaderGetterElementX extends GetterElementX
2252 implements GetterElement { 2258 implements GetterElement {
2253 final PrefixElement prefix; 2259 final PrefixElement prefix;
2254 2260
2255 DeferredLoaderGetterElementX(PrefixElement prefix) 2261 DeferredLoaderGetterElementX(PrefixElement prefix)
2256 : this.prefix = prefix, 2262 : this.prefix = prefix,
2257 super("loadLibrary", Modifiers.EMPTY, prefix, false) { 2263 super(Identifiers.loadLibrary, Modifiers.EMPTY, prefix, false) {
2258 functionSignature = new FunctionSignatureX(type: new FunctionType(this)); 2264 functionSignature = new FunctionSignatureX(type: new FunctionType(this));
2259 } 2265 }
2260 2266
2261 bool get isClassMember => false; 2267 bool get isClassMember => false;
2262 2268
2263 bool get isSynthesized => true; 2269 bool get isSynthesized => true;
2264 2270
2265 bool get isDeferredLoaderGetter => true; 2271 bool get isDeferredLoaderGetter => true;
2266 2272
2267 bool get isTopLevel => true; 2273 bool get isTopLevel => true;
2274
2268 // By having position null, the enclosing elements location is printed in 2275 // By having position null, the enclosing elements location is printed in
2269 // error messages. 2276 // error messages.
2270 Token get position => null; 2277 Token get position => null;
2271 2278
2272 FunctionExpression parseNode(ParsingContext parsing) => null; 2279 FunctionExpression parseNode(ParsingContext parsing) => null;
2273 2280
2274 bool get hasNode => false; 2281 bool get hasNode => false;
2275 2282
2276 FunctionExpression get node => null; 2283 FunctionExpression get node => null;
2277 2284
2285 bool get hasResolvedAst => true;
2286
2287 ResolvedAst get resolvedAst {
2288 return new SynthesizedResolvedAst(
2289 this, ResolvedAstKind.DEFERRED_LOAD_LIBRARY);
2290 }
2291
2278 @override 2292 @override
2279 SetterElement get setter => null; 2293 SetterElement get setter => null;
2280 } 2294 }
2281 2295
2282 class ConstructorBodyElementX extends BaseFunctionElementX 2296 class ConstructorBodyElementX extends BaseFunctionElementX
2283 implements ConstructorBodyElement { 2297 implements ConstructorBodyElement {
2284 final ResolvedAst _resolvedAst; 2298 final ResolvedAst _resolvedAst;
2285 final ConstructorElement constructor; 2299 final ConstructorElement constructor;
2286 2300
2287 ConstructorBodyElementX( 2301 ConstructorBodyElementX(
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3293 body = node.asFunctionExpression().body; 3307 body = node.asFunctionExpression().body;
3294 } 3308 }
3295 return new ParsedResolvedAst( 3309 return new ParsedResolvedAst(
3296 declaration, 3310 declaration,
3297 node, 3311 node,
3298 body, 3312 body,
3299 definingElement.treeElements, 3313 definingElement.treeElements,
3300 definingElement.compilationUnit.script.resourceUri); 3314 definingElement.compilationUnit.script.resourceUri);
3301 } 3315 }
3302 } 3316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698