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

Side by Side Diff: pkg/compiler/lib/src/script.dart

Issue 1819053002: Split loader from the rest of the compiler. This adds several abstractions to (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add environment.dart Created 4 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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.script; 5 library dart2js.script;
6 6
7 import 'io/source_file.dart'; 7 import 'io/source_file.dart';
8 8
9 class Script { 9 class Script {
10 final SourceFile file; 10 final SourceFile file;
11 11
12 /** 12 /**
13 * The readable URI from which this script was loaded. 13 * The readable URI from which this script was loaded.
14 * 14 *
15 * See [LibraryLoader] for terminology on URIs. 15 * See [LibraryLoader] for terminology on URIs.
16 */ 16 */
17 final Uri readableUri; 17 final Uri readableUri;
18 18
19 19
20 /** 20 /**
21 * The resource URI from which this script was loaded. 21 * The resource URI from which this script was loaded.
22 * 22 *
23 * See [LibraryLoader] for terminology on URIs. 23 * See [LibraryLoader] for terminology on URIs.
24 */ 24 */
25 final Uri resourceUri; 25 final Uri resourceUri;
26 26
27 /// This script was synthesized. 27 /// This script was synthesized.
28 final bool isSynthesized; 28 final bool isSynthesized;
29 29
30 Script( 30 Script(this.readableUri, this.resourceUri, this.file)
31 this.readableUri, this.resourceUri, this.file, 31 : isSynthesized = false;
32 {this.isSynthesized: false}); 32
33 Script.synthetic(Uri uri)
34 : readableUri = uri,
35 resourceUri = uri,
36 file = new StringSourceFile.fromUri(uri,
37 "// Synthetic source file generated for '$uri'."),
38 isSynthesized = true;
33 39
34 String get text => (file == null) ? null : file.slowText(); 40 String get text => (file == null) ? null : file.slowText();
35 String get name => (file == null) ? null : file.filename; 41 String get name => (file == null) ? null : file.filename;
36 42
37 /// Creates a new [Script] with the same URIs, but new content ([file]). 43 /// Creates a new [Script] with the same URIs, but new content ([file]).
38 Script copyWithFile(SourceFile file) { 44 Script copyWithFile(SourceFile file) {
39 return new Script(readableUri, resourceUri, file); 45 return new Script(readableUri, resourceUri, file);
40 } 46 }
41 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698