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

Side by Side Diff: dart/tests/compiler/dart2js_foreign/native_missing_method1_test.dart

Issue 23477028: Remove dart2js_foreign. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6 import 'native_metadata.dart';
7
8 @Native("*A")
9 class A {
10 }
11
12 @native makeA();
13
14 @Native("""
15 function A() {};
16 A.prototype.foo = function() { return 42; }
17 makeA = function() { return new A; }
18 """)
19 void setup();
20
21 class B {
22 // We need to define a foo method so that Frog sees it. Because it's
23 // the only occurence of 'foo', Frog does not bother mangling the
24 // call sites. It thinks all calls will either go to this method, or
25 // throw a NoSuchMethodError.
26 foo() { return 42; }
27 }
28
29 typedContext() {
30 var things = [ makeA(), new B() ];
31 A a = things[0];
32 Expect.throws(() => a.foo(),
33 (e) => e is NoSuchMethodError);
34 Expect.throws(() => a.foo,
35 (e) => e is NoSuchMethodError);
36 Expect.throws(() => a.foo = 4,
37 (e) => e is NoSuchMethodError);
38 }
39
40 untypedContext() {
41 var things = [ makeA(), new B() ];
42 var a = things[0];
43 Expect.throws(() => a.foo(),
44 (e) => e is NoSuchMethodError);
45 Expect.throws(() => a.foo,
46 (e) => e is NoSuchMethodError);
47 Expect.throws(() => a.foo = 4,
48 (e) => e is NoSuchMethodError);
49 }
50
51 main() {
52 setup();
53 typedContext();
54 untypedContext();
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698