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

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

Issue 2060183002: Serialize metadata (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 4 years, 6 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/enqueue.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 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 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 */ 3186 */
3187 ConstantExpression constant; 3187 ConstantExpression constant;
3188 Element annotatedElement; 3188 Element annotatedElement;
3189 int resolutionState; 3189 int resolutionState;
3190 3190
3191 /** 3191 /**
3192 * The beginning token of this annotation, or [:null:] if it is synthetic. 3192 * The beginning token of this annotation, or [:null:] if it is synthetic.
3193 */ 3193 */
3194 Token get beginToken; 3194 Token get beginToken;
3195 3195
3196 Token get endToken;
3197
3196 MetadataAnnotationX([this.resolutionState = STATE_NOT_STARTED]); 3198 MetadataAnnotationX([this.resolutionState = STATE_NOT_STARTED]);
3197 3199
3198 MetadataAnnotation ensureResolved(Resolution resolution) { 3200 MetadataAnnotation ensureResolved(Resolution resolution) {
3199 if (annotatedElement.isClass || annotatedElement.isTypedef) { 3201 if (annotatedElement.isClass || annotatedElement.isTypedef) {
3200 TypeDeclarationElement typeDeclaration = annotatedElement; 3202 TypeDeclarationElement typeDeclaration = annotatedElement;
3201 typeDeclaration.ensureResolved(resolution); 3203 typeDeclaration.ensureResolved(resolution);
3202 } 3204 }
3203 if (resolutionState == STATE_NOT_STARTED) { 3205 if (resolutionState == STATE_NOT_STARTED) {
3204 resolution.resolveMetadataAnnotation(this); 3206 resolution.resolveMetadataAnnotation(this);
3205 } 3207 }
3206 return this; 3208 return this;
3207 } 3209 }
3208 3210
3209 Node parseNode(ParsingContext parsing); 3211 Node parseNode(ParsingContext parsing);
3210 3212
3213 SourceSpan get sourcePosition {
3214 Uri uri = annotatedElement.compilationUnit.script.resourceUri;
3215 return new SourceSpan.fromTokens(uri, beginToken, endToken);
3216 }
3217
3211 String toString() => 'MetadataAnnotation($constant, $resolutionState)'; 3218 String toString() => 'MetadataAnnotation($constant, $resolutionState)';
3212 } 3219 }
3213 3220
3214 /// Metadata annotation on a parameter. 3221 /// Metadata annotation on a parameter.
3215 class ParameterMetadataAnnotation extends MetadataAnnotationX { 3222 class ParameterMetadataAnnotation extends MetadataAnnotationX {
3216 final Metadata metadata; 3223 final Metadata metadata;
3217 3224
3218 ParameterMetadataAnnotation(Metadata this.metadata); 3225 ParameterMetadataAnnotation(Metadata this.metadata);
3219 3226
3220 Node parseNode(ParsingContext parsing) => metadata.expression; 3227 Node parseNode(ParsingContext parsing) => metadata.expression;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 body = node.asFunctionExpression().body; 3293 body = node.asFunctionExpression().body;
3287 } 3294 }
3288 return new ParsedResolvedAst( 3295 return new ParsedResolvedAst(
3289 declaration, 3296 declaration,
3290 node, 3297 node,
3291 body, 3298 body,
3292 definingElement.treeElements, 3299 definingElement.treeElements,
3293 definingElement.compilationUnit.script.resourceUri); 3300 definingElement.compilationUnit.script.resourceUri);
3294 } 3301 }
3295 } 3302 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698