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

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

Issue 1967073002: Check closure data for serialization (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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/resolution.dart' show Resolution, ParsingContext; 8 import '../common/resolution.dart' show Resolution, ParsingContext;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constant_constructors.dart'; 10 import '../constants/constant_constructors.dart';
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 bool get hasNode => false; 2277 bool get hasNode => false;
2278 2278
2279 FunctionExpression get node => null; 2279 FunctionExpression get node => null;
2280 2280
2281 @override 2281 @override
2282 SetterElement get setter => null; 2282 SetterElement get setter => null;
2283 } 2283 }
2284 2284
2285 class ConstructorBodyElementX extends BaseFunctionElementX 2285 class ConstructorBodyElementX extends BaseFunctionElementX
2286 implements ConstructorBodyElement { 2286 implements ConstructorBodyElement {
2287 ConstructorElementX constructor; 2287 final ResolvedAst _resolvedAst;
2288 final ConstructorElement constructor;
2288 2289
2289 ConstructorBodyElementX(ConstructorElementX constructor) 2290 ConstructorBodyElementX(
2290 : this.constructor = constructor, 2291 ResolvedAst resolvedAst, ConstructorElement constructor)
2292 : this._resolvedAst = resolvedAst,
2293 this.constructor = constructor,
2291 super(constructor.name, ElementKind.GENERATIVE_CONSTRUCTOR_BODY, 2294 super(constructor.name, ElementKind.GENERATIVE_CONSTRUCTOR_BODY,
2292 Modifiers.EMPTY, constructor.enclosingElement) { 2295 Modifiers.EMPTY, constructor.enclosingElement) {
2293 functionSignature = constructor.functionSignature; 2296 functionSignature = constructor.functionSignature;
2294 } 2297 }
2295 2298
2296 bool get hasNode => constructor.hasNode; 2299 bool get hasNode => _resolvedAst.kind == ResolvedAstKind.PARSED;
2297 2300
2298 FunctionExpression get node => constructor.node; 2301 FunctionExpression get node => _resolvedAst.node;
2302
2303 ResolvedAst get resolvedAst {
2304 if (_resolvedAst.kind == ResolvedAstKind.PARSED) {
2305 return new ParsedResolvedAst(declaration, _resolvedAst.node,
2306 _resolvedAst.body, _resolvedAst.elements, _resolvedAst.sourceUri);
2307 } else {
2308 return new SynthesizedResolvedAst(declaration, _resolvedAst.kind);
2309 }
2310 }
2299 2311
2300 List<MetadataAnnotation> get metadata => constructor.metadata; 2312 List<MetadataAnnotation> get metadata => constructor.metadata;
2301 2313
2302 bool get isInstanceMember => true; 2314 bool get isInstanceMember => true;
2303 2315
2304 FunctionType computeType(Resolution resolution) { 2316 FunctionType computeType(Resolution resolution) {
2305 DiagnosticReporter reporter = resolution.reporter; 2317 DiagnosticReporter reporter = resolution.reporter;
2306 reporter.internalError(this, '$this.computeType.'); 2318 reporter.internalError(this, '$this.computeType.');
2307 return null; 2319 return null;
2308 } 2320 }
2309 2321
2322 int get sourceOffset => constructor.sourceOffset;
2323
2310 Token get position => constructor.position; 2324 Token get position => constructor.position;
2311 2325
2312 Element get outermostEnclosingMemberOrTopLevel => constructor; 2326 Element get outermostEnclosingMemberOrTopLevel => constructor;
2313 2327
2314 Element get analyzableElement => constructor.analyzableElement; 2328 Element get analyzableElement => constructor.analyzableElement;
2315 2329
2316 accept(ElementVisitor visitor, arg) { 2330 accept(ElementVisitor visitor, arg) {
2317 return visitor.visitConstructorBodyElement(this, arg); 2331 return visitor.visitConstructorBodyElement(this, arg);
2318 } 2332 }
2319 2333
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 body = node.asFunctionExpression().body; 3282 body = node.asFunctionExpression().body;
3269 } 3283 }
3270 return new ParsedResolvedAst( 3284 return new ParsedResolvedAst(
3271 declaration, 3285 declaration,
3272 node, 3286 node,
3273 body, 3287 body,
3274 definingElement.treeElements, 3288 definingElement.treeElements,
3275 definingElement.compilationUnit.script.resourceUri); 3289 definingElement.compilationUnit.script.resourceUri);
3276 } 3290 }
3277 } 3291 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698