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

Side by Side Diff: tests/compiler/dart2js_extra/interceptor_named_arguments_test.dart

Issue 1235463004: dart2js: Take named arguments into account (again) when naming one-shot interceptors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/minify_namer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
karlklose 2015/07/10 12:23:34 2013 -> 2015.
herhut 2015/07/10 12:32:32 Acknowledged.
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.
4
5
6 // Test that the proper one-shot interceptor is used for different
7 // combinations of named arguments.
8 import "package:expect/expect.dart";
9
10 // Use dart:html to get interceptors into play.
11 import "dart:html";
12
13 // [createFragment] has the same signature as in [Element].
14 class Other {
15 createFragment(html, {validator, treeSanitizer}) {
16 int result = 0;
17 result += validator == null ? 0 : 2;
18 result += treeSanitizer == null ? 0 : 1;
19 return result;
20 }
21 }
22
23 @NoInline()
24 bool wontTell(bool x) => x;
25
26
27 // Ensure that we use the interceptor only once per context so that we
28 // actually get a one-shot interceptor. This is a little brittle...
29 @NoInline()
30 testA(thing) {
31 Expect.equals(0, thing.createFragment(null));
32 }
33
34 @NoInline()
35 testB(thing) {
36 Expect.equals(2, thing.createFragment(null, validator: 1));
37 }
38
39 @NoInline()
40 testC(thing) {
41 Expect.equals(1, thing.createFragment(null, treeSanitizer: 1));
42 }
43
44 @NoInline()
45 testD(thing) {
46 Expect.equals(3, thing.createFragment(null, validator: 1, treeSanitizer: 1));
47 }
48
49 main () {
50 // Ensure we get interceptors into play.
51 var thing = wontTell(true) ? new Other() : new DivElement();
52 testA(thing);
53 testB(thing);
54 testC(thing);
55 testD(thing);
56 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/minify_namer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698