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

Side by Side Diff: pkg/compiler/lib/src/kernel/world_builder.dart

Issue 2632643002: Remove LibraryEntity.libraryName (Closed)
Patch Set: Updated cf. comments. Created 3 years, 10 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/kernel/elements.dart ('k') | pkg/compiler/lib/src/mirrors_used.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart'; 8 import '../common/names.dart';
9 import '../core_types.dart'; 9 import '../core_types.dart';
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 CommonElements get commonElements => _commonElements; 53 CommonElements get commonElements => _commonElements;
54 54
55 LibraryEntity lookupLibrary(Uri uri) { 55 LibraryEntity lookupLibrary(Uri uri) {
56 KLibraryEnv libraryEnv = _env.lookupLibrary(uri); 56 KLibraryEnv libraryEnv = _env.lookupLibrary(uri);
57 return _getLibrary(libraryEnv.library, libraryEnv); 57 return _getLibrary(libraryEnv.library, libraryEnv);
58 } 58 }
59 59
60 KLibrary _getLibrary(ir.Library node, [KLibraryEnv libraryEnv]) { 60 KLibrary _getLibrary(ir.Library node, [KLibraryEnv libraryEnv]) {
61 return _libraryMap.putIfAbsent(node, () { 61 return _libraryMap.putIfAbsent(node, () {
62 _libraryEnvs.add(libraryEnv ?? _env.lookupLibrary(node.importUri)); 62 _libraryEnvs.add(libraryEnv ?? _env.lookupLibrary(node.importUri));
63 return new KLibrary(_libraryMap.length, node.name ?? '${node.importUri}', 63 String name = node.name;
64 node.name ?? node.fileUri ?? '${node.importUri}'); 64 if (name == null) {
65 // Use the file name as script name.
66 String path = node.importUri.path;
67 name = path.substring(path.lastIndexOf('/') + 1);
68 }
69 return new KLibrary(_libraryMap.length, name);
65 }); 70 });
66 } 71 }
67 72
68 ClassEntity lookupClass(KLibrary library, String name) { 73 ClassEntity lookupClass(KLibrary library, String name) {
69 KLibraryEnv libraryEnv = _libraryEnvs[library.libraryIndex]; 74 KLibraryEnv libraryEnv = _libraryEnvs[library.libraryIndex];
70 KClassEnv classEnv = libraryEnv.lookupClass(name); 75 KClassEnv classEnv = libraryEnv.lookupClass(name);
71 return _getClass(classEnv.cls, classEnv); 76 return _getClass(classEnv.cls, classEnv);
72 } 77 }
73 78
74 KClass _getClass(ir.Class node, [KClassEnv classEnv]) { 79 KClass _getClass(ir.Class node, [KClassEnv classEnv]) {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 501 }
497 return builder._getLibrary(library); 502 return builder._getLibrary(library);
498 } 503 }
499 504
500 KLibrary getLibraryForFunction(KFunction function) => 505 KLibrary getLibraryForFunction(KFunction function) =>
501 _getLibrary(function, builder._methodMap); 506 _getLibrary(function, builder._methodMap);
502 507
503 KLibrary getLibraryForField(KField field) => 508 KLibrary getLibraryForField(KField field) =>
504 _getLibrary(field, builder._fieldMap); 509 _getLibrary(field, builder._fieldMap);
505 } 510 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/elements.dart ('k') | pkg/compiler/lib/src/mirrors_used.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698