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

Side by Side Diff: pkg/compiler/lib/src/native/js.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/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/ssa/builder.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) 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 part of native; 5 part of native;
6 6
7
8 class HasCapturedPlaceholders extends js.BaseVisitor {
9
10 HasCapturedPlaceholders._();
11
12 static bool check(js.Node node) {
13 HasCapturedPlaceholders visitor = new HasCapturedPlaceholders._();
14 node.accept(visitor);
15 return visitor.found;
16 }
17
18 int enclosingFunctions = 0;
19 bool found = false;
20
21 @override
22 visitFun(js.Fun node) {
23 ++enclosingFunctions;
24 node.visitChildren(this);
25 --enclosingFunctions;
26 }
27
28 @override
29 visitInterpolatedNode(js.InterpolatedNode node) {
30 if (enclosingFunctions > 0) {
31 found = true;
32 }
33 }
34 }
35
7 class SideEffectsVisitor extends js.BaseVisitor { 36 class SideEffectsVisitor extends js.BaseVisitor {
8 final SideEffects sideEffects; 37 final SideEffects sideEffects;
9 SideEffectsVisitor(this.sideEffects); 38 SideEffectsVisitor(this.sideEffects);
10 39
11 void visit(js.Node node) { 40 void visit(js.Node node) {
12 node.accept(this); 41 node.accept(this);
13 } 42 }
14 43
15 void visitLiteralExpression(js.LiteralExpression node) { 44 void visitLiteralExpression(js.LiteralExpression node) {
16 sideEffects.setAllSideEffects(); 45 sideEffects.setAllSideEffects();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 receiver.isPositional && 289 receiver.isPositional &&
261 receiver.nameOrPosition == 0) { 290 receiver.nameOrPosition == 0) {
262 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; 291 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS;
263 } else { 292 } else {
264 first = NativeThrowBehavior.MAY; 293 first = NativeThrowBehavior.MAY;
265 } 294 }
266 295
267 return sequence(first, second); 296 return sequence(first, second);
268 } 297 }
269 } 298 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698