Skip to content

[Feature] #include guards #402

Open
Open
@mwasplund

Description

@mwasplund

Including a file multiple times should automatically guard against re-loading the same file multiple times. This is especially important with diamond dependencies.

Main.gravity

#include "A.gravity"
#include "B.gravity"

func main() {
  return A.value() + B.value()
}

A.gravity

#include "C.gravity"

class A {
  static func value() {
    return C.value() + 1
  }
}

B.gravity

#include "C.gravity"

class B {
  static func value() {
    return C.value() + 2
  }
}

C.gravity

class C {
  static func value() {
    return 39
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions