Module: CodeModels::ForeignAstExtensions

Included in:
CodeModelsAstNode
Defined in:
lib/codemodels/source_info.rb

Overview

Inside an host language snippet of other languages can be hosted For example Java code could contain in a string literal a sql statement  or an Html file can contain CSS or Javascript code. In those cases an AST is inserted inside the AST of the host language.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#foreign_containerObject

Returns the value of attribute foreign_container.



147
148
149
# File 'lib/codemodels/source_info.rb', line 147

def foreign_container
  @foreign_container
end

Instance Method Details

#addForeign_asts(foreign_ast) ⇒ Object

The name is to maintain similarity with RGen (so we used camelcase instead of underscore)



150
151
152
153
# File 'lib/codemodels/source_info.rb', line 150

def addForeign_asts(foreign_ast)
  foreign_asts << foreign_ast
  foreign_ast.foreign_container = self
end

#foreign_astsObject



155
156
157
158
# File 'lib/codemodels/source_info.rb', line 155

def foreign_asts
  @foreign_asts=[] unless @foreign_asts
  @foreign_asts
end