| OLD | NEW |
| 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 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; | 5 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; |
| 6 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; | 6 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; |
| 7 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; | 7 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; |
| 8 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart"; | 8 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart"; |
| 9 import "compiler_helper.dart"; | 9 import "compiler_helper.dart"; |
| 10 import "parser_helper.dart"; | 10 import "parser_helper.dart"; |
| 11 import "dart:uri"; | 11 import "dart:uri"; |
| 12 | 12 |
| 13 bool test(compiler, String name1, String name2, {bool expect}) { | 13 bool test(compiler, String name1, String name2, {bool expect}) { |
| 14 Expect.isTrue(?expect, 'required parameter "expect" not given'); | 14 Expect.isTrue(?expect, 'required parameter "expect" not given'); |
| 15 var clazz = findElement(compiler, "Class"); | 15 var clazz = findElement(compiler, "Class"); |
| 16 clazz.ensureResolved(compiler); | 16 clazz.ensureResolved(compiler); |
| 17 var element1 = clazz.buildScope().lookup(buildSourceString(name1)); | 17 var element1 = clazz.buildScope().lookup(buildSourceString(name1)); |
| 18 var element2 = clazz.buildScope().lookup(buildSourceString(name2)); | 18 var element2 = clazz.buildScope().lookup(buildSourceString(name2)); |
| 19 Expect.isNotNull(element1); | 19 Expect.isNotNull(element1); |
| 20 Expect.isNotNull(element2); | 20 Expect.isNotNull(element2); |
| 21 Expect.isTrue(element1.kind === ElementKind.FUNCTION); | 21 Expect.equals(element1.kind, ElementKind.FUNCTION); |
| 22 Expect.isTrue(element2.kind === ElementKind.FUNCTION); | 22 Expect.equals(element2.kind, ElementKind.FUNCTION); |
| 23 FunctionSignature signature1 = element1.computeSignature(compiler); | 23 FunctionSignature signature1 = element1.computeSignature(compiler); |
| 24 FunctionSignature signature2 = element2.computeSignature(compiler); | 24 FunctionSignature signature2 = element2.computeSignature(compiler); |
| 25 | 25 |
| 26 // Function signatures are used to be to provide void types (only occuring as | 26 // Function signatures are used to be to provide void types (only occuring as |
| 27 // as return types) and (inlined) function types (only occuring as method | 27 // as return types) and (inlined) function types (only occuring as method |
| 28 // parameter types). | 28 // parameter types). |
| 29 // | 29 // |
| 30 // Only a single type is used from each signature. That is, it is not the | 30 // Only a single type is used from each signature. That is, it is not the |
| 31 // intention to check the whole signatures against eachother. | 31 // intention to check the whole signatures against eachother. |
| 32 DartType type1; | 32 DartType type1; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 test(compiler, "String1", "ListInt1", expect: false); | 109 test(compiler, "String1", "ListInt1", expect: false); |
| 110 test(compiler, "ListInt1", "ListString1", expect: false); | 110 test(compiler, "ListInt1", "ListString1", expect: false); |
| 111 test(compiler, "ListString1", "MapIntString1", expect: false); | 111 test(compiler, "ListString1", "MapIntString1", expect: false); |
| 112 test(compiler, "MapIntString1", "TypeVar1", expect: false); | 112 test(compiler, "MapIntString1", "TypeVar1", expect: false); |
| 113 test(compiler, "TypeVar1", "Function1a", expect: false); | 113 test(compiler, "TypeVar1", "Function1a", expect: false); |
| 114 test(compiler, "Function1a", "Function1b", expect: false); | 114 test(compiler, "Function1a", "Function1b", expect: false); |
| 115 test(compiler, "Function1b", "Typedef1a", expect: false); | 115 test(compiler, "Function1b", "Typedef1a", expect: false); |
| 116 test(compiler, "Typedef1a", "Typedef1b", expect: false); | 116 test(compiler, "Typedef1a", "Typedef1b", expect: false); |
| 117 test(compiler, "Typedef1b", "Typedef1c", expect: false); | 117 test(compiler, "Typedef1b", "Typedef1c", expect: false); |
| 118 } | 118 } |
| OLD | NEW |