Mercurial > projects > dil
comparison src/dil/semantic/Pass1.d @ 823:fde064aca673
Added support for version(unittest).
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Mon, 24 Mar 2008 18:53:15 +0100 |
parents | 1d06b4aed7cf |
children | 80eb3251e010 |
comparison
equal
deleted
inserted
replaced
822:fd52beaaa94a | 823:fde064aca673 |
---|---|
413 } | 413 } |
414 | 414 |
415 D visit(DebugDeclaration d) | 415 D visit(DebugDeclaration d) |
416 { | 416 { |
417 if (d.isSpecification) | 417 if (d.isSpecification) |
418 { // debug = Id|Int | 418 { // debug = Id | Int |
419 if (!isModuleScope()) | 419 if (!isModuleScope()) |
420 error(d.begin, MSG.DebugSpecModuleLevel, d.spec.srcText); | 420 error(d.begin, MSG.DebugSpecModuleLevel, d.spec.srcText); |
421 else if (d.spec.kind == TOK.Identifier) | 421 else if (d.spec.kind == TOK.Identifier) |
422 context.addDebugId(d.spec.ident.str); | 422 context.addDebugId(d.spec.ident.str); |
423 else | 423 else |
424 context.debugLevel = d.spec.uint_; | 424 context.debugLevel = d.spec.uint_; |
425 } | 425 } |
426 else | 426 else |
427 { | 427 { // debug ( Condition ) |
428 if (debugBranchChoice(d.cond, context)) | 428 if (debugBranchChoice(d.cond, context)) |
429 d.compiledDecls = d.decls; | 429 d.compiledDecls = d.decls; |
430 else | 430 else |
431 d.compiledDecls = d.elseDecls; | 431 d.compiledDecls = d.elseDecls; |
432 d.compiledDecls && visitD(d.compiledDecls); | 432 d.compiledDecls && visitD(d.compiledDecls); |
435 } | 435 } |
436 | 436 |
437 D visit(VersionDeclaration d) | 437 D visit(VersionDeclaration d) |
438 { | 438 { |
439 if (d.isSpecification) | 439 if (d.isSpecification) |
440 { // version = Id|Int | 440 { // version = Id | Int |
441 if (!isModuleScope()) | 441 if (!isModuleScope()) |
442 error(d.begin, MSG.VersionSpecModuleLevel, d.spec.srcText); | 442 error(d.begin, MSG.VersionSpecModuleLevel, d.spec.srcText); |
443 else if (d.spec.kind == TOK.Identifier) | 443 else if (d.spec.kind == TOK.Identifier) |
444 context.addVersionId(d.spec.ident.str); | 444 context.addVersionId(d.spec.ident.str); |
445 else | 445 else |
446 context.versionLevel = d.spec.uint_; | 446 context.versionLevel = d.spec.uint_; |
447 } | 447 } |
448 else | 448 else |
449 { | 449 { // version ( Condition ) |
450 if (versionBranchChoice(d.cond, context)) | 450 if (versionBranchChoice(d.cond, context)) |
451 d.compiledDecls = d.decls; | 451 d.compiledDecls = d.decls; |
452 else | 452 else |
453 d.compiledDecls = d.elseDecls; | 453 d.compiledDecls = d.elseDecls; |
454 d.compiledDecls && visitD(d.compiledDecls); | 454 d.compiledDecls && visitD(d.compiledDecls); |