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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1688433006: cpsir: implementation of jsinterop in cps ir (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closure; 7 import '../closure.dart' as closure;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Identifiers, 10 Identifiers,
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 /// 789 ///
790 /// Such constants need to be compiled with a different [sourceFile] and 790 /// Such constants need to be compiled with a different [sourceFile] and
791 /// [elements] mapping. 791 /// [elements] mapping.
792 ir.Primitive inlineConstant(AstElement context, ast.Expression exp) { 792 ir.Primitive inlineConstant(AstElement context, ast.Expression exp) {
793 IrBuilderVisitor visitor = makeVisitorForContext(context); 793 IrBuilderVisitor visitor = makeVisitorForContext(context);
794 return visitor.withBuilder(irBuilder, () => visitor.translateConstant(exp)); 794 return visitor.withBuilder(irBuilder, () => visitor.translateConstant(exp));
795 } 795 }
796 796
797 /// Creates a primitive for the default value of [parameter]. 797 /// Creates a primitive for the default value of [parameter].
798 ir.Primitive translateDefaultValue(ParameterElement parameter) { 798 ir.Primitive translateDefaultValue(ParameterElement parameter) {
799 if (parameter.initializer == null) { 799 if (parameter.initializer == null ||
800 // TODO(sigmund): JS doesn't support default values, so this should be
801 // reported as an error earlier (Issue #25759).
802 backend.isJsInterop(parameter.functionDeclaration)) {
800 return irBuilder.buildNullConstant(); 803 return irBuilder.buildNullConstant();
801 } else { 804 } else {
802 return inlineConstant(parameter.executableContext, parameter.initializer); 805 return inlineConstant(parameter.executableContext, parameter.initializer);
803 } 806 }
804 } 807 }
805 808
806 /// Normalizes the argument list of a static invocation. 809 /// Normalizes the argument list of a static invocation.
807 /// 810 ///
808 /// A static invocation is one where the target is known. The argument list 811 /// A static invocation is one where the target is known. The argument list
809 /// [arguments] is normalized by adding default values for optional arguments 812 /// [arguments] is normalized by adding default values for optional arguments
(...skipping 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3914 return _compiler.world.locateSingleField(selector, type); 3917 return _compiler.world.locateSingleField(selector, type);
3915 } 3918 }
3916 3919
3917 Element get closureConverter { 3920 Element get closureConverter {
3918 return _backend.helpers.closureConverter; 3921 return _backend.helpers.closureConverter;
3919 } 3922 }
3920 3923
3921 void addNativeMethod(FunctionElement function) { 3924 void addNativeMethod(FunctionElement function) {
3922 _backend.emitter.nativeEmitter.nativeMethods.add(function); 3925 _backend.emitter.nativeEmitter.nativeMethods.add(function);
3923 } 3926 }
3927
3928 bool get trustJSInteropTypeAnnotations =>
3929 _compiler.trustJSInteropTypeAnnotations;
3930
3931 bool isNative(ClassElement element) => _backend.isNative(element);
3932
3933 bool isJsInterop(FunctionElement element) => _backend.isJsInterop(element);
3934
3935 bool isJsInteropAnonymous(FunctionElement element) =>
3936 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass);
3937
3938 String getJsInteropTargetPath(FunctionElement element) {
3939 return '${_backend.namer.fixedBackendPath(element)}.'
3940 '${_backend.getFixedBackendName(element)}';
3941 }
3942
3943 DartType get jsJavascriptObjectType =>
3944 _backend.helpers.jsJavaScriptObjectClass.thisType;
3924 } 3945 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/inline.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698