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

Side by Side Diff: pkg/front_end/lib/src/fasta/builder/prefix_builder.dart

Issue 2788913002: Prepare for separate setter scope. (Closed)
Patch Set: Address comments. Created 3 years, 8 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.prefix_builder; 5 library fasta.prefix_builder;
6 6
7 import 'package:kernel/ast.dart' show Member; 7 import 'package:kernel/ast.dart' show Member;
8 8
9 import '../dill/dill_member_builder.dart' show DillMemberBuilder; 9 import '../dill/dill_member_builder.dart' show DillMemberBuilder;
10 10
11 import '../errors.dart' show internalError; 11 import '../errors.dart' show internalError;
12 12
13 import '../messages.dart' show warning; 13 import '../messages.dart' show warning;
14 14
15 import 'builder.dart' show Builder, LibraryBuilder, MemberBuilder; 15 import 'builder.dart' show Builder, LibraryBuilder, MemberBuilder;
16 16
17 class PrefixBuilder extends Builder { 17 class PrefixBuilder extends Builder {
18 final String name; 18 final String name;
19 19
20 final Map<String, Builder> exports; 20 final Map<String, Builder> exports;
21 21
22 final LibraryBuilder parent; 22 final LibraryBuilder parent;
23 23
24 PrefixBuilder(this.name, this.exports, LibraryBuilder parent, int charOffset) 24 PrefixBuilder(this.name, this.exports, LibraryBuilder parent, int charOffset)
25 : parent = parent, 25 : parent = parent,
26 super(parent, charOffset, parent.fileUri); 26 super(parent, charOffset, parent.fileUri);
27 27
28 Builder lookup(String name, int charOffset, Uri fileUri) {
29 return exports[name];
30 }
31
28 Member findTopLevelMember(String name) { 32 Member findTopLevelMember(String name) {
29 // TODO(ahe): Move this to KernelPrefixBuilder. 33 // TODO(ahe): Move this to KernelPrefixBuilder.
30 Builder builder = exports[name]; 34 Builder builder = exports[name];
31 if (builder == null) { 35 if (builder == null) {
32 warning( 36 warning(
33 parent.fileUri, -1, "'${this.name}' has no member named '$name'."); 37 parent.fileUri, -1, "'${this.name}' has no member named '$name'.");
34 } 38 }
35 if (builder is DillMemberBuilder) { 39 if (builder is DillMemberBuilder) {
36 return builder.member.isInstanceMember 40 return builder.member.isInstanceMember
37 ? internalError("Unexpected instance member in export scope") 41 ? internalError("Unexpected instance member in export scope")
38 : builder.member; 42 : builder.member;
39 } else if (builder is MemberBuilder) { 43 } else if (builder is MemberBuilder) {
40 return builder.target; 44 return builder.target;
41 } else { 45 } else {
42 return null; 46 return null;
43 } 47 }
44 } 48 }
45 49
46 @override 50 @override
47 String get fullNameForErrors => name; 51 String get fullNameForErrors => name;
48 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698