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

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

Issue 1896843002: Store and serialize NativeBehavior in TreeElements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 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) 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 'package:js_runtime/shared/embedded_names.dart' 7 import 'package:js_runtime/shared/embedded_names.dart'
8 show JsBuiltin, JsGetName; 8 show JsBuiltin, JsGetName;
9 9
10 import '../closure.dart' as closure; 10 import '../closure.dart' as closure;
(...skipping 3179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3190 ir.Primitive nameValue = visit(node); 3190 ir.Primitive nameValue = visit(node);
3191 if (nameValue is ir.Constant && nameValue.value.isString) { 3191 if (nameValue is ir.Constant && nameValue.value.isString) {
3192 StringConstantValue constantValue = nameValue.value; 3192 StringConstantValue constantValue = nameValue.value;
3193 return constantValue.primitiveValue.slowToString(); 3193 return constantValue.primitiveValue.slowToString();
3194 } else { 3194 } else {
3195 return internalError(node, 'expected a literal string'); 3195 return internalError(node, 'expected a literal string');
3196 } 3196 }
3197 } 3197 }
3198 3198
3199 Link<ast.Node> argumentNodes = argumentList.nodes; 3199 Link<ast.Node> argumentNodes = argumentList.nodes;
3200 NativeBehavior behavior = 3200 NativeBehavior behavior = elements.getNativeData(node);
3201 compiler.enqueuer.resolution.nativeEnqueuer.getNativeBehaviorOf(node);
3202 switch (function.name) { 3201 switch (function.name) {
3203 case 'JS': 3202 case 'JS':
3204 validateArgumentCount(minimum: 2); 3203 validateArgumentCount(minimum: 2);
3205 // The first two arguments are the type and the foreign code template, 3204 // The first two arguments are the type and the foreign code template,
3206 // which already have been analyzed by the resolver and can be retrieved 3205 // which already have been analyzed by the resolver and can be retrieved
3207 // using [NativeBehavior]. We can ignore these arguments in the backend. 3206 // using [NativeBehavior]. We can ignore these arguments in the backend.
3208 List<ir.Primitive> arguments = 3207 List<ir.Primitive> arguments =
3209 argumentNodes.skip(2).mapToList(visit, growable: false); 3208 argumentNodes.skip(2).mapToList(visit, growable: false);
3210 if (behavior.codeTemplate.positionalArgumentCount != arguments.length) { 3209 if (behavior.codeTemplate.positionalArgumentCount != arguments.length) {
3211 reporter.reportErrorMessage(node, MessageKind.GENERIC, { 3210 reporter.reportErrorMessage(node, MessageKind.GENERIC, {
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
4015 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); 4014 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass);
4016 4015
4017 String getJsInteropTargetPath(FunctionElement element) { 4016 String getJsInteropTargetPath(FunctionElement element) {
4018 return '${_backend.namer.fixedBackendPath(element)}.' 4017 return '${_backend.namer.fixedBackendPath(element)}.'
4019 '${_backend.nativeData.getFixedBackendName(element)}'; 4018 '${_backend.nativeData.getFixedBackendName(element)}';
4020 } 4019 }
4021 4020
4022 DartType get jsJavascriptObjectType => 4021 DartType get jsJavascriptObjectType =>
4023 _backend.helpers.jsJavaScriptObjectClass.thisType; 4022 _backend.helpers.jsJavaScriptObjectClass.thisType;
4024 } 4023 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698