MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / preVisitExpression

Method preVisitExpression

src/ast/ast_lint.cpp:508–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506 }
507 }
508 virtual void preVisitExpression ( Expression * expr ) override {
509 if ( expr->alwaysSafe && expr->userSaidItsSafe && !expr->generated ) {
510 if (func == nullptr) {
511 // we're in global scope
512 anyUnsafe = true;
513 if ( checkUnsafe ) {
514 program->error("unsafe in global initializer.", "unsafe are prohibited by CodeOfPolicies", "",
515 expr->at, CompilationError::unsafe_global);
516 }
517 return;
518 }
519 auto origin = func->getOrigin();
520 if ( !(origin && origin->generated) && !func->generated )
521 {
522 auto fnMod = origin ? origin->module : func->module;
523 if ( fnMod == program->thisModule.get() ) {
524 anyUnsafe = true;
525 if ( checkUnsafe ) {
526 program->error("unsafe function '" + func->getMangledName() + "'", "unsafe functions are prohibited by CodeOfPolicies", "",
527 expr->at, CompilationError::unsafe_function);
528 }
529 }
530 }
531 }
532 }
533 virtual void preVisitStructureField ( Structure * var, Structure::FieldDeclaration & decl, bool last ) override {
534 Visitor::preVisitStructureField(var, decl, last);
535 if ( noLocalClassMembers ) {

Callers

nothing calls this directly

Calls 4

getOriginMethod · 0.80
errorMethod · 0.45
getMethod · 0.45
getMangledNameMethod · 0.45

Tested by

no test coverage detected