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

Side by Side Diff: lib/src/mirror_loader.dart

Issue 1006513003: make sure we follow the whole super chain (Closed) Base URL: git@github.com:dart-lang/static-init.git@master
Patch Set: format Created 5 years, 9 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 | « CHANGELOG.md ('k') | lib/transformer.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library initialize.mirror_loader; 4 library initialize.mirror_loader;
5 5
6 import 'dart:collection' show Queue; 6 import 'dart:collection' show Queue;
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'package:path/path.dart' as path; 8 import 'package:path/path.dart' as path;
9 import 'package:initialize/initialize.dart'; 9 import 'package:initialize/initialize.dart';
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 return queue; 123 return queue;
124 } 124 }
125 125
126 Iterable<DeclarationMirror> _sortedDeclarationsWithMetadata( 126 Iterable<DeclarationMirror> _sortedDeclarationsWithMetadata(
127 LibraryMirror lib) { 127 LibraryMirror lib) {
128 return new List() 128 return new List()
129 ..addAll(_sortDeclarations( 129 ..addAll(_sortDeclarations(lib, lib.declarations.values
130 lib, lib.declarations.values.where( 130 .where((d) => d is MethodMirror && d.metadata.isNotEmpty)))
131 (d) => d is MethodMirror && d.metadata.isNotEmpty))) 131 ..addAll(_sortDeclarations(lib, lib.declarations.values
132 ..addAll(_sortDeclarations( 132 .where((d) => d is ClassMirror && d.metadata.isNotEmpty)));
133 lib, lib.declarations.values.where(
134 (d) => d is ClassMirror && d.metadata.isNotEmpty)));
135 } 133 }
136 134
137 List<DeclarationMirror> _sortDeclarations( 135 List<DeclarationMirror> _sortDeclarations(
138 LibraryMirror sourceLib, Iterable<DeclarationMirror> declarations) { 136 LibraryMirror sourceLib, Iterable<DeclarationMirror> declarations) {
139 var declarationList = declarations.toList(); 137 var declarationList = declarations.toList();
140 declarationList.sort((DeclarationMirror a, DeclarationMirror b) { 138 declarationList.sort((DeclarationMirror a, DeclarationMirror b) {
141 // If in the same file, compare by line. 139 // If in the same file, compare by line.
142 var aSourceUri = a.location.sourceUri; 140 var aSourceUri = a.location.sourceUri;
143 var bSourceUri = b.location.sourceUri; 141 var bSourceUri = b.location.sourceUri;
144 if (aSourceUri == bSourceUri) { 142 if (aSourceUri == bSourceUri) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return true; 239 return true;
242 } 240 }
243 } 241 }
244 242
245 final _TOP_LEVEL_FUNCTIONS_ONLY = new UnsupportedError( 243 final _TOP_LEVEL_FUNCTIONS_ONLY = new UnsupportedError(
246 'Only top level methods are supported for initializers'); 244 'Only top level methods are supported for initializers');
247 245
248 final _UNSUPPORTED_DECLARATION = new UnsupportedError( 246 final _UNSUPPORTED_DECLARATION = new UnsupportedError(
249 'Initializers are only supported on libraries, classes, and top level ' 247 'Initializers are only supported on libraries, classes, and top level '
250 'methods'); 248 'methods');
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698