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

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

Issue 2824423002: Compute NativeBasicData for KernelWorldBuilder (Closed)
Patch Set: 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of dart2js.kernel.world_builder;
6
7 /// Computes that NativeBasicData for the libraries in [worldBuilder].
8 // TODO(johnnniwinther): Move this to the AnnotationProcessor when it has been
9 // committed.
10 NativeBasicData computeNativeBasicData(KernelWorldBuilder worldBuilder) {
11 NativeBasicDataBuilderImpl builder = new NativeBasicDataBuilderImpl();
12 ElementEnvironment elementEnvironment = worldBuilder.elementEnvironment;
13 for (LibraryEntity library in elementEnvironment.libraries) {
14 /// TODO(johnniwinther): Reuse `JavaScriptBackend.canLibraryUseNative`
15 /// instead.
16 if (library.canonicalUri.scheme == 'dart') {
17 elementEnvironment.forEachClass(library, (ClassEntity cls) {
18 String annotationName;
19 for (ConstantExpression annotation
20 in worldBuilder._getClassMetadata(cls)) {
Siggi Cherem (dart-lang) 2017/04/19 16:05:22 I might be missing sometheing, but isn't this a ty
Johnni Winther 2017/04/20 08:05:25 _getClassMetadata expects a KClass but uses _class
21 ConstantValue value =
22 worldBuilder.constantEnvironment.getConstantValue(annotation);
Siggi Cherem (dart-lang) 2017/04/19 16:05:22 ah - this might answer part of my question from my
Johnni Winther 2017/04/20 08:05:25 We need the KernelWorldBuilder from the get-go. Th
23 String name = readAnnotationName(
24 cls, value, worldBuilder.commonElements.nativeAnnotationClass);
25 if (annotationName == null) {
26 annotationName = name;
27 } else if (name != null) {
28 throw new SpannableAssertionFailure(
29 cls, 'Too many name annotations.');
30 }
31 }
32 if (annotationName != null) {
33 builder.setNativeClassTagInfo(cls, annotationName);
34 }
35 });
36 }
37 }
38 return builder.close(worldBuilder.elementEnvironment);
Siggi Cherem (dart-lang) 2017/04/19 16:05:22 use directly the local elementEnvironment
Johnni Winther 2017/04/20 08:05:25 Done.
39 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_adapter.dart ('k') | pkg/compiler/lib/src/kernel/world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698