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

Side by Side Diff: pkg/compiler/lib/src/native/resolver.dart

Issue 2975433002: Assert that we don't mix K and J elements (Closed)
Patch Set: Updated cf. comments 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'package:front_end/src/fasta/scanner.dart' show StringToken, Token; 5 import 'package:front_end/src/fasta/scanner.dart' show StringToken, Token;
6 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN; 6 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN;
7 import 'package:front_end/src/scanner/token.dart' show BeginToken; 7 import 'package:front_end/src/scanner/token.dart' show BeginToken;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common_elements.dart' show CommonElements, ElementEnvironment; 10 import '../common_elements.dart' show CommonElements, ElementEnvironment;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 implements NativeDataResolver { 213 implements NativeDataResolver {
214 final Compiler _compiler; 214 final Compiler _compiler;
215 215
216 NativeDataResolverImpl(this._compiler); 216 NativeDataResolverImpl(this._compiler);
217 217
218 JavaScriptBackend get _backend => _compiler.backend; 218 JavaScriptBackend get _backend => _compiler.backend;
219 DiagnosticReporter get _reporter => _compiler.reporter; 219 DiagnosticReporter get _reporter => _compiler.reporter;
220 ElementEnvironment get elementEnvironment => 220 ElementEnvironment get elementEnvironment =>
221 _compiler.resolution.elementEnvironment; 221 _compiler.resolution.elementEnvironment;
222 CommonElements get commonElements => _compiler.resolution.commonElements; 222 CommonElements get commonElements => _compiler.resolution.commonElements;
223 NativeBasicData get nativeBasicData => _backend.nativeBasicData; 223 NativeBasicData get nativeBasicData =>
224 _compiler.frontendStrategy.nativeBasicData;
224 NativeDataBuilder get nativeDataBuilder => _backend.nativeDataBuilder; 225 NativeDataBuilder get nativeDataBuilder => _backend.nativeDataBuilder;
225 226
226 @override 227 @override
227 bool isJsInteropMember(MemberElement element) { 228 bool isJsInteropMember(MemberElement element) {
228 // TODO(johnniwinther): Avoid computing this twice for external function; 229 // TODO(johnniwinther): Avoid computing this twice for external function;
229 // once from JavaScriptBackendTarget.resolveExternalFunction and once 230 // once from JavaScriptBackendTarget.resolveExternalFunction and once
230 // through JavaScriptBackendTarget.resolveNativeMember. 231 // through JavaScriptBackendTarget.resolveNativeMember.
231 bool isJsInterop = 232 bool isJsInterop =
232 checkJsInteropMemberAnnotations(_compiler, element, nativeDataBuilder); 233 checkJsInteropMemberAnnotations(_compiler, element, nativeDataBuilder);
233 // TODO(johnniwinther): Avoid this duplication of logic from 234 // TODO(johnniwinther): Avoid this duplication of logic from
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 619
619 Iterable<ConstantValue> fields = constructedObject.fields.values; 620 Iterable<ConstantValue> fields = constructedObject.fields.values;
620 // TODO(sra): Better validation of the constant. 621 // TODO(sra): Better validation of the constant.
621 if (fields.length != 1 || fields.single is! StringConstantValue) { 622 if (fields.length != 1 || fields.single is! StringConstantValue) {
622 throw new SpannableAssertionFailure( 623 throw new SpannableAssertionFailure(
623 spannable, 'Annotations needs one string: ${value.toStructuredText()}'); 624 spannable, 'Annotations needs one string: ${value.toStructuredText()}');
624 } 625 }
625 StringConstantValue specStringConstant = fields.single; 626 StringConstantValue specStringConstant = fields.single;
626 return specStringConstant.primitiveValue; 627 return specStringConstant.primitiveValue;
627 } 628 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/enqueue.dart ('k') | pkg/compiler/lib/src/resolution/resolution_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698