How to use compiler class

Best Atoum code snippet using compiler

smarty_internal_compile_block.php

Source:smarty_internal_compile_block.php Github

copy

Full Screen

...48 * @var int49 */50 public static $blockTagNestingLevel = 0;51 /**52 * Saved compiler object53 *54 * @var Smarty_Internal_TemplateCompilerBase55 */56 public $compiler = null;57 /**58 * Compiles code for the {block} tag59 *60 * @param array $args array with attributes from parser61 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object62 * @param array $parameter array with compilation parameter63 *64 * @return bool true65 */66 public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)67 {68 if (!isset($compiler->_cache['blockNesting'])) {69 $compiler->_cache['blockNesting'] = 0;70 }71 if ($compiler->_cache['blockNesting'] == 0) {72 // make sure that inheritance gets initialized in template code73 $this->registerInit($compiler);74 $this->option_flags = array('hide', 'nocache', 'append', 'prepend');75 } else {76 $this->option_flags = array('hide', 'nocache');77 }78 // check and get attributes79 $_attr = $this->getAttributes($compiler, $args);80 $compiler->_cache['blockNesting'] ++;81 $compiler->_cache['blockName'][$compiler->_cache['blockNesting']] = $_attr['name'];82 $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']][0] = 'block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true));83 $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']][1] = false;84 $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer,85 $compiler->template->compiled->has_nocache_code,86 $compiler->template->caching));87 // must whole block be nocache ?88 if ($compiler->tag_nocache) {89 $i = 0;90 }91 $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;92 // $compiler->suppressNocacheProcessing = true;93 if ($_attr['nocache'] === true) {94 //$compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->taglineno);95 }96 $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();97 $compiler->template->compiled->has_nocache_code = false;98 $compiler->suppressNocacheProcessing = true;99 }100 /**101 * Compile saved child block source102 *103 * @param \Smarty_Internal_TemplateCompilerBase compiler object104 * @param string $_name optional name of child block105 *106 * @return string compiled code of child block107 */108 static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)109 {110 if (!isset($compiler->_cache['blockNesting'])) {111 $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ',112 $compiler->parser->lex->taglineno);113 }114 $compiler->has_code = true;115 $compiler->suppressNocacheProcessing = true;116 $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']][1] = true;117 $output = "<?php \n\$_smarty_tpl->ext->_inheritance->processBlock(\$_smarty_tpl, 2, {$compiler->_cache['blockName'][$compiler->_cache['blockNesting']]}, null, \$_blockParentStack);\n?>\n";118 return $output;119 }120 /**121 * Compile $smarty.block.parent122 *123 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object124 * @param string $_name optional name of child block125 *126 * @return string compiled code of child block127 */128 static function compileParentBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)129 {130 if (!isset($compiler->_cache['blockNesting'])) {131 $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ',132 $compiler->parser->lex->taglineno);133 }134 $compiler->suppressNocacheProcessing = true;135 $compiler->has_code = true;136 $output = "<?php \n\$_smarty_tpl->ext->_inheritance->processBlock(\$_smarty_tpl, 4, {$compiler->_cache['blockName'][$compiler->_cache['blockNesting']]}, null, \$_blockParentStack);\n?>\n";137 return $output;138 }139}140/**141 * Smarty Internal Plugin Compile BlockClose Class142 *143 */144class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance145{146 /**147 * Compiles code for the {/block} tag148 *149 * @param array $args array with attributes from parser150 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object151 * @param array $parameter array with compilation parameter152 *153 * @return bool true154 */155 public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)156 {157 list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block'));158 // init block parameter159 $_block = $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']];160 unset($compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]);161 $_block[2] = $_block[3] = 0;162 $_name = trim($_attr['name'], "'\"");163 $_assign = isset($_attr['assign']) ? $_attr['assign'] : null;164 unset($_attr['assign'], $_attr['name']);165 foreach ($_attr as $name => $stat) {166 if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) {167 $_block[$name] = is_string($stat) ? trim($stat, "'\"") : $stat;168 }169 }170 $_funcName = $_block[0];171 // get compiled block code172 $_functionCode = $compiler->parser->current_buffer;173 // setup buffer for template function code174 $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();175 if ($compiler->template->compiled->has_nocache_code) {176 // $compiler->parent_compiler->template->tpl_function[$_name]['call_name_caching'] = $_funcNameCaching;177 $_block[6] = $_funcNameCaching = $_funcName . '_nocache';178 $output = "<?php\n";179 $output .= "/* {block '{$_name}'} {$compiler->template->source->type}:{$compiler->template->source->name} */\n";180 $output .= "function {$_funcNameCaching} (\$_smarty_tpl, \$_blockParentStack) {\n";181 $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n";182 $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n";183 if (isset($_assign)) {184 $output .= "ob_start();\n";185 }186 $output .= "?>\n";187 $compiler->parser->current_buffer->append_subtree($compiler->parser,188 new Smarty_Internal_ParseTree_Tag($compiler->parser,189 $output));190 $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);191 $output = "<?php\n";192 if (isset($_assign)) {193 $output .= "\$_smarty_tpl->tpl_vars[{$_assign}] = new Smarty_Variable(ob_get_clean());\n";194 }195 $output .= "/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n";196 $output .= "}\n";197 $output .= "/* {/block '{$_name}'} */\n\n";198 $output .= "?>\n";199 $compiler->parser->current_buffer->append_subtree($compiler->parser,200 new Smarty_Internal_ParseTree_Tag($compiler->parser,201 $output));202 $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser);203 $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();204 $this->compiler = $compiler;205 $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser,206 preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",207 array($this, 'removeNocache'),208 $_functionCode->to_smarty_php($compiler->parser)));209 $this->compiler = null;210 }211 $output = "<?php\n";212 $output .= "/* {block '{$_name}'} {$compiler->template->source->type}:{$compiler->template->source->name} */\n";213 $output .= "function {$_funcName}(\$_smarty_tpl, \$_blockParentStack) {\n";214 if (isset($_assign)) {215 $output .= "ob_start();\n";216 }217 $output .= "?>\n";218 $compiler->parser->current_buffer->append_subtree($compiler->parser,219 new Smarty_Internal_ParseTree_Tag($compiler->parser,220 $output));221 $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);222 $output = "<?php\n";223 if (isset($_assign)) {224 $output .= "\$_smarty_tpl->tpl_vars[{$_assign}] = new Smarty_Variable(ob_get_clean());\n";225 }226 $output .= "}\n";227 $output .= "/* {/block '{$_name}'} */\n\n";228 $output .= "?>\n";229 $compiler->parser->current_buffer->append_subtree($compiler->parser,230 new Smarty_Internal_ParseTree_Tag($compiler->parser,231 $output));232 $compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);233 // nocache plugins must be copied234 if (!empty($compiler->template->compiled->required_plugins['nocache'])) {235 foreach ($compiler->template->compiled->required_plugins['nocache'] as $plugin => $tmp) {236 foreach ($tmp as $type => $data) {237 $compiler->parent_compiler->template->compiled->required_plugins['compiled'][$plugin][$type] =238 $data;239 }240 }241 }242 // restore old status243 $compiler->template->compiled->has_nocache_code = $_has_nocache_code;244 $compiler->tag_nocache = $compiler->nocache;245 $compiler->nocache = $_nocache;246 $compiler->parser->current_buffer = $_buffer;247 $output = "<?php \n";248 if ($compiler->_cache['blockNesting'] == 1) {249 $output .= "\$_smarty_tpl->ext->_inheritance->processBlock(\$_smarty_tpl, 0, {$compiler->_cache['blockName'][$compiler->_cache['blockNesting']]}, " .250 var_export($_block, true) . ");\n";251 } else {252 $output .= "\$_smarty_tpl->ext->_inheritance->processBlock(\$_smarty_tpl, 0, {$compiler->_cache['blockName'][$compiler->_cache['blockNesting']]}, " .253 var_export($_block, true) . ", \$_blockParentStack);\n";254 }255 $output .= "?>\n";256 $compiler->_cache['blockNesting'] --;257 if ($compiler->_cache['blockNesting'] == 0) {258 unset($compiler->_cache['blockNesting']);259 }260 $compiler->has_code = true;261 $compiler->suppressNocacheProcessing = true;262 return $output;263 }264 /**265 * @param $match266 *267 * @return mixed268 */269 function removeNocache($match)270 {271 $code =272 preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",273 '', $match[0]);274 $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code);275 return $code;276 }277}...

Full Screen

Full Screen

compiler.go

Source:compiler.go Github

copy

Full Screen

1//===- compiler.go - IR generator entry point -----------------------------===//2//3// The LLVM Compiler Infrastructure4//5// This file is distributed under the University of Illinois Open Source6// License. See LICENSE.TXT for details.7//8//===----------------------------------------------------------------------===//9//10// This file implements the main IR generator entry point, (*Compiler).Compile.11//12//===----------------------------------------------------------------------===//13package irgen14import (15 "bytes"16 "go/ast"17 "go/token"18 "log"19 "sort"20 "strconv"21 llgobuild "llvm.org/llgo/build"22 "llvm.org/llgo/debug"23 "llvm.org/llvm/bindings/go/llvm"24 "llvm.org/llgo/third_party/gotools/go/gccgoimporter"25 "llvm.org/llgo/third_party/gotools/go/importer"26 "llvm.org/llgo/third_party/gotools/go/loader"27 "llvm.org/llgo/third_party/gotools/go/ssa"28 "llvm.org/llgo/third_party/gotools/go/types"29)30type Module struct {31 llvm.Module32 Path string33 ExportData []byte34 Package *types.Package35 disposed bool36}37func (m *Module) Dispose() {38 if m.disposed {39 return40 }41 m.Module.Dispose()42 m.disposed = true43}44///////////////////////////////////////////////////////////////////////////////45type CompilerOptions struct {46 // TargetTriple is the LLVM triple for the target.47 TargetTriple string48 // GenerateDebug decides whether debug data is49 // generated in the output module.50 GenerateDebug bool51 // DebugPrefixMaps is a list of mappings from source prefixes to52 // replacement prefixes, to be applied in debug info.53 DebugPrefixMaps []debug.PrefixMap54 // Logger is a logger used for tracing compilation.55 Logger *log.Logger56 // DumpSSA is a debugging option that dumps each SSA function57 // to stderr before generating code for it.58 DumpSSA bool59 // GccgoPath is the path to the gccgo binary whose libgo we read import60 // data from. If blank, the caller is expected to supply an import61 // path in ImportPaths.62 GccgoPath string63 // Whether to use the gccgo ABI.64 GccgoABI bool65 // ImportPaths is the list of additional import paths66 ImportPaths []string67 // SanitizerAttribute is an attribute to apply to functions to enable68 // dynamic instrumentation using a sanitizer.69 SanitizerAttribute llvm.Attribute70 // Importer is the importer. If nil, the compiler will set this field71 // automatically using MakeImporter().72 Importer types.Importer73 // InitMap is the init map used by Importer. If Importer is nil, the74 // compiler will set this field automatically using MakeImporter().75 // If Importer is non-nil, InitMap must be non-nil also.76 InitMap map[*types.Package]gccgoimporter.InitData77 // PackageCreated is a hook passed to the go/loader package via78 // loader.Config, see the documentation for that package for more79 // information.80 PackageCreated func(*types.Package)81 // DisableUnusedImportCheck disables the unused import check performed82 // by go/types if set to true.83 DisableUnusedImportCheck bool84 // Packages is used by go/types as the imported package map if non-nil.85 Packages map[string]*types.Package86}87type Compiler struct {88 opts CompilerOptions89 dataLayout string90}91func NewCompiler(opts CompilerOptions) (*Compiler, error) {92 compiler := &Compiler{opts: opts}93 dataLayout, err := llvmDataLayout(compiler.opts.TargetTriple)94 if err != nil {95 return nil, err96 }97 compiler.dataLayout = dataLayout98 return compiler, nil99}100func (c *Compiler) Compile(fset *token.FileSet, astFiles []*ast.File, importpath string) (m *Module, err error) {101 target := llvm.NewTargetData(c.dataLayout)102 compiler := &compiler{103 CompilerOptions: c.opts,104 dataLayout: c.dataLayout,105 target: target,106 llvmtypes: NewLLVMTypeMap(llvm.GlobalContext(), target),107 }108 return compiler.compile(fset, astFiles, importpath)109}110type compiler struct {111 CompilerOptions112 module *Module113 dataLayout string114 target llvm.TargetData115 fileset *token.FileSet116 runtime *runtimeInterface117 llvmtypes *llvmTypeMap118 types *TypeMap119 debug *debug.DIBuilder120}121func (c *compiler) logf(format string, v ...interface{}) {122 if c.Logger != nil {123 c.Logger.Printf(format, v...)124 }125}126func (c *compiler) addCommonFunctionAttrs(fn llvm.Value) {127 fn.AddTargetDependentFunctionAttr("disable-tail-calls", "true")128 fn.AddTargetDependentFunctionAttr("split-stack", "")129 if c.SanitizerAttribute.GetEnumKind() != 0 {130 fn.AddFunctionAttr(c.SanitizerAttribute)131 }132}133// MakeImporter sets CompilerOptions.Importer to an appropriate importer134// for the search paths given in CompilerOptions.ImportPaths, and sets135// CompilerOptions.InitMap to an init map belonging to that importer.136// If CompilerOptions.GccgoPath is non-empty, the importer will also use137// the search paths for that gccgo installation.138func (opts *CompilerOptions) MakeImporter() error {139 opts.InitMap = make(map[*types.Package]gccgoimporter.InitData)140 if opts.GccgoPath == "" {141 paths := append(append([]string{}, opts.ImportPaths...), ".")142 opts.Importer = gccgoimporter.GetImporter(paths, opts.InitMap)143 } else {144 var inst gccgoimporter.GccgoInstallation145 err := inst.InitFromDriver(opts.GccgoPath)146 if err != nil {147 return err148 }149 opts.Importer = inst.GetImporter(opts.ImportPaths, opts.InitMap)150 }151 return nil152}153func (compiler *compiler) compile(fset *token.FileSet, astFiles []*ast.File, importpath string) (m *Module, err error) {154 buildctx, err := llgobuild.ContextFromTriple(compiler.TargetTriple)155 if err != nil {156 return nil, err157 }158 if compiler.Importer == nil {159 err = compiler.MakeImporter()160 if err != nil {161 return nil, err162 }163 }164 impcfg := &loader.Config{165 Fset: fset,166 TypeChecker: types.Config{167 Packages: compiler.Packages,168 Import: compiler.Importer,169 Sizes: compiler.llvmtypes,170 DisableUnusedImportCheck: compiler.DisableUnusedImportCheck,171 },172 ImportFromBinary: true,173 Build: &buildctx.Context,174 PackageCreated: compiler.PackageCreated,175 }176 // If no import path is specified, then set the import177 // path to be the same as the package's name.178 if importpath == "" {179 importpath = astFiles[0].Name.String()180 }181 impcfg.CreateFromFiles(importpath, astFiles...)182 iprog, err := impcfg.Load()183 if err != nil {184 return nil, err185 }186 program := ssa.Create(iprog, ssa.BareInits)187 mainPkginfo := iprog.InitialPackages()[0]188 mainPkg := program.CreatePackage(mainPkginfo)189 // Create a Module, which contains the LLVM module.190 modulename := importpath191 compiler.module = &Module{Module: llvm.NewModule(modulename), Path: modulename, Package: mainPkg.Object}192 compiler.module.SetTarget(compiler.TargetTriple)193 compiler.module.SetDataLayout(compiler.dataLayout)194 // Create a new translation unit.195 unit := newUnit(compiler, mainPkg)196 // Create the runtime interface.197 compiler.runtime, err = newRuntimeInterface(compiler.module.Module, compiler.llvmtypes)198 if err != nil {199 return nil, err200 }201 mainPkg.Build()202 // Create a struct responsible for mapping static types to LLVM types,203 // and to runtime/dynamic type values.204 compiler.types = NewTypeMap(205 mainPkg,206 compiler.llvmtypes,207 compiler.module.Module,208 compiler.runtime,209 MethodResolver(unit),210 )211 if compiler.GenerateDebug {212 compiler.debug = debug.NewDIBuilder(213 types.Sizes(compiler.llvmtypes),214 compiler.module.Module,215 impcfg.Fset,216 compiler.DebugPrefixMaps,217 )218 defer compiler.debug.Destroy()219 defer compiler.debug.Finalize()220 }221 unit.translatePackage(mainPkg)222 compiler.processAnnotations(unit, mainPkginfo)223 if importpath == "main" {224 compiler.createInitMainFunction(mainPkg)225 } else {226 compiler.module.ExportData = compiler.buildExportData(mainPkg)227 }228 return compiler.module, nil229}230type byPriorityThenFunc []gccgoimporter.PackageInit231func (a byPriorityThenFunc) Len() int { return len(a) }232func (a byPriorityThenFunc) Swap(i, j int) { a[i], a[j] = a[j], a[i] }233func (a byPriorityThenFunc) Less(i, j int) bool {234 switch {235 case a[i].Priority < a[j].Priority:236 return true237 case a[i].Priority > a[j].Priority:238 return false239 case a[i].InitFunc < a[j].InitFunc:240 return true241 default:242 return false243 }244}245func (c *compiler) buildPackageInitData(mainPkg *ssa.Package) gccgoimporter.InitData {246 var inits []gccgoimporter.PackageInit247 for _, imp := range mainPkg.Object.Imports() {248 inits = append(inits, c.InitMap[imp].Inits...)249 }250 sort.Sort(byPriorityThenFunc(inits))251 // Deduplicate init entries. We want to preserve the entry with the highest priority.252 // Normally a package's priorities will be consistent among its dependencies, but it is253 // possible for them to be different. For example, if a standard library test augments a254 // package which is a dependency of 'regexp' (which is imported by every test main package)255 // with additional dependencies, those dependencies may cause the package under test to256 // receive a higher priority than indicated by its init clause in 'regexp'.257 uniqinits := make([]gccgoimporter.PackageInit, len(inits))258 uniqinitpos := len(inits)259 uniqinitnames := make(map[string]struct{})260 for i, _ := range inits {261 init := inits[len(inits)-1-i]262 if _, ok := uniqinitnames[init.InitFunc]; !ok {263 uniqinitnames[init.InitFunc] = struct{}{}264 uniqinitpos--265 uniqinits[uniqinitpos] = init266 }267 }268 uniqinits = uniqinits[uniqinitpos:]269 ourprio := 1270 if len(uniqinits) != 0 {271 ourprio = uniqinits[len(uniqinits)-1].Priority + 1272 }273 if imp := mainPkg.Func("init"); imp != nil {274 impname := c.types.mc.mangleFunctionName(imp)275 uniqinits = append(uniqinits, gccgoimporter.PackageInit{mainPkg.Object.Name(), impname, ourprio})276 }277 return gccgoimporter.InitData{ourprio, uniqinits}278}279func (c *compiler) createInitMainFunction(mainPkg *ssa.Package) {280 int8ptr := llvm.PointerType(c.types.ctx.Int8Type(), 0)281 ftyp := llvm.FunctionType(llvm.VoidType(), []llvm.Type{int8ptr}, false)282 initMain := llvm.AddFunction(c.module.Module, "__go_init_main", ftyp)283 c.addCommonFunctionAttrs(initMain)284 entry := llvm.AddBasicBlock(initMain, "entry")285 builder := llvm.GlobalContext().NewBuilder()286 defer builder.Dispose()287 builder.SetInsertPointAtEnd(entry)288 args := []llvm.Value{llvm.Undef(int8ptr)}289 if !c.GccgoABI {290 initfn := c.module.Module.NamedFunction("main..import")291 if !initfn.IsNil() {292 builder.CreateCall(initfn, args, "")293 }294 builder.CreateRetVoid()295 return296 }297 initdata := c.buildPackageInitData(mainPkg)298 for _, init := range initdata.Inits {299 initfn := c.module.Module.NamedFunction(init.InitFunc)300 if initfn.IsNil() {301 initfn = llvm.AddFunction(c.module.Module, init.InitFunc, ftyp)302 }303 builder.CreateCall(initfn, args, "")304 }305 builder.CreateRetVoid()306}307func (c *compiler) buildExportData(mainPkg *ssa.Package) []byte {308 exportData := importer.ExportData(mainPkg.Object)309 b := bytes.NewBuffer(exportData)310 b.WriteString("v1;\n")311 if !c.GccgoABI {312 return b.Bytes()313 }314 initdata := c.buildPackageInitData(mainPkg)315 b.WriteString("priority ")316 b.WriteString(strconv.Itoa(initdata.Priority))317 b.WriteString(";\n")318 if len(initdata.Inits) != 0 {319 b.WriteString("init")320 for _, init := range initdata.Inits {321 b.WriteRune(' ')...

Full Screen

Full Screen

directive.go

Source:directive.go Github

copy

Full Screen

...4// license that can be found in the LICENSE file.5// Verify that misplaced directives are diagnosed.6// ok7//go:build !ignore8//go:noinline // ERROR "misplaced compiler directive"9//go:noinline // ERROR "misplaced compiler directive"10package main11//go:build bad // ERROR "misplaced compiler directive"12//go:nosplit13func f1() {}14//go:nosplit15//go:noinline16func f2() {}17//go:noinline // ERROR "misplaced compiler directive"18//go:noinline // ERROR "misplaced compiler directive"19var x int20//go:noinline // ERROR "misplaced compiler directive"21const c = 122//go:noinline // ERROR "misplaced compiler directive"23type T int24// ok25//go:notinheap26type T1 int27//go:notinheap // ERROR "misplaced compiler directive"28type (29 //go:notinheap30 //go:noinline // ERROR "misplaced compiler directive"31 T2 int //go:notinheap // ERROR "misplaced compiler directive"32 T2b int33 //go:notinheap34 T2c int35 //go:noinline // ERROR "misplaced compiler directive"36 T3 int37)38//go:notinheap // ERROR "misplaced compiler directive"39type (40 //go:notinheap41 T4 int42)43//go:notinheap // ERROR "misplaced compiler directive"44type ()45type T5 int46func g() {} //go:noinline // ERROR "misplaced compiler directive"47// ok: attached to f (duplicated yes, but ok)48//go:noinline49//go:noinline50func f() {51 //go:noinline // ERROR "misplaced compiler directive"52 x := 153 //go:noinline // ERROR "misplaced compiler directive"54 {55 _ = x //go:noinline // ERROR "misplaced compiler directive"56 }57 //go:noinline // ERROR "misplaced compiler directive"58 var y int //go:noinline // ERROR "misplaced compiler directive"59 //go:noinline // ERROR "misplaced compiler directive"60 _ = y61 //go:noinline // ERROR "misplaced compiler directive"62 const c = 163 //go:noinline // ERROR "misplaced compiler directive"64 _ = func() {}65 //go:noinline // ERROR "misplaced compiler directive"66 // ok:67 //go:notinheap68 type T int69}70// someday there might be a directive that can apply to type aliases, but go:notinheap doesn't.71//go:notinheap // ERROR "misplaced compiler directive"72type T6 = int73// EOF74//go:noinline // ERROR "misplaced compiler directive"75//go:build bad // ERROR "misplaced compiler directive"...

Full Screen

Full Screen

compiler

Using AI Code Generation

copy

Full Screen

1require_once 'atoum/classes/compiler.php';2require_once 'atoum/classes/test.php';3require_once 'atoum/classes/autoloader.php';4require_once 'atoum/classes/adapter.php';5require_once 'atoum/classes/adapter/invoker.php';6require_once 'atoum/classes/adapter/invoker/exception.php';7require_once 'atoum/classes/adapter/invoker/undefinedMethod.php';8require_once 'atoum/classes/adapter/invoker/undefinedProperty.php';9require_once 'atoum/classes/adapter/invoker/undefinedConstant.php';10require_once 'atoum/classes/adapter/invoker/exception.php';11require_once 'atoum/classes/adapter/invoker/exception.php';12require_once 'atoum/classes/adapter/invoker/exception.php';13require_once 'atoum/classes/adapter/invoker/exception.php';14require_once 'atoum/classes/adapter/invoker/exception.php';15require_once 'atoum/classes/adapter/invoker/exception.php';16require_once 'atoum/classes/adapter/invoker/exception.php';17require_once 'atoum/classes/adapter/invoker/exception.php';18require_once 'atoum/classes/adapter/invoker/exception.php';19require_once 'atoum/classes/adapter/invoker/exception.php';

Full Screen

Full Screen

compiler

Using AI Code Generation

copy

Full Screen

1require_once 'atoum\classes\compiler.php';2require_once 'atoum\classes\test.php';3require_once 'atoum\classes\test\assertion.php';4require_once 'atoum\classes\test\assertion\manager.php';5require_once 'atoum\classes\test\assertion\manager\adapter.php';6require_once 'atoum\classes\test\assertion\manager\adapter\invoker.php';7require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php.php';8require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php\string.php';9require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php\string\cast.php';10require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php\string\cast\to.php';11require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php\string\cast\to\boolean.php';12require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php\string\cast\to\double.php';13require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php\string\cast\to\integer.php';14require_once 'atoum\classes\test\assertion\manager\adapter\invoker\php\string\cast\to\object.php';

Full Screen

Full Screen

compiler

Using AI Code Generation

copy

Full Screen

1$compiler = new atoum\autoloader\compiler();2 ->setRootDirectory(__DIR__)3 ->addDirectory(__DIR__ . '/atoum')4 ->addDirectory(__DIR__ . '/tests')5 ->compile(__DIR__ . '/atoum.compiled.php')6;7$compiler = new atoum\autoloader\compiler();8 ->setRootDirectory(__DIR__)9 ->addDirectory(__DIR__ . '/atoum')10 ->compile(__DIR__ . '/atoum.compiled.php')11;12$compiler = new atoum\autoloader\compiler();13 ->setRootDirectory(__DIR__)14 ->addDirectory(__DIR__ . '/atoum')15 ->addDirectory(__DIR__ . '/tests')16 ->compile(__DIR__ . '/atoum.compiled.php')17;18$compiler = new atoum\autoloader\compiler();19 ->setRootDirectory(__DIR__)20 ->addDirectory(__DIR__ . '/atoum')21 ->addDirectory(__DIR__ . '/tests')22 ->compile(__DIR__ . '/atoum.compiled.php')23;24$compiler = new atoum\autoloader\compiler();25 ->setRootDirectory(__DIR__)26 ->addDirectory(__DIR__ . '/atoum')27 ->addDirectory(__DIR__ . '/tests')28 ->compile(__DIR__ . '/atoum.compiled.php')29;30$compiler = new atoum\autoloader\compiler();31 ->setRootDirectory(__DIR__)32 ->addDirectory(__DIR__ . '/atoum')33 ->addDirectory(__DIR__ . '/tests')34 ->compile(__DIR__ . '/atoum.compiled.php')35;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful