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

Side by Side Diff: pkg/compiler/lib/src/kernel/native_basic_data.dart

Issue 2829033002: Rename KernelWorldBuilder to KernelElementBuilder (Closed)
Patch Set: Rename to KernelToElementMap 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 // TODO(johnniwinther): Make this a separate library. 5 // TODO(johnniwinther): Make this a separate library.
6 part of dart2js.kernel.world_builder; 6 part of dart2js.kernel.element_map;
7 7
8 class KernelAnnotationProcessor implements AnnotationProcessor { 8 class KernelAnnotationProcessor implements AnnotationProcessor {
9 final KernelWorldBuilder worldBuilder; 9 final KernelToElementMap elementMap;
10 10
11 KernelAnnotationProcessor(this.worldBuilder); 11 KernelAnnotationProcessor(this.elementMap);
12 12
13 void extractNativeAnnotations( 13 void extractNativeAnnotations(
14 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder) { 14 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder) {
15 ElementEnvironment elementEnvironment = worldBuilder.elementEnvironment; 15 ElementEnvironment elementEnvironment = elementMap.elementEnvironment;
16 CommonElements commonElements = worldBuilder.commonElements; 16 CommonElements commonElements = elementMap.commonElements;
17 17
18 elementEnvironment.forEachClass(library, (ClassEntity cls) { 18 elementEnvironment.forEachClass(library, (ClassEntity cls) {
19 String annotationName; 19 String annotationName;
20 // TODO(johnniwinther): Make [_getClassMetadata] public and at test to 20 // TODO(johnniwinther): Make [_getClassMetadata] public and at test to
21 // guard against misuse. 21 // guard against misuse.
22 for (ConstantExpression annotation 22 for (ConstantExpression annotation in elementMap._getClassMetadata(cls)) {
23 in worldBuilder._getClassMetadata(cls)) {
24 ConstantValue value = 23 ConstantValue value =
25 worldBuilder.constantEnvironment.getConstantValue(annotation); 24 elementMap.constantEnvironment.getConstantValue(annotation);
26 String name = readAnnotationName( 25 String name = readAnnotationName(
27 cls, value, commonElements.nativeAnnotationClass); 26 cls, value, commonElements.nativeAnnotationClass);
28 if (annotationName == null) { 27 if (annotationName == null) {
29 annotationName = name; 28 annotationName = name;
30 } else if (name != null) { 29 } else if (name != null) {
31 throw new SpannableAssertionFailure( 30 throw new SpannableAssertionFailure(
32 cls, 'Too many name annotations.'); 31 cls, 'Too many name annotations.');
33 } 32 }
34 } 33 }
35 if (annotationName != null) { 34 if (annotationName != null) {
36 nativeBasicDataBuilder.setNativeClassTagInfo(cls, annotationName); 35 nativeBasicDataBuilder.setNativeClassTagInfo(cls, annotationName);
37 } 36 }
38 }); 37 });
39 } 38 }
40 39
41 void extractJsInteropAnnotations( 40 void extractJsInteropAnnotations(
42 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder) { 41 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder) {
43 throw new UnimplementedError( 42 throw new UnimplementedError(
44 'KernelAnnotationProcessor.extractJsInteropAnnotations'); 43 'KernelAnnotationProcessor.extractJsInteropAnnotations');
45 } 44 }
46 } 45 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map.dart ('k') | pkg/compiler/lib/src/kernel/native_class_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698