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

Side by Side Diff: pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Issue 2895983002: Read SDK and patches from a JSON file. (Closed)
Patch Set: Merged with 1333f97b9a0e3805f991578ef83b0ec4553ecf33 Created 3 years, 7 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.source_library_builder; 5 library fasta.source_library_builder;
6 6
7 import 'package:front_end/src/scanner/token.dart' show Token; 7 import 'package:front_end/src/scanner/token.dart' show Token;
8 8
9 import 'package:front_end/src/fasta/scanner/token.dart' show SymbolToken; 9 import 'package:front_end/src/fasta/scanner/token.dart' show SymbolToken;
10 10
11 import 'package:kernel/ast.dart' show ProcedureKind; 11 import 'package:kernel/ast.dart' show ProcedureKind;
12 12
13 import '../../base/resolve_relative_uri.dart' show resolveRelativeUri;
14
13 import '../combinator.dart' show Combinator; 15 import '../combinator.dart' show Combinator;
14 16
15 import '../errors.dart' show inputError, internalError; 17 import '../errors.dart' show inputError, internalError;
16 18
17 import '../export.dart' show Export; 19 import '../export.dart' show Export;
18 20
19 import '../import.dart' show Import; 21 import '../import.dart' show Import;
20 22
21 import 'source_loader.dart' show SourceLoader; 23 import 'source_loader.dart' show SourceLoader;
22 24
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 SourceLibraryBuilder.fromScopes( 82 SourceLibraryBuilder.fromScopes(
81 this.loader, this.fileUri, this.libraryDeclaration, this.importScope) 83 this.loader, this.fileUri, this.libraryDeclaration, this.importScope)
82 : currentDeclaration = libraryDeclaration, 84 : currentDeclaration = libraryDeclaration,
83 super( 85 super(
84 fileUri, libraryDeclaration.toScope(importScope), new Scope.top()); 86 fileUri, libraryDeclaration.toScope(importScope), new Scope.top());
85 87
86 Uri get uri; 88 Uri get uri;
87 89
88 bool get isPart => partOfName != null || partOfUri != null; 90 bool get isPart => partOfName != null || partOfUri != null;
89 91
92 bool get isPatch;
93
90 List<T> get types => libraryDeclaration.types; 94 List<T> get types => libraryDeclaration.types;
91 95
92 T addNamedType(String name, List<T> arguments, int charOffset); 96 T addNamedType(String name, List<T> arguments, int charOffset);
93 97
94 T addMixinApplication(T supertype, List<T> mixins, int charOffset); 98 T addMixinApplication(T supertype, List<T> mixins, int charOffset);
95 99
96 T addType(T type) { 100 T addType(T type) {
97 currentDeclaration.addType(type); 101 currentDeclaration.addType(type);
98 return type; 102 return type;
99 } 103 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 prefix, 147 prefix,
144 combinators, 148 combinators,
145 charOffset, 149 charOffset,
146 prefixCharOffset)); 150 prefixCharOffset));
147 } 151 }
148 152
149 void addPart(List<MetadataBuilder> metadata, String path) { 153 void addPart(List<MetadataBuilder> metadata, String path) {
150 Uri resolvedUri; 154 Uri resolvedUri;
151 Uri newFileUri; 155 Uri newFileUri;
152 if (uri.scheme == "dart") { 156 if (uri.scheme == "dart") {
153 resolvedUri = new Uri(scheme: "dart", path: "${uri.path}/$path"); 157 resolvedUri = resolveRelativeUri(uri, Uri.parse(path));
154 newFileUri = fileUri.resolve(path); 158 newFileUri = fileUri.resolve(path);
155 } else { 159 } else {
156 resolvedUri = uri.resolve(path); 160 resolvedUri = uri.resolve(path);
157 161 if (uri.scheme != "package") {
158 // TODO(ahe): This is wrong for package URIs. 162 newFileUri = fileUri.resolve(path);
159 newFileUri = fileUri.resolve(path); 163 }
160 } 164 }
161 parts 165 parts
162 .add(loader.read(resolvedUri, -1, fileUri: newFileUri, accessor: this)); 166 .add(loader.read(resolvedUri, -1, fileUri: newFileUri, accessor: this));
163 } 167 }
164 168
165 void addPartOf(List<MetadataBuilder> metadata, String name, String uri) { 169 void addPartOf(List<MetadataBuilder> metadata, String name, String uri) {
166 partOfName = name; 170 partOfName = name;
167 partOfUri = uri == null ? null : this.uri.resolve(uri); 171 partOfUri = uri == null ? null : this.uri.resolve(uri);
168 } 172 }
169 173
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 /// synthesize type variables on the factory matching the class'. 571 /// synthesize type variables on the factory matching the class'.
568 void addFactoryDeclaration( 572 void addFactoryDeclaration(
569 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { 573 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) {
570 factoryDeclarations[procedure] = factoryDeclaration; 574 factoryDeclarations[procedure] = factoryDeclaration;
571 } 575 }
572 576
573 Scope toScope(Scope parent) { 577 Scope toScope(Scope parent) {
574 return new Scope(members, setters, parent, isModifiable: false); 578 return new Scope(members, setters, parent, isModifiable: false);
575 } 579 }
576 } 580 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/outline_builder.dart ('k') | pkg/front_end/lib/src/fasta/target_implementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698