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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 DeclarationBuilder<T> endNestedDeclaration() { | 115 DeclarationBuilder<T> endNestedDeclaration() { |
116 DeclarationBuilder<T> previous = currentDeclaration; | 116 DeclarationBuilder<T> previous = currentDeclaration; |
117 currentDeclaration = currentDeclaration.parent; | 117 currentDeclaration = currentDeclaration.parent; |
118 return previous; | 118 return previous; |
119 } | 119 } |
120 | 120 |
121 Uri resolve(String path) => uri.resolve(path); | 121 Uri resolve(String path) => uri.resolve(path); |
122 | 122 |
123 void addExport(List<MetadataBuilder> metadata, String uri, | 123 void addExport(List<MetadataBuilder> metadata, String uri, |
124 Unhandled conditionalUris, List<Combinator> combinators, int charOffset) { | 124 Unhandled conditionalUris, List<Combinator> combinators, int charOffset) { |
125 loader.read(resolve(uri)).addExporter(this, combinators, charOffset); | 125 loader |
| 126 .read(resolve(uri), charOffset, accessor: this) |
| 127 .addExporter(this, combinators, charOffset); |
126 } | 128 } |
127 | 129 |
128 void addImport( | 130 void addImport( |
129 List<MetadataBuilder> metadata, | 131 List<MetadataBuilder> metadata, |
130 String uri, | 132 String uri, |
131 Unhandled conditionalUris, | 133 Unhandled conditionalUris, |
132 String prefix, | 134 String prefix, |
133 List<Combinator> combinators, | 135 List<Combinator> combinators, |
134 bool deferred, | 136 bool deferred, |
135 int charOffset, | 137 int charOffset, |
136 int prefixCharOffset) { | 138 int prefixCharOffset) { |
137 imports.add(new Import(this, loader.read(resolve(uri)), deferred, prefix, | 139 imports.add(new Import( |
138 combinators, charOffset, prefixCharOffset)); | 140 this, |
| 141 loader.read(resolve(uri), charOffset, accessor: this), |
| 142 deferred, |
| 143 prefix, |
| 144 combinators, |
| 145 charOffset, |
| 146 prefixCharOffset)); |
139 } | 147 } |
140 | 148 |
141 void addPart(List<MetadataBuilder> metadata, String path) { | 149 void addPart(List<MetadataBuilder> metadata, String path) { |
142 Uri resolvedUri; | 150 Uri resolvedUri; |
143 Uri newFileUri; | 151 Uri newFileUri; |
144 if (uri.scheme == "dart") { | 152 if (uri.scheme == "dart") { |
145 resolvedUri = new Uri(scheme: "dart", path: "${uri.path}/$path"); | 153 resolvedUri = new Uri(scheme: "dart", path: "${uri.path}/$path"); |
146 newFileUri = fileUri.resolve(path); | 154 newFileUri = fileUri.resolve(path); |
147 } else { | 155 } else { |
148 resolvedUri = uri.resolve(path); | 156 resolvedUri = uri.resolve(path); |
| 157 |
| 158 // TODO(ahe): This is wrong for package URIs. |
149 newFileUri = fileUri.resolve(path); | 159 newFileUri = fileUri.resolve(path); |
150 } | 160 } |
151 parts.add(loader.read(resolvedUri, newFileUri)); | 161 parts |
| 162 .add(loader.read(resolvedUri, -1, fileUri: newFileUri, accessor: this)); |
152 } | 163 } |
153 | 164 |
154 void addPartOf(List<MetadataBuilder> metadata, String name, String uri) { | 165 void addPartOf(List<MetadataBuilder> metadata, String name, String uri) { |
155 partOfName = name; | 166 partOfName = name; |
156 partOfUri = uri == null ? null : this.uri.resolve(uri); | 167 partOfUri = uri == null ? null : this.uri.resolve(uri); |
157 } | 168 } |
158 | 169 |
159 void addClass( | 170 void addClass( |
160 List<MetadataBuilder> metadata, | 171 List<MetadataBuilder> metadata, |
161 int modifiers, | 172 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'. | 567 /// synthesize type variables on the factory matching the class'. |
557 void addFactoryDeclaration( | 568 void addFactoryDeclaration( |
558 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 569 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
559 factoryDeclarations[procedure] = factoryDeclaration; | 570 factoryDeclarations[procedure] = factoryDeclaration; |
560 } | 571 } |
561 | 572 |
562 Scope toScope(Scope parent) { | 573 Scope toScope(Scope parent) { |
563 return new Scope(members, setters, parent, isModifiable: false); | 574 return new Scope(members, setters, parent, isModifiable: false); |
564 } | 575 } |
565 } | 576 } |
OLD | NEW |