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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 1436263002: dart2js: Forbid # placeholders in JS function bodies. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/native/js.dart ('k') | sdk/lib/_internal/js_runtime/lib/async_patch.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 final SsaCodeGeneratorTask generator; 8 final SsaCodeGeneratorTask generator;
9 final SsaBuilderTask builder; 9 final SsaBuilderTask builder;
10 final SsaOptimizerTask optimizer; 10 final SsaOptimizerTask optimizer;
(...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after
4147 if (nativeBehavior.codeTemplate.positionalArgumentCount != inputs.length) { 4147 if (nativeBehavior.codeTemplate.positionalArgumentCount != inputs.length) {
4148 reporter.reportErrorMessage( 4148 reporter.reportErrorMessage(
4149 node, MessageKind.GENERIC, 4149 node, MessageKind.GENERIC,
4150 {'text': 4150 {'text':
4151 'Mismatch between number of placeholders' 4151 'Mismatch between number of placeholders'
4152 ' and number of arguments.'}); 4152 ' and number of arguments.'});
4153 stack.add(graph.addConstantNull(compiler)); // Result expected on stack. 4153 stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
4154 return; 4154 return;
4155 } 4155 }
4156 4156
4157 if (native.HasCapturedPlaceholders.check(nativeBehavior.codeTemplate.ast)) {
4158 reporter.reportErrorMessage(
4159 node, MessageKind.GENERIC,
4160 {'text':
4161 'JS code must not use `#` inside functions'});
Siggi Cherem (dart-lang) 2015/11/12 21:21:29 maybe include your suggestion as well?
sra1 2015/11/12 22:23:26 I tried. Providing examples is confusing because t
4162 }
4163
4157 TypeMask ssaType = 4164 TypeMask ssaType =
4158 TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler); 4165 TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler);
4159 4166
4160 SourceInformation sourceInformation = 4167 SourceInformation sourceInformation =
4161 sourceInformationBuilder.buildCall(node, node.argumentsNode); 4168 sourceInformationBuilder.buildCall(node, node.argumentsNode);
4162 if (nativeBehavior.codeTemplate.isExpression) { 4169 if (nativeBehavior.codeTemplate.isExpression) {
4163 push(new HForeignCode( 4170 push(new HForeignCode(
4164 nativeBehavior.codeTemplate, ssaType, inputs, 4171 nativeBehavior.codeTemplate, ssaType, inputs,
4165 effects: nativeBehavior.sideEffects, 4172 effects: nativeBehavior.sideEffects,
4166 nativeBehavior: nativeBehavior) 4173 nativeBehavior: nativeBehavior)
(...skipping 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after
9157 if (unaliased is TypedefType) throw 'unable to unalias $type'; 9164 if (unaliased is TypedefType) throw 'unable to unalias $type';
9158 unaliased.accept(this, builder); 9165 unaliased.accept(this, builder);
9159 } 9166 }
9160 9167
9161 void visitDynamicType(DynamicType type, SsaBuilder builder) { 9168 void visitDynamicType(DynamicType type, SsaBuilder builder) {
9162 JavaScriptBackend backend = builder.compiler.backend; 9169 JavaScriptBackend backend = builder.compiler.backend;
9163 ClassElement cls = backend.helpers.DynamicRuntimeType; 9170 ClassElement cls = backend.helpers.DynamicRuntimeType;
9164 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 9171 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
9165 } 9172 }
9166 } 9173 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/js.dart ('k') | sdk/lib/_internal/js_runtime/lib/async_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698