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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.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/elements/entities.dart ('k') | pkg/compiler/lib/src/elements/names.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 elements.modelx; 5 library elements.modelx;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Identifiers; 8 import '../common/names.dart' show Identifiers;
9 import '../common/resolution.dart' show Resolution, ParsingContext; 9 import '../common/resolution.dart' show Resolution, ParsingContext;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 }); 1218 });
1219 } 1219 }
1220 1220
1221 bool get hasLibraryName => libraryTag != null; 1221 bool get hasLibraryName => libraryTag != null;
1222 1222
1223 String get libraryName { 1223 String get libraryName {
1224 if (libraryTag == null) return ''; 1224 if (libraryTag == null) return '';
1225 return libraryTag.name.toString(); 1225 return libraryTag.name.toString();
1226 } 1226 }
1227 1227
1228 String get libraryOrScriptName {
1229 if (libraryTag != null) {
1230 return libraryTag.name.toString();
1231 } else {
1232 // Use the file name as script name.
1233 String path = canonicalUri.path;
1234 return path.substring(path.lastIndexOf('/') + 1);
1235 }
1236 }
1237
1238 Scope buildScope() => new LibraryScope(this); 1228 Scope buildScope() => new LibraryScope(this);
1239 1229
1240 String toString() { 1230 String toString() {
1241 if (origin != null) { 1231 if (origin != null) {
1242 return 'patch library(${canonicalUri})'; 1232 return 'patch library(${canonicalUri})';
1243 } else if (patch != null) { 1233 } else if (patch != null) {
1244 return 'origin library(${canonicalUri})'; 1234 return 'origin library(${canonicalUri})';
1245 } else { 1235 } else {
1246 return 'library(${canonicalUri})'; 1236 return 'library(${canonicalUri})';
1247 } 1237 }
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 body = node.asFunctionExpression().body; 3460 body = node.asFunctionExpression().body;
3471 } 3461 }
3472 return new ParsedResolvedAst( 3462 return new ParsedResolvedAst(
3473 declaration, 3463 declaration,
3474 node, 3464 node,
3475 body, 3465 body,
3476 definingElement.treeElements, 3466 definingElement.treeElements,
3477 definingElement.compilationUnit.script.resourceUri); 3467 definingElement.compilationUnit.script.resourceUri);
3478 } 3468 }
3479 } 3469 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/entities.dart ('k') | pkg/compiler/lib/src/elements/names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698