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

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

Issue 297903004: Revert "Handle metadata on nested function parameters." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 var treeElements = metadata.annotatedElement.treeElements; 479 Element annotatedElement = metadata.annotatedElement;
480 var context = annotatedElement.enclosingElement;
481 if (context == null) {
482 context = annotatedElement;
483 }
480 return new ResolvedNode( 484 return new ResolvedNode(
481 node, treeElements, declaration.mirrorSystem); 485 node, context.treeElements, declaration.mirrorSystem);
482 }); 486 });
483 } 487 }
484 488
485 static ResolvedNode initializerSyntaxOf(Dart2JsFieldMirror variable) { 489 static ResolvedNode initializerSyntaxOf(Dart2JsFieldMirror variable) {
486 var node = variable._variable.initializer; 490 var node = variable._variable.initializer;
487 if (node == null) return null; 491 if (node == null) return null;
488 return new ResolvedNode( 492 return new ResolvedNode(
489 node, variable._variable.treeElements, variable.mirrorSystem); 493 node, variable._variable.treeElements, variable.mirrorSystem);
490 } 494 }
491 495
492 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) { 496 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) {
493 if (!parameter.hasDefaultValue) return null; 497 if (!parameter.hasDefaultValue) return null;
494 var node = parameter._element.initializer; 498 var node = parameter._element.initializer;
495 var treeElements = parameter._element.treeElements; 499 return new ResolvedNode(node,
496 return new ResolvedNode(node, treeElements, parameter.mirrorSystem); 500 (parameter.owner as Dart2JsElementMirror)._element.treeElements,
501 parameter.mirrorSystem);
497 } 502 }
498 } 503 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698