| 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 | |
| 344 main() { | 307 main() { |
| 345 testSignedConstants(); | 308 testSignedConstants(); |
| 346 testGenericTypes(); | 309 testGenericTypes(); |
| 347 testForLoop(); | 310 testForLoop(); |
| 348 testEmptyList(); | 311 testEmptyList(); |
| 349 testClosure(); | 312 testClosure(); |
| 350 testIndexedOperatorDecl(); | 313 testIndexedOperatorDecl(); |
| 351 testNativeMethods(); | 314 testNativeMethods(); |
| 352 testPrefixIncrements(); | 315 testPrefixIncrements(); |
| 353 testConstModifier(); | 316 testConstModifier(); |
| 354 testSimpleObjectInstantiation(); | 317 testSimpleObjectInstantiation(); |
| 355 testLibraryName(); | 318 testLibraryName(); |
| 356 testImport(); | 319 testImport(); |
| 357 testExport(); | 320 testExport(); |
| 358 testPart(); | 321 testPart(); |
| 359 testPartOf(); | 322 testPartOf(); |
| 360 testCombinators(); | 323 testCombinators(); |
| 361 testRedirectingFactoryConstructors(); | 324 testRedirectingFactoryConstructors(); |
| 362 testClassDeclarations(); | 325 testClassDeclarations(); |
| 363 testMixinApplications(); | 326 testMixinApplications(); |
| 364 testParameters(); | |
| 365 } | 327 } |
| OLD | NEW |