| 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 'dart:uri'; | 5 import 'dart:uri'; |
| 6 import 'parser_helper.dart'; | 6 import 'parser_helper.dart'; |
| 7 import 'mock_compiler.dart'; | 7 import 'mock_compiler.dart'; |
| 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; | 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; |
| 9 | 9 |
| 10 testUnparse(String statement) { | 10 testUnparse(String statement) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 testUnparseTopLevelWithMetadata('typedef C = S<A> with M;'); | 298 testUnparseTopLevelWithMetadata('typedef C = S<A> with M;'); |
| 299 testUnparseTopLevelWithMetadata('typedef C = S<A,B> with M;'); | 299 testUnparseTopLevelWithMetadata('typedef C = S<A,B> with M;'); |
| 300 | 300 |
| 301 testUnparseTopLevelWithMetadata('typedef C = S with M<A>;'); | 301 testUnparseTopLevelWithMetadata('typedef C = S with M<A>;'); |
| 302 testUnparseTopLevelWithMetadata('typedef C = S with M<A,B>;'); | 302 testUnparseTopLevelWithMetadata('typedef C = S with M<A,B>;'); |
| 303 testUnparseTopLevelWithMetadata('typedef C = S with M1<A>,M2;'); | 303 testUnparseTopLevelWithMetadata('typedef C = S with M1<A>,M2;'); |
| 304 testUnparseTopLevelWithMetadata('typedef C = S with M1,M2<A,B>;'); | 304 testUnparseTopLevelWithMetadata('typedef C = S with M1,M2<A,B>;'); |
| 305 } | 305 } |
| 306 | 306 |
| 307 testUnparseParameters(List<String> variableDeclarations) { |
| 308 var sb = new StringBuffer(); |
| 309 sb.add('Constructor('); |
| 310 int index = 0; |
| 311 for (String variableDeclaration in variableDeclarations) { |
| 312 if (index != 0) { |
| 313 sb.add(', '); |
| 314 } |
| 315 sb.add(variableDeclaration); |
| 316 index++; |
| 317 } |
| 318 sb.add(');'); |
| 319 |
| 320 FunctionExpression node = parseMember(sb.toString()); |
| 321 index = 0; |
| 322 for (VariableDefinitions parameter in node.parameters.nodes) { |
| 323 Expect.equals(variableDeclarations[index], unparse(parameter)); |
| 324 index++; |
| 325 } |
| 326 |
| 327 } |
| 328 |
| 329 testParameters() { |
| 330 testUnparseParameters( |
| 331 ["foo", "bar=0", "int baz", "int boz=0"]); |
| 332 testUnparseParameters( |
| 333 ["this.foo", "this.bar=0", "int this.baz", "int this.boz=0"]); |
| 334 testUnparseParameters( |
| 335 ["foo()", "void bar()", "int baz(a)", "int boz(int a,int b)=null"]); |
| 336 testUnparseParameters( |
| 337 ["this.foo()", |
| 338 //"void this.bar()", // Commented out due to Issue 7852 |
| 339 //"int this.baz(a)", // Commented out due to Issue 7852 |
| 340 //"int this.boz(int a,int b)=null" // Commented out due to Issue 7852 |
| 341 ]); |
| 342 } |
| 343 |
| 307 main() { | 344 main() { |
| 308 testSignedConstants(); | 345 testSignedConstants(); |
| 309 testGenericTypes(); | 346 testGenericTypes(); |
| 310 testForLoop(); | 347 testForLoop(); |
| 311 testEmptyList(); | 348 testEmptyList(); |
| 312 testClosure(); | 349 testClosure(); |
| 313 testIndexedOperatorDecl(); | 350 testIndexedOperatorDecl(); |
| 314 testNativeMethods(); | 351 testNativeMethods(); |
| 315 testPrefixIncrements(); | 352 testPrefixIncrements(); |
| 316 testConstModifier(); | 353 testConstModifier(); |
| 317 testSimpleObjectInstantiation(); | 354 testSimpleObjectInstantiation(); |
| 318 testLibraryName(); | 355 testLibraryName(); |
| 319 testImport(); | 356 testImport(); |
| 320 testExport(); | 357 testExport(); |
| 321 testPart(); | 358 testPart(); |
| 322 testPartOf(); | 359 testPartOf(); |
| 323 testCombinators(); | 360 testCombinators(); |
| 324 testRedirectingFactoryConstructors(); | 361 testRedirectingFactoryConstructors(); |
| 325 testClassDeclarations(); | 362 testClassDeclarations(); |
| 326 testMixinApplications(); | 363 testMixinApplications(); |
| 364 testParameters(); |
| 327 } | 365 } |
| OLD | NEW |