OLD | NEW |
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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 SourceLibraryBuilder.fromScopes( | 80 SourceLibraryBuilder.fromScopes( |
81 this.loader, this.fileUri, this.libraryDeclaration, this.importScope) | 81 this.loader, this.fileUri, this.libraryDeclaration, this.importScope) |
82 : currentDeclaration = libraryDeclaration, | 82 : currentDeclaration = libraryDeclaration, |
83 super( | 83 super( |
84 fileUri, libraryDeclaration.toScope(importScope), new Scope.top()); | 84 fileUri, libraryDeclaration.toScope(importScope), new Scope.top()); |
85 | 85 |
86 Uri get uri; | 86 Uri get uri; |
87 | 87 |
88 bool get isPart => partOfName != null || partOfUri != null; | 88 bool get isPart => partOfName != null || partOfUri != null; |
89 | 89 |
| 90 bool get isPatch; |
| 91 |
90 List<T> get types => libraryDeclaration.types; | 92 List<T> get types => libraryDeclaration.types; |
91 | 93 |
92 T addNamedType(String name, List<T> arguments, int charOffset); | 94 T addNamedType(String name, List<T> arguments, int charOffset); |
93 | 95 |
94 T addMixinApplication(T supertype, List<T> mixins, int charOffset); | 96 T addMixinApplication(T supertype, List<T> mixins, int charOffset); |
95 | 97 |
96 T addType(T type) { | 98 T addType(T type) { |
97 currentDeclaration.addType(type); | 99 currentDeclaration.addType(type); |
98 return type; | 100 return type; |
99 } | 101 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void addPart(List<MetadataBuilder> metadata, String path) { | 143 void addPart(List<MetadataBuilder> metadata, String path) { |
142 Uri resolvedUri; | 144 Uri resolvedUri; |
143 Uri newFileUri; | 145 Uri newFileUri; |
144 if (uri.scheme == "dart") { | 146 if (uri.scheme == "dart") { |
145 resolvedUri = new Uri(scheme: "dart", path: "${uri.path}/$path"); | 147 resolvedUri = new Uri(scheme: "dart", path: "${uri.path}/$path"); |
146 newFileUri = fileUri.resolve(path); | 148 newFileUri = fileUri.resolve(path); |
147 } else { | 149 } else { |
148 resolvedUri = uri.resolve(path); | 150 resolvedUri = uri.resolve(path); |
149 newFileUri = fileUri.resolve(path); | 151 newFileUri = fileUri.resolve(path); |
150 } | 152 } |
151 parts.add(loader.read(resolvedUri, newFileUri)); | 153 parts.add(loader.read(resolvedUri, fileUri: newFileUri)); |
152 } | 154 } |
153 | 155 |
154 void addPartOf(List<MetadataBuilder> metadata, String name, String uri) { | 156 void addPartOf(List<MetadataBuilder> metadata, String name, String uri) { |
155 partOfName = name; | 157 partOfName = name; |
156 partOfUri = uri == null ? null : this.uri.resolve(uri); | 158 partOfUri = uri == null ? null : this.uri.resolve(uri); |
157 } | 159 } |
158 | 160 |
159 void addClass( | 161 void addClass( |
160 List<MetadataBuilder> metadata, | 162 List<MetadataBuilder> metadata, |
161 int modifiers, | 163 int modifiers, |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 /// synthesize type variables on the factory matching the class'. | 558 /// synthesize type variables on the factory matching the class'. |
557 void addFactoryDeclaration( | 559 void addFactoryDeclaration( |
558 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 560 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
559 factoryDeclarations[procedure] = factoryDeclaration; | 561 factoryDeclarations[procedure] = factoryDeclaration; |
560 } | 562 } |
561 | 563 |
562 Scope toScope(Scope parent) { | 564 Scope toScope(Scope parent) { |
563 return new Scope(members, setters, parent, isModifiable: false); | 565 return new Scope(members, setters, parent, isModifiable: false); |
564 } | 566 } |
565 } | 567 } |
OLD | NEW |