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

Side by Side Diff: pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart

Issue 11170005: Private constructors handled as private. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/mirrors_helper.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) 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('mirrors.dart2js'); 5 #library('mirrors.dart2js');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 #import('dart:uri'); 8 #import('dart:uri');
9 9
10 #import('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); 10 #import('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics');
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 String path = _library.uri.path; 501 String path = _library.uri.path;
502 return path.substring(path.lastIndexOf('/') + 1); 502 return path.substring(path.lastIndexOf('/') + 1);
503 } 503 }
504 } 504 }
505 505
506 String get qualifiedName => simpleName; 506 String get qualifiedName => simpleName;
507 507
508 void _ensureTypes() { 508 void _ensureTypes() {
509 if (_types == null) { 509 if (_types == null) {
510 _types = <String, InterfaceMirror>{}; 510 _types = <String, InterfaceMirror>{};
511 _library.forEachExport((Element e) { 511 _library.forEachLocalMember((Element e) {
512 if (e.getLibrary() == _library) { 512 if (e.isClass()) {
513 if (e.isClass()) { 513 e.ensureResolved(system.compiler);
514 e.ensureResolved(system.compiler); 514 var type = new Dart2JsInterfaceMirror.fromLibrary(this, e);
515 var type = new Dart2JsInterfaceMirror.fromLibrary(this, e); 515 assert(invariant(_library, !_types.containsKey(type.simpleName),
516 assert(invariant(_library, !_types.containsKey(type.simpleName), 516 message: "Type name '${type.simpleName}' "
517 message: "Type name '${type.simpleName}' " 517 "is not unique in $_library."));
518 "is not unique in $_library.")); 518 _types[type.simpleName] = type;
519 _types[type.simpleName] = type; 519 } else if (e.isTypedef()) {
520 } else if (e.isTypedef()) { 520 var type = new Dart2JsTypedefMirror.fromLibrary(this,
521 var type = new Dart2JsTypedefMirror.fromLibrary(this, 521 e.computeType(system.compiler));
522 e.computeType(system.compiler)); 522 assert(invariant(_library, !_types.containsKey(type.simpleName),
523 assert(invariant(_library, !_types.containsKey(type.simpleName), 523 message: "Type name '${type.simpleName}' "
524 message: "Type name '${type.simpleName}' " 524 "is not unique in $_library."));
525 "is not unique in $_library.")); 525 _types[type.simpleName] = type;
526 _types[type.simpleName] = type;
527 }
528 } 526 }
529 }); 527 });
530 } 528 }
531 } 529 }
532 530
533 void _ensureMembers() { 531 void _ensureMembers() {
534 if (_members == null) { 532 if (_members == null) {
535 _members = <String, MemberMirror>{}; 533 _members = <String, MemberMirror>{};
536 _library.forEachExport((Element e) { 534 _library.forEachLocalMember((Element e) {
537 if (!e.isClass() && !e.isTypedef()) { 535 if (!e.isClass() && !e.isTypedef()) {
538 for (var member in _convertElementMemberToMemberMirrors(this, e)) { 536 for (var member in _convertElementMemberToMemberMirrors(this, e)) {
539 assert(!_members.containsKey(member.simpleName)); 537 assert(!_members.containsKey(member.simpleName));
540 _members[member.simpleName] = member; 538 _members[member.simpleName] = member;
541 } 539 }
542 } 540 }
543 }); 541 });
544 } 542 }
545 } 543 }
546 544
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 1296
1299 bool get isTopLevel => _objectMirror is LibraryMirror; 1297 bool get isTopLevel => _objectMirror is LibraryMirror;
1300 1298
1301 bool get isConstructor 1299 bool get isConstructor
1302 => _kind == Dart2JsMethodKind.CONSTRUCTOR || isConst || isFactory; 1300 => _kind == Dart2JsMethodKind.CONSTRUCTOR || isConst || isFactory;
1303 1301
1304 bool get isField => false; 1302 bool get isField => false;
1305 1303
1306 bool get isMethod => !isConstructor; 1304 bool get isMethod => !isConstructor;
1307 1305
1308 bool get isPrivate => _isPrivate(simpleName); 1306 bool get isPrivate =>
1307 isConstructor ? _isPrivate(constructorName) : _isPrivate(simpleName);
1309 1308
1310 bool get isStatic => _function.modifiers.isStatic(); 1309 bool get isStatic => _function.modifiers.isStatic();
1311 1310
1312 List<ParameterMirror> get parameters { 1311 List<ParameterMirror> get parameters {
1313 return _parametersFromFunctionSignature(system, this, 1312 return _parametersFromFunctionSignature(system, this,
1314 _function.computeSignature(system.compiler)); 1313 _function.computeSignature(system.compiler));
1315 } 1314 }
1316 1315
1317 TypeMirror get returnType => _convertTypeToTypeMirror( 1316 TypeMirror get returnType => _convertTypeToTypeMirror(
1318 system, _function.computeSignature(system.compiler).returnType, 1317 system, _function.computeSignature(system.compiler).returnType,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 if (node !== null) { 1387 if (node !== null) {
1389 var span = system.compiler.spanFromNode(node, script.uri); 1388 var span = system.compiler.spanFromNode(node, script.uri);
1390 return new Dart2JsLocation(script, span); 1389 return new Dart2JsLocation(script, span);
1391 } else { 1390 } else {
1392 var span = system.compiler.spanFromElement(_variable); 1391 var span = system.compiler.spanFromElement(_variable);
1393 return new Dart2JsLocation(script, span); 1392 return new Dart2JsLocation(script, span);
1394 } 1393 }
1395 } 1394 }
1396 } 1395 }
1397 1396
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/mirrors_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698