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

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

Issue 2982783003: Use failedAt in more places (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « pkg/compiler/lib/src/kernel/env.dart ('k') | pkg/compiler/lib/src/native/resolver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.element_map; 6 part of dart2js.kernel.element_map;
7 7
8 class KernelAnnotationProcessor implements AnnotationProcessor { 8 class KernelAnnotationProcessor implements AnnotationProcessor {
9 final KernelToElementMapForImpactImpl elementMap; 9 final KernelToElementMapForImpactImpl elementMap;
10 final NativeBasicDataBuilder _nativeBasicDataBuilder; 10 final NativeBasicDataBuilder _nativeBasicDataBuilder;
11 11
12 KernelAnnotationProcessor(this.elementMap, this._nativeBasicDataBuilder); 12 KernelAnnotationProcessor(this.elementMap, this._nativeBasicDataBuilder);
13 13
14 void extractNativeAnnotations(LibraryEntity library) { 14 void extractNativeAnnotations(LibraryEntity library) {
15 ElementEnvironment elementEnvironment = elementMap.elementEnvironment; 15 ElementEnvironment elementEnvironment = elementMap.elementEnvironment;
16 CommonElements commonElements = elementMap.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 (ConstantValue value in elementMap._getClassMetadata(cls)) { 22 for (ConstantValue value in elementMap._getClassMetadata(cls)) {
23 String name = readAnnotationName( 23 String name = readAnnotationName(
24 cls, value, commonElements.nativeAnnotationClass); 24 cls, value, commonElements.nativeAnnotationClass);
25 if (annotationName == null) { 25 if (annotationName == null) {
26 annotationName = name; 26 annotationName = name;
27 } else if (name != null) { 27 } else if (name != null) {
28 throw new SpannableAssertionFailure( 28 failedAt(cls, 'Too many name annotations.');
29 cls, 'Too many name annotations.');
30 } 29 }
31 } 30 }
32 if (annotationName != null) { 31 if (annotationName != null) {
33 _nativeBasicDataBuilder.setNativeClassTagInfo(cls, annotationName); 32 _nativeBasicDataBuilder.setNativeClassTagInfo(cls, annotationName);
34 } 33 }
35 }); 34 });
36 } 35 }
37 36
38 void extractJsInteropAnnotations(LibraryEntity library) { 37 void extractJsInteropAnnotations(LibraryEntity library) {
39 // TODO(redemption): Implement this. 38 // TODO(redemption): Implement this.
40 } 39 }
41 40
42 @override 41 @override
43 void processJsInteropAnnotations( 42 void processJsInteropAnnotations(
44 NativeBasicData nativeData, NativeDataBuilder nativeDataBuilder) { 43 NativeBasicData nativeData, NativeDataBuilder nativeDataBuilder) {
45 // TODO(redemption): Implement this. 44 // TODO(redemption): Implement this.
46 } 45 }
47 } 46 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/env.dart ('k') | pkg/compiler/lib/src/native/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698