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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirrors.dart

Issue 296463003: Handle metadata on nested function parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comment. Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.mirrors; 5 library dart2js.mirrors;
6 6
7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView; 7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView;
8 8
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../scanner/scannerlib.dart'; 10 import '../scanner/scannerlib.dart';
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 /// Return the compilation units comprising [library]. 469 /// Return the compilation units comprising [library].
470 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { 470 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) {
471 return library._element.compilationUnits.toList().map( 471 return library._element.compilationUnits.toList().map(
472 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); 472 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList();
473 } 473 }
474 474
475 static Iterable metadataSyntaxOf(Dart2JsElementMirror declaration) { 475 static Iterable metadataSyntaxOf(Dart2JsElementMirror declaration) {
476 Compiler compiler = declaration.mirrorSystem.compiler; 476 Compiler compiler = declaration.mirrorSystem.compiler;
477 return declaration._element.metadata.toList().map((metadata) { 477 return declaration._element.metadata.toList().map((metadata) {
478 var node = metadata.parseNode(compiler); 478 var node = metadata.parseNode(compiler);
479 Element annotatedElement = metadata.annotatedElement; 479 var treeElements = metadata.annotatedElement.treeElements;
480 var context = annotatedElement.enclosingElement;
481 if (context == null) {
482 context = annotatedElement;
483 }
484 return new ResolvedNode( 480 return new ResolvedNode(
485 node, context.treeElements, declaration.mirrorSystem); 481 node, treeElements, declaration.mirrorSystem);
486 }); 482 });
487 } 483 }
488 484
489 static ResolvedNode initializerSyntaxOf(Dart2JsFieldMirror variable) { 485 static ResolvedNode initializerSyntaxOf(Dart2JsFieldMirror variable) {
490 var node = variable._variable.initializer; 486 var node = variable._variable.initializer;
491 if (node == null) return null; 487 if (node == null) return null;
492 return new ResolvedNode( 488 return new ResolvedNode(
493 node, variable._variable.treeElements, variable.mirrorSystem); 489 node, variable._variable.treeElements, variable.mirrorSystem);
494 } 490 }
495 491
496 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) { 492 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) {
497 if (!parameter.hasDefaultValue) return null; 493 if (!parameter.hasDefaultValue) return null;
498 var node = parameter._element.initializer; 494 var node = parameter._element.initializer;
499 return new ResolvedNode(node, 495 var treeElements = parameter._element.treeElements;
500 (parameter.owner as Dart2JsElementMirror)._element.treeElements, 496 return new ResolvedNode(node, treeElements, parameter.mirrorSystem);
501 parameter.mirrorSystem);
502 } 497 }
503 } 498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698